Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / ChooseAction.cs / 1 / 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 (Keywords.Equals(nspace, input.Atoms.XsltNamespace)) { IfAction action = null; if (Keywords.Equals(name, input.Atoms.When)) { if (otherwise) { throw XsltException.Create(Res.Xslt_WhenAfterOtherwise); } action = compiler.CreateIfAction(IfAction.ConditionType.ConditionWhen); when = true; } else if (Keywords.Equals(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, Keywords.s_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 (Keywords.Equals(nspace, input.Atoms.XsltNamespace)) { IfAction action = null; if (Keywords.Equals(name, input.Atoms.When)) { if (otherwise) { throw XsltException.Create(Res.Xslt_WhenAfterOtherwise); } action = compiler.CreateIfAction(IfAction.ConditionType.ConditionWhen); when = true; } else if (Keywords.Equals(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, Keywords.s_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
- GcHandle.cs
- RoleServiceManager.cs
- SeekStoryboard.cs
- TransportChannelListener.cs
- ArgIterator.cs
- WorkflowViewService.cs
- InputMethodStateChangeEventArgs.cs
- MatrixAnimationBase.cs
- CatalogPartCollection.cs
- storepermission.cs
- AutomationEventArgs.cs
- FixedDSBuilder.cs
- FileDialog.cs
- CacheVirtualItemsEvent.cs
- Win32Native.cs
- StylusTip.cs
- ObjectStateEntryDbDataRecord.cs
- PriorityBinding.cs
- CreateUserWizard.cs
- DataControlLinkButton.cs
- FreezableOperations.cs
- PositiveTimeSpanValidatorAttribute.cs
- InertiaExpansionBehavior.cs
- HwndAppCommandInputProvider.cs
- WS2007FederationHttpBinding.cs
- ExpressionList.cs
- ReflectionTypeLoadException.cs
- OpCodes.cs
- Parallel.cs
- DataKeyCollection.cs
- NotSupportedException.cs
- ResourceManager.cs
- BrowserCapabilitiesFactory.cs
- ResponseBodyWriter.cs
- ServiceInstanceProvider.cs
- GridViewRow.cs
- HtmlTextArea.cs
- XmlAnyAttributeAttribute.cs
- DefaultPropertyAttribute.cs
- serverconfig.cs
- PropertyStore.cs
- ReadOnlyHierarchicalDataSourceView.cs
- Scripts.cs
- SimpleBitVector32.cs
- WSIdentityFaultException.cs
- ProxyWebPartManagerDesigner.cs
- PropertyConverter.cs
- ComProxy.cs
- ExpressionPrefixAttribute.cs
- SchemaConstraints.cs
- Mouse.cs
- CodeIdentifiers.cs
- Triangle.cs
- SHA1CryptoServiceProvider.cs
- PersonalizableAttribute.cs
- CompilerCollection.cs
- QuadraticBezierSegment.cs
- KnownBoxes.cs
- BufferModeSettings.cs
- Misc.cs
- ColumnWidthChangedEvent.cs
- MarkupProperty.cs
- Codec.cs
- GenericXmlSecurityToken.cs
- TiffBitmapEncoder.cs
- IPHostEntry.cs
- TransformCryptoHandle.cs
- autovalidator.cs
- OdbcParameter.cs
- CmsUtils.cs
- XmlElementAttributes.cs
- UnionExpr.cs
- BaseParser.cs
- XmlDeclaration.cs
- DispatcherExceptionFilterEventArgs.cs
- ContentHostHelper.cs
- DataGridViewHitTestInfo.cs
- SqlDataSourceCustomCommandEditor.cs
- CryptoProvider.cs
- HttpModuleActionCollection.cs
- RegexCompilationInfo.cs
- HGlobalSafeHandle.cs
- UnsafeNativeMethods.cs
- HtmlWindowCollection.cs
- SchemaTypeEmitter.cs
- RangeValuePattern.cs
- ObjectStorage.cs
- SmiRequestExecutor.cs
- HttpCapabilitiesEvaluator.cs
- PrinterSettings.cs
- BaseProcessor.cs
- SlotInfo.cs
- SubMenuStyleCollection.cs
- EditorZone.cs
- UniqueTransportManagerRegistration.cs
- PathSegmentCollection.cs
- ValidationResult.cs
- XmlSerializerAssemblyAttribute.cs
- LogSwitch.cs
- SmtpException.cs