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
- FrameworkElementFactoryMarkupObject.cs
- TextCompositionEventArgs.cs
- Material.cs
- FeatureSupport.cs
- Cursor.cs
- PropertyEmitter.cs
- TryLoadRunnableWorkflowCommand.cs
- Single.cs
- ItemType.cs
- SettingsBase.cs
- NavigatingCancelEventArgs.cs
- DurableRuntimeValidator.cs
- InstanceLockLostException.cs
- SecurityCriticalDataForSet.cs
- SafeProcessHandle.cs
- ExpressionQuoter.cs
- ChannelSinkStacks.cs
- WorkflowTimerService.cs
- QueryAccessibilityHelpEvent.cs
- TemplateBaseAction.cs
- BufferedGraphicsContext.cs
- BitmapMetadataBlob.cs
- EntityTypeEmitter.cs
- ColumnMapCopier.cs
- StringFormat.cs
- XmlSchemaComplexContentExtension.cs
- DbMetaDataFactory.cs
- WeakReferenceEnumerator.cs
- HttpWebRequestElement.cs
- MergePropertyDescriptor.cs
- XmlWhitespace.cs
- PersonalizableAttribute.cs
- EdmToObjectNamespaceMap.cs
- DoneReceivingAsyncResult.cs
- FixedSOMTextRun.cs
- MetadataSerializer.cs
- HideDisabledControlAdapter.cs
- BindToObject.cs
- RangeValueProviderWrapper.cs
- SqlRowUpdatingEvent.cs
- RuntimeArgumentHandle.cs
- DataBoundLiteralControl.cs
- RectConverter.cs
- AssociationTypeEmitter.cs
- PropertyInformation.cs
- SqlBuilder.cs
- RequestCacheValidator.cs
- EntitySetBaseCollection.cs
- DesignerLoader.cs
- WCFBuildProvider.cs
- DataBindingCollection.cs
- IxmlLineInfo.cs
- AssertUtility.cs
- Scalars.cs
- DependencyPropertyDescriptor.cs
- SmiTypedGetterSetter.cs
- CodeTypeParameter.cs
- ImageList.cs
- InternalBufferOverflowException.cs
- Trustee.cs
- Funcletizer.cs
- SelectionItemProviderWrapper.cs
- CompositeKey.cs
- UInt16Converter.cs
- ComponentCommands.cs
- path.cs
- FieldTemplateUserControl.cs
- ExpressionUtilities.cs
- ParenthesizePropertyNameAttribute.cs
- PageThemeCodeDomTreeGenerator.cs
- SqlVisitor.cs
- DelayedRegex.cs
- FilterException.cs
- RenderDataDrawingContext.cs
- TemplatingOptionsDialog.cs
- OdbcInfoMessageEvent.cs
- ReachPageContentCollectionSerializerAsync.cs
- Evidence.cs
- WebPartActionVerb.cs
- TableAutomationPeer.cs
- RightsManagementEncryptionTransform.cs
- XmlSchemaInfo.cs
- SharedPerformanceCounter.cs
- MouseBinding.cs
- RawMouseInputReport.cs
- OdbcConnectionString.cs
- LinkLabel.cs
- Latin1Encoding.cs
- TextClipboardData.cs
- CombinedGeometry.cs
- SafeNativeMethods.cs
- MetadataConversionError.cs
- MenuItem.cs
- CodeExpressionRuleDeclaration.cs
- XmlNode.cs
- QueryableDataSourceHelper.cs
- _ShellExpression.cs
- EdmFunctions.cs
- FreeFormDesigner.cs
- SyntaxCheck.cs