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
- AmbientLight.cs
- SchemaContext.cs
- DBCSCodePageEncoding.cs
- RepeatButtonAutomationPeer.cs
- Vars.cs
- CatalogPartCollection.cs
- KnownTypes.cs
- TypePropertyEditor.cs
- RegionData.cs
- MessageBodyMemberAttribute.cs
- Pair.cs
- UIElementAutomationPeer.cs
- AdditionalEntityFunctions.cs
- CatalogPartCollection.cs
- JsonStringDataContract.cs
- ContextMenuService.cs
- MouseEvent.cs
- MarkupWriter.cs
- ConfigurationStrings.cs
- autovalidator.cs
- _SpnDictionary.cs
- ExecutedRoutedEventArgs.cs
- StreamWriter.cs
- Rectangle.cs
- UnmanagedBitmapWrapper.cs
- RegistryKey.cs
- EpmContentSerializer.cs
- DataGridPagerStyle.cs
- EventItfInfo.cs
- UTF7Encoding.cs
- AssemblyInfo.cs
- MemberBinding.cs
- NegationPusher.cs
- ObjectDataSourceDisposingEventArgs.cs
- ISAPIWorkerRequest.cs
- BindingListCollectionView.cs
- ClosableStream.cs
- ExpressionBinding.cs
- FocusChangedEventArgs.cs
- SystemMulticastIPAddressInformation.cs
- XmlDocumentType.cs
- EnumMember.cs
- LogStore.cs
- BooleanSwitch.cs
- AsyncOperation.cs
- AuthenticationServiceManager.cs
- RoutedPropertyChangedEventArgs.cs
- VideoDrawing.cs
- MatrixKeyFrameCollection.cs
- Link.cs
- ReflectionTypeLoadException.cs
- CallSiteOps.cs
- XamlFilter.cs
- XmlSchemaAppInfo.cs
- TransactionBridgeSection.cs
- IListConverters.cs
- XmlSerializerVersionAttribute.cs
- InputReport.cs
- DataPagerFieldItem.cs
- StringDictionary.cs
- DependencyProperty.cs
- ConsumerConnectionPoint.cs
- DocumentPage.cs
- DesignerVerb.cs
- MostlySingletonList.cs
- TrustLevel.cs
- TextLine.cs
- UnionCqlBlock.cs
- FormsAuthenticationCredentials.cs
- Command.cs
- RequestResizeEvent.cs
- HitTestDrawingContextWalker.cs
- IndicShape.cs
- XsdValidatingReader.cs
- ProfessionalColorTable.cs
- DataRowView.cs
- AvTrace.cs
- WindowsGraphics2.cs
- HtmlShimManager.cs
- DataControlFieldHeaderCell.cs
- WorkflowViewStateService.cs
- BooleanExpr.cs
- ReachFixedDocumentSerializerAsync.cs
- WebPartConnectionsDisconnectVerb.cs
- AudioDeviceOut.cs
- TableLayoutStyleCollection.cs
- SortDescription.cs
- OpenTypeCommon.cs
- TemplateNodeContextMenu.cs
- TrustManagerMoreInformation.cs
- XmlIncludeAttribute.cs
- XmlQueryStaticData.cs
- XamlInt32CollectionSerializer.cs
- CodeTypeConstructor.cs
- ContentType.cs
- ManifestSignatureInformation.cs
- SafeLocalAllocation.cs
- Form.cs
- Query.cs
- RuntimeConfigurationRecord.cs