Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / IfAction.cs / 1 / 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, Keywords.s_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 (Keywords.Equals(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. //------------------------------------------------------------------------------ //// 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, Keywords.s_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 (Keywords.Equals(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
- RecordBuilder.cs
- IndexerNameAttribute.cs
- StringKeyFrameCollection.cs
- AxisAngleRotation3D.cs
- HotCommands.cs
- DataBindingCollection.cs
- CharacterString.cs
- DBSqlParserTable.cs
- XmlWriterSettings.cs
- PointCollection.cs
- ExpandSegment.cs
- XmlValidatingReader.cs
- FileDialog_Vista_Interop.cs
- MeasureItemEvent.cs
- BitmapFrame.cs
- CompressStream.cs
- LinkArea.cs
- TableStyle.cs
- TextTreeFixupNode.cs
- Button.cs
- ItemCollection.cs
- EpmContentDeSerializerBase.cs
- InvokeMethodActivity.cs
- SchemaObjectWriter.cs
- Vector3DCollection.cs
- XmlDictionaryReaderQuotas.cs
- LinkedDataMemberFieldEditor.cs
- ConfigurationConverterBase.cs
- AssertSection.cs
- ScopedMessagePartSpecification.cs
- ProtocolElement.cs
- SoapIncludeAttribute.cs
- TraceSection.cs
- InputScopeManager.cs
- QueryTaskGroupState.cs
- XPathDocument.cs
- MasterPage.cs
- ProfileProvider.cs
- PropertyEmitterBase.cs
- EntityContainerAssociationSetEnd.cs
- CanExecuteRoutedEventArgs.cs
- WindowsListViewScroll.cs
- HttpModuleAction.cs
- ConnectionConsumerAttribute.cs
- Rule.cs
- RSACryptoServiceProvider.cs
- DocumentPageViewAutomationPeer.cs
- GeneralTransform2DTo3D.cs
- Label.cs
- FlowDecision.cs
- CrossSiteScriptingValidation.cs
- Int16Animation.cs
- DetailsView.cs
- TypeViewSchema.cs
- FormViewDeletedEventArgs.cs
- CustomError.cs
- ObservableCollection.cs
- CanonicalizationDriver.cs
- WebPartTransformerCollection.cs
- ping.cs
- IISMapPath.cs
- WindowsSecurityTokenAuthenticator.cs
- DataServiceExpressionVisitor.cs
- DataBindingList.cs
- UserControlBuildProvider.cs
- CroppedBitmap.cs
- DuplexClientBase.cs
- TextEncodedRawTextWriter.cs
- ScriptModule.cs
- HtmlTextArea.cs
- KeyboardDevice.cs
- RoleGroupCollection.cs
- DataGridHeaderBorder.cs
- InstanceOwner.cs
- XmlException.cs
- PropertyOverridesDialog.cs
- X509Utils.cs
- TraceListener.cs
- ReachDocumentSequenceSerializerAsync.cs
- TreeNodeCollectionEditor.cs
- InvokeProviderWrapper.cs
- UndirectedGraph.cs
- Registry.cs
- HtmlInputImage.cs
- DbConnectionStringCommon.cs
- DocobjHost.cs
- Triplet.cs
- TypeEnumerableViewSchema.cs
- RowCache.cs
- Registry.cs
- sitestring.cs
- WriteFileContext.cs
- StaticSiteMapProvider.cs
- XamlHostingSection.cs
- DeploymentSection.cs
- CodeFieldReferenceExpression.cs
- SqlDataSourceView.cs
- TypeInfo.cs
- MetroSerializationManager.cs
- TreeNodeClickEventArgs.cs