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
- SignatureToken.cs
- Compensation.cs
- PropertyFilterAttribute.cs
- DrawingBrush.cs
- HTMLTagNameToTypeMapper.cs
- StaticDataManager.cs
- BooleanSwitch.cs
- XmlQueryType.cs
- DesignerHost.cs
- ExclusiveCanonicalizationTransform.cs
- PolicyStatement.cs
- FileDialog_Vista_Interop.cs
- OrderedDictionary.cs
- HttpResponseInternalWrapper.cs
- HtmlControlAdapter.cs
- SynchronousChannelMergeEnumerator.cs
- ScaleTransform.cs
- DecimalConstantAttribute.cs
- TreeChangeInfo.cs
- QilStrConcat.cs
- TableChangeProcessor.cs
- Vector3DKeyFrameCollection.cs
- StringHandle.cs
- HMAC.cs
- ExtractCollection.cs
- streamingZipPartStream.cs
- Atom10FeedFormatter.cs
- GPStream.cs
- StreamAsIStream.cs
- SystemTcpStatistics.cs
- loginstatus.cs
- HttpServerVarsCollection.cs
- PersonalizationDictionary.cs
- PasswordPropertyTextAttribute.cs
- ParseNumbers.cs
- NavigationProgressEventArgs.cs
- AdCreatedEventArgs.cs
- Path.cs
- AbstractSvcMapFileLoader.cs
- SQLResource.cs
- PasswordBoxAutomationPeer.cs
- SwitchElementsCollection.cs
- DrawListViewSubItemEventArgs.cs
- RoleGroupCollection.cs
- LogSwitch.cs
- ProcessHostConfigUtils.cs
- ConsoleCancelEventArgs.cs
- EntityDataSourceView.cs
- EventItfInfo.cs
- AnonymousIdentificationModule.cs
- CodeDelegateInvokeExpression.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- SqlUdtInfo.cs
- CriticalHandle.cs
- UrlMappingsSection.cs
- RichTextBoxAutomationPeer.cs
- UntrustedRecipientException.cs
- CodeTypeParameterCollection.cs
- ScaleTransform3D.cs
- UnsafeNativeMethods.cs
- CacheChildrenQuery.cs
- EmptyQuery.cs
- Function.cs
- FlowDocumentFormatter.cs
- GridEntryCollection.cs
- COM2ExtendedBrowsingHandler.cs
- SkipQueryOptionExpression.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- SymbolMethod.cs
- MILUtilities.cs
- SqlClientFactory.cs
- HMACSHA1.cs
- PropertyGridDesigner.cs
- DesignBindingEditor.cs
- PolicyException.cs
- ResourcesChangeInfo.cs
- CompiledQueryCacheEntry.cs
- _ShellExpression.cs
- SymbolType.cs
- WaitHandleCannotBeOpenedException.cs
- updateconfighost.cs
- QuaternionRotation3D.cs
- DesignTimeTemplateParser.cs
- TypedAsyncResult.cs
- SQLInt64.cs
- XPathAxisIterator.cs
- SqlRecordBuffer.cs
- CompilerGlobalScopeAttribute.cs
- AdapterDictionary.cs
- WebPartConnectionsCancelEventArgs.cs
- FixedSOMTextRun.cs
- CodeGenerator.cs
- FileNotFoundException.cs
- ReceiveCompletedEventArgs.cs
- SingleAnimation.cs
- ProtocolsSection.cs
- ISAPIWorkerRequest.cs
- ButtonChrome.cs
- MultipartContentParser.cs
- COAUTHIDENTITY.cs