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
- ButtonChrome.cs
- ComponentManagerBroker.cs
- SingleKeyFrameCollection.cs
- AuthenticatedStream.cs
- FramingEncoders.cs
- QuadraticBezierSegment.cs
- Scripts.cs
- IODescriptionAttribute.cs
- EditingMode.cs
- EncoderReplacementFallback.cs
- PolicyVersion.cs
- TreeNodeBinding.cs
- XmlDataDocument.cs
- XPathMultyIterator.cs
- EventLogInternal.cs
- ProtectedConfigurationProviderCollection.cs
- AnnotationService.cs
- GridEntryCollection.cs
- SchemaElementLookUpTableEnumerator.cs
- Attachment.cs
- IPEndPoint.cs
- ObjectMemberMapping.cs
- Object.cs
- ClonableStack.cs
- ReadOnlyHierarchicalDataSourceView.cs
- TrackingAnnotationCollection.cs
- ApplyTemplatesAction.cs
- HtmlInputHidden.cs
- TransactionFlowBindingElement.cs
- ManagementQuery.cs
- DateTimeUtil.cs
- RadioButton.cs
- SelectionItemProviderWrapper.cs
- TdsParserSafeHandles.cs
- LazyTextWriterCreator.cs
- FileSystemEventArgs.cs
- ItemList.cs
- __FastResourceComparer.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- DictionaryCustomTypeDescriptor.cs
- CodeNamespaceImport.cs
- DataConnectionHelper.cs
- FixedDocumentSequencePaginator.cs
- Accessible.cs
- SafeNativeMethodsOther.cs
- JsonDeserializer.cs
- Fonts.cs
- ObjectViewQueryResultData.cs
- SqlBulkCopyColumnMapping.cs
- TextMarkerSource.cs
- XmlSerializerVersionAttribute.cs
- StoragePropertyMapping.cs
- TextWriter.cs
- QilInvokeEarlyBound.cs
- CardSpacePolicyElement.cs
- TextTreeTextElementNode.cs
- PersonalizationStateInfoCollection.cs
- InvokeMethodActivityDesigner.cs
- DataStreams.cs
- OracleConnectionString.cs
- HtmlTableRowCollection.cs
- CapabilitiesState.cs
- CollectionEditor.cs
- IERequestCache.cs
- StdRegProviderWrapper.cs
- ClipboardData.cs
- ScrollItemPatternIdentifiers.cs
- dataprotectionpermission.cs
- HideDisabledControlAdapter.cs
- TypeInitializationException.cs
- COM2Enum.cs
- NamespaceQuery.cs
- Pkcs9Attribute.cs
- ConfigurationValidatorBase.cs
- OleDbParameterCollection.cs
- ConsoleKeyInfo.cs
- _NtlmClient.cs
- LedgerEntry.cs
- RenderTargetBitmap.cs
- RegistryKey.cs
- TargetControlTypeCache.cs
- RelatedCurrencyManager.cs
- StretchValidation.cs
- SoapExtensionTypeElement.cs
- ColorMatrix.cs
- CanExecuteRoutedEventArgs.cs
- TextServicesContext.cs
- ImageUrlEditor.cs
- GroupItemAutomationPeer.cs
- SoapTypeAttribute.cs
- EqualityComparer.cs
- TraceData.cs
- Rectangle.cs
- RawStylusInputCustomData.cs
- Propagator.JoinPropagator.cs
- AggregateNode.cs
- DataTableMappingCollection.cs
- EventTrigger.cs
- ProcessProtocolHandler.cs
- XmlTextAttribute.cs