Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / IfAction.cs / 1305376 / IfAction.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Xsl.XsltOld { using Res = System.Xml.Utils.Res; using System; using System.Diagnostics; using System.Xml; using System.Xml.XPath; internal class IfAction : ContainerAction { internal enum ConditionType { ConditionIf, ConditionWhen, ConditionOtherwise } private ConditionType type; private int testKey = Compiler.InvalidQueryKey; internal IfAction(ConditionType type) { this.type = type; } internal override void Compile(Compiler compiler) { CompileAttributes(compiler); if (this.type != ConditionType.ConditionOtherwise) { CheckRequiredAttribute(compiler, this.testKey != Compiler.InvalidQueryKey, "test"); } if (compiler.Recurse()) { CompileTemplate(compiler); compiler.ToParent(); } } internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Test)) { if (this.type == ConditionType.ConditionOtherwise) { return false; } this.testKey = compiler.AddBooleanQuery(value); } else { return false; } return true; } internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: if (this.type == ConditionType.ConditionIf || this.type == ConditionType.ConditionWhen) { Debug.Assert(this.testKey != Compiler.InvalidQueryKey); bool value = processor.EvaluateBoolean(frame, this.testKey); if (value == false) { frame.Finished(); break; } } processor.PushActionFrame(frame); frame.State = ProcessingChildren; break; // Allow children to run case ProcessingChildren: if (this.type == ConditionType.ConditionWhen ||this.type == ConditionType.ConditionOtherwise) { Debug.Assert(frame.Container != null); frame.Exit(); } frame.Finished(); break; default: Debug.Fail("Invalid IfAction execution state"); break; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- COM2TypeInfoProcessor.cs
- MonikerProxyAttribute.cs
- TableLayoutPanelResizeGlyph.cs
- SynchronizationFilter.cs
- WmlCalendarAdapter.cs
- XPathNodeIterator.cs
- DirectoryNotFoundException.cs
- ReadingWritingEntityEventArgs.cs
- DefaultEventAttribute.cs
- XmlFormatWriterGenerator.cs
- TimeZone.cs
- SwitchLevelAttribute.cs
- complextypematerializer.cs
- StylusPlugInCollection.cs
- ProviderSettingsCollection.cs
- LinqTreeNodeEvaluator.cs
- MsmqAppDomainProtocolHandler.cs
- UpdateManifestForBrowserApplication.cs
- MetadataPropertyvalue.cs
- DataSvcMapFileSerializer.cs
- TraceSource.cs
- HostedElements.cs
- ResourceDefaultValueAttribute.cs
- CounterSampleCalculator.cs
- WmpBitmapEncoder.cs
- XmlHelper.cs
- HttpCachePolicy.cs
- VirtualPathProvider.cs
- CaseStatementProjectedSlot.cs
- RelatedView.cs
- AutomationAttributeInfo.cs
- dataSvcMapFileLoader.cs
- ConfigurationConverterBase.cs
- WebPartVerbCollection.cs
- WorkflowRequestContext.cs
- BoolExpression.cs
- DbConnectionClosed.cs
- BamlMapTable.cs
- DiagnosticTraceSchemas.cs
- FileUpload.cs
- InternalResources.cs
- SoapHeaderException.cs
- DbConnectionPoolIdentity.cs
- AtomParser.cs
- AppDomainGrammarProxy.cs
- ProxyGenerationError.cs
- UnsafeNativeMethods.cs
- ParameterToken.cs
- GuidelineCollection.cs
- InstanceDescriptor.cs
- CodePropertyReferenceExpression.cs
- Dictionary.cs
- XsltInput.cs
- HeaderUtility.cs
- XmlReflectionImporter.cs
- ManagementOptions.cs
- AlignmentXValidation.cs
- VisualProxy.cs
- AppDomain.cs
- ThreadStateException.cs
- PreviewPageInfo.cs
- UInt32Storage.cs
- BaseCodeDomTreeGenerator.cs
- DateTimeUtil.cs
- CustomErrorCollection.cs
- ActivityWithResultValueSerializer.cs
- Publisher.cs
- IndentedTextWriter.cs
- BoundField.cs
- ThreadStaticAttribute.cs
- DataTemplate.cs
- StickyNoteAnnotations.cs
- PassportAuthenticationModule.cs
- SchemaImporter.cs
- CheckBoxStandardAdapter.cs
- OdbcConnectionOpen.cs
- RegisteredHiddenField.cs
- SelectionManager.cs
- FragmentNavigationEventArgs.cs
- DataSetMappper.cs
- WindowsClientElement.cs
- InputLanguageEventArgs.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- HttpCachePolicyBase.cs
- CachedCompositeFamily.cs
- DbSetClause.cs
- Enlistment.cs
- ParameterCollection.cs
- Parsers.cs
- ProgressChangedEventArgs.cs
- FileReservationCollection.cs
- StringSorter.cs
- CheckBox.cs
- ComponentManagerBroker.cs
- BufferedGraphicsManager.cs
- SoapHelper.cs
- ILGenerator.cs
- HtmlInputSubmit.cs
- TraceSource.cs
- DeviceSpecific.cs