Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / ChooseAction.cs / 1305376 / ChooseAction.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 ChooseAction : ContainerAction { internal override void Compile(Compiler compiler) { CompileAttributes(compiler); if (compiler.Recurse()) { CompileConditions(compiler); compiler.ToParent(); } } private void CompileConditions(Compiler compiler) { NavigatorInput input = compiler.Input; bool when = false; bool otherwise = false; do { switch (input.NodeType) { case XPathNodeType.Element: compiler.PushNamespaceScope(); string nspace = input.NamespaceURI; string name = input.LocalName; if (Ref.Equal(nspace, input.Atoms.UriXsl)) { IfAction action = null; if (Ref.Equal(name, input.Atoms.When)) { if (otherwise) { throw XsltException.Create(Res.Xslt_WhenAfterOtherwise); } action = compiler.CreateIfAction(IfAction.ConditionType.ConditionWhen); when = true; } else if (Ref.Equal(name, input.Atoms.Otherwise)) { if (otherwise) { throw XsltException.Create(Res.Xslt_DupOtherwise); } action = compiler.CreateIfAction(IfAction.ConditionType.ConditionOtherwise); otherwise = true; } else { throw compiler.UnexpectedKeyword(); } AddAction(action); } else { throw compiler.UnexpectedKeyword(); } compiler.PopScope(); break; case XPathNodeType.Comment: case XPathNodeType.ProcessingInstruction: case XPathNodeType.Whitespace: case XPathNodeType.SignificantWhitespace: break; default: throw XsltException.Create(Res.Xslt_InvalidContents, "choose"); } } while (compiler.Advance()); if (! when) { throw XsltException.Create(Res.Xslt_NoWhen); } } } } // 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 ChooseAction : ContainerAction { internal override void Compile(Compiler compiler) { CompileAttributes(compiler); if (compiler.Recurse()) { CompileConditions(compiler); compiler.ToParent(); } } private void CompileConditions(Compiler compiler) { NavigatorInput input = compiler.Input; bool when = false; bool otherwise = false; do { switch (input.NodeType) { case XPathNodeType.Element: compiler.PushNamespaceScope(); string nspace = input.NamespaceURI; string name = input.LocalName; if (Ref.Equal(nspace, input.Atoms.UriXsl)) { IfAction action = null; if (Ref.Equal(name, input.Atoms.When)) { if (otherwise) { throw XsltException.Create(Res.Xslt_WhenAfterOtherwise); } action = compiler.CreateIfAction(IfAction.ConditionType.ConditionWhen); when = true; } else if (Ref.Equal(name, input.Atoms.Otherwise)) { if (otherwise) { throw XsltException.Create(Res.Xslt_DupOtherwise); } action = compiler.CreateIfAction(IfAction.ConditionType.ConditionOtherwise); otherwise = true; } else { throw compiler.UnexpectedKeyword(); } AddAction(action); } else { throw compiler.UnexpectedKeyword(); } compiler.PopScope(); break; case XPathNodeType.Comment: case XPathNodeType.ProcessingInstruction: case XPathNodeType.Whitespace: case XPathNodeType.SignificantWhitespace: break; default: throw XsltException.Create(Res.Xslt_InvalidContents, "choose"); } } while (compiler.Advance()); if (! when) { throw XsltException.Create(Res.Xslt_NoWhen); } } } } // 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
- SiteMapProvider.cs
- Activity.cs
- AttachedAnnotation.cs
- RegexMatchCollection.cs
- ExpressionBuilderCollection.cs
- AbstractSvcMapFileLoader.cs
- InputLanguage.cs
- FilteredDataSetHelper.cs
- DataGridAutomationPeer.cs
- TextSelectionHelper.cs
- MessageSecurityTokenVersion.cs
- EntityChangedParams.cs
- BuildManager.cs
- _SSPIWrapper.cs
- CapabilitiesRule.cs
- ApplicationServicesHostFactory.cs
- CharacterString.cs
- MediaElementAutomationPeer.cs
- EntityContainer.cs
- DiscoveryProxy.cs
- ProgressBarAutomationPeer.cs
- Predicate.cs
- ParallelTimeline.cs
- GeometryConverter.cs
- MetafileHeaderEmf.cs
- HtmlControlPersistable.cs
- File.cs
- _ListenerResponseStream.cs
- DeferredTextReference.cs
- FlowLayoutSettings.cs
- TextTreeUndo.cs
- MailMessageEventArgs.cs
- DbCommandDefinition.cs
- RootBrowserWindowProxy.cs
- XamlRtfConverter.cs
- ObjectListComponentEditor.cs
- SafeArrayTypeMismatchException.cs
- WindowsListViewGroup.cs
- IODescriptionAttribute.cs
- ConfigurationLockCollection.cs
- CompoundFileStorageReference.cs
- UserPreferenceChangedEventArgs.cs
- ReflectionServiceProvider.cs
- PageRanges.cs
- SettingsAttributeDictionary.cs
- ReflectEventDescriptor.cs
- TCEAdapterGenerator.cs
- CancelEventArgs.cs
- XmlSchemaInclude.cs
- ControlCachePolicy.cs
- DebugView.cs
- RegexCompilationInfo.cs
- ScriptRegistrationManager.cs
- AppDomainAttributes.cs
- HttpListenerContext.cs
- BrowserCapabilitiesFactoryBase.cs
- BooleanExpr.cs
- HttpModuleAction.cs
- LocatorPart.cs
- SystemEvents.cs
- SendActivityDesignerTheme.cs
- ExceptionRoutedEventArgs.cs
- DocumentPageTextView.cs
- AuthenticationServiceManager.cs
- WindowsPen.cs
- ComAdminWrapper.cs
- PackWebResponse.cs
- DesignerHost.cs
- Menu.cs
- UInt64Converter.cs
- DBNull.cs
- XmlElementAttributes.cs
- WebServiceMethodData.cs
- DataControlFieldHeaderCell.cs
- MD5.cs
- NativeCppClassAttribute.cs
- DesignSurfaceServiceContainer.cs
- TypeExtension.cs
- rsa.cs
- Opcode.cs
- SystemResourceKey.cs
- SafeSecurityHelper.cs
- ClosableStream.cs
- FatalException.cs
- ErrorTolerantObjectWriter.cs
- DataTableMapping.cs
- TemplateManager.cs
- SerializationAttributes.cs
- StretchValidation.cs
- ValidatorCollection.cs
- TextTreeTextElementNode.cs
- WriterOutput.cs
- BCLDebug.cs
- InputBindingCollection.cs
- ProgramPublisher.cs
- Evaluator.cs
- ConstraintManager.cs
- ExpandCollapsePattern.cs
- NamespaceQuery.cs
- Int64.cs