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
- Model3DGroup.cs
- SQLGuid.cs
- HiddenField.cs
- StackOverflowException.cs
- PresentationAppDomainManager.cs
- PreservationFileReader.cs
- Ipv6Element.cs
- Behavior.cs
- PriorityRange.cs
- CollectionBase.cs
- DbConnectionFactory.cs
- RegexCharClass.cs
- VectorKeyFrameCollection.cs
- ObjectDataSourceEventArgs.cs
- TemplatedWizardStep.cs
- Encoding.cs
- AnimatedTypeHelpers.cs
- BinaryFormatter.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- TemplateBamlTreeBuilder.cs
- QilReplaceVisitor.cs
- XpsResource.cs
- PathSegment.cs
- CodeDomComponentSerializationService.cs
- ActivityDesignerAccessibleObject.cs
- ConfigurationStrings.cs
- XmlQueryRuntime.cs
- FormattedText.cs
- TextBoxAutomationPeer.cs
- SqlMethodAttribute.cs
- TextElement.cs
- DependsOnAttribute.cs
- Switch.cs
- Color.cs
- RSAPKCS1KeyExchangeFormatter.cs
- HTMLTagNameToTypeMapper.cs
- DocumentSequence.cs
- SocketCache.cs
- FixedSOMPageElement.cs
- AnnotationAdorner.cs
- XPathParser.cs
- PersistenceTypeAttribute.cs
- TableCellCollection.cs
- PermissionAttributes.cs
- BlurEffect.cs
- DataGridViewComboBoxColumn.cs
- Menu.cs
- BindingExpression.cs
- AvTraceDetails.cs
- UriSection.cs
- GridProviderWrapper.cs
- HtmlFormWrapper.cs
- ValidatorCompatibilityHelper.cs
- SequenceFullException.cs
- AddingNewEventArgs.cs
- AccessKeyManager.cs
- StorageEntitySetMapping.cs
- CreateUserErrorEventArgs.cs
- ContentType.cs
- DescendantOverDescendantQuery.cs
- AuthorizationContext.cs
- InternalTransaction.cs
- SEHException.cs
- CheckBox.cs
- SizeLimitedCache.cs
- StyleBamlTreeBuilder.cs
- UpdateProgress.cs
- BackgroundFormatInfo.cs
- Attributes.cs
- GridViewRowPresenterBase.cs
- EventWaitHandleSecurity.cs
- MailBnfHelper.cs
- SourceLineInfo.cs
- DispatcherHookEventArgs.cs
- SafeArrayTypeMismatchException.cs
- AsyncPostBackErrorEventArgs.cs
- ColumnClickEvent.cs
- WindowsIPAddress.cs
- TextReader.cs
- Triplet.cs
- RSAPKCS1SignatureFormatter.cs
- GroupItemAutomationPeer.cs
- SimpleFieldTemplateUserControl.cs
- oledbmetadatacollectionnames.cs
- AppDomainEvidenceFactory.cs
- linebase.cs
- WebPartZoneBase.cs
- TextDecoration.cs
- XmlSerializableWriter.cs
- NativeRecognizer.cs
- BlurBitmapEffect.cs
- DiscoveryMessageSequence11.cs
- ToolStripPanel.cs
- TargetInvocationException.cs
- ContainerUIElement3D.cs
- ComponentEditorPage.cs
- XamlFigureLengthSerializer.cs
- SubclassTypeValidator.cs
- ImpersonationContext.cs
- StyleHelper.cs