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
- EventRoute.cs
- PassportIdentity.cs
- DataGridViewTextBoxColumn.cs
- TreeNodeCollection.cs
- VersionUtil.cs
- PreviewPrintController.cs
- XPathScanner.cs
- FormViewInsertEventArgs.cs
- DataGridTableStyleMappingNameEditor.cs
- NativeMethods.cs
- Win32MouseDevice.cs
- WebFormDesignerActionService.cs
- DefaultPropertyAttribute.cs
- SocketInformation.cs
- ResolveNameEventArgs.cs
- HwndSourceParameters.cs
- ConfigurationValue.cs
- EpmSyndicationContentDeSerializer.cs
- XmlIncludeAttribute.cs
- CompositeScriptReferenceEventArgs.cs
- OracleConnectionString.cs
- DefinitionProperties.cs
- ArrayItemReference.cs
- LineBreak.cs
- XPathScanner.cs
- SessionStateModule.cs
- LookupNode.cs
- BindingBase.cs
- DesignTimeVisibleAttribute.cs
- Slider.cs
- SoapFormatExtensions.cs
- MetadataItemSerializer.cs
- CatalogPartCollection.cs
- Annotation.cs
- IProvider.cs
- COAUTHIDENTITY.cs
- CryptoConfig.cs
- ApplicationSettingsBase.cs
- XsdDataContractImporter.cs
- ListViewItem.cs
- CatalogPartCollection.cs
- DocumentSequenceHighlightLayer.cs
- WindowsListViewGroupHelper.cs
- GradientStop.cs
- LiteralControl.cs
- ColumnMapCopier.cs
- TTSVoice.cs
- ThousandthOfEmRealDoubles.cs
- MonthCalendar.cs
- TextParagraphProperties.cs
- SiteMapPath.cs
- Point3DCollection.cs
- ListSortDescription.cs
- ReachDocumentReferenceSerializer.cs
- HostProtectionPermission.cs
- ToolStripPanelRenderEventArgs.cs
- ParseHttpDate.cs
- WindowsListView.cs
- CustomErrorsSection.cs
- PropVariant.cs
- ProxyElement.cs
- ClientFormsIdentity.cs
- PackagePartCollection.cs
- DataProviderNameConverter.cs
- ConfigurationLocationCollection.cs
- XamlRtfConverter.cs
- TraceListeners.cs
- TaskFormBase.cs
- UniformGrid.cs
- CounterCreationData.cs
- SolidBrush.cs
- EntryIndex.cs
- EntityContainerEntitySet.cs
- ExceptionValidationRule.cs
- ReflectPropertyDescriptor.cs
- DiscoveryInnerClientAdhoc11.cs
- SocketElement.cs
- TableCellAutomationPeer.cs
- PropertyCondition.cs
- InstanceKeyCollisionException.cs
- Directory.cs
- RowType.cs
- SettingsBase.cs
- XmlJsonReader.cs
- TwoPhaseCommit.cs
- SessionPageStatePersister.cs
- EntityTypeBase.cs
- WorkerRequest.cs
- DataGridViewAdvancedBorderStyle.cs
- TreeView.cs
- StreamBodyWriter.cs
- HttpModuleCollection.cs
- MultipartContentParser.cs
- ReadOnlyDataSource.cs
- TransactionFlowProperty.cs
- XmlSortKeyAccumulator.cs
- WindowsSspiNegotiation.cs
- Inflater.cs
- Merger.cs
- ISessionStateStore.cs