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
- CharEntityEncoderFallback.cs
- ActiveXHost.cs
- PeerFlooder.cs
- LinqDataSourceInsertEventArgs.cs
- RequiredFieldValidator.cs
- CompositeFontInfo.cs
- COM2Enum.cs
- SchemaImporterExtension.cs
- SafeFreeMibTable.cs
- HttpHandlerAction.cs
- DivideByZeroException.cs
- AuthenticatedStream.cs
- CancellableEnumerable.cs
- BuildProvidersCompiler.cs
- Literal.cs
- TypeDescriptor.cs
- SafeBitVector32.cs
- Property.cs
- Msec.cs
- Delegate.cs
- Serializer.cs
- EraserBehavior.cs
- SchemaImporterExtensionElementCollection.cs
- XmlSchemaObjectCollection.cs
- CharEnumerator.cs
- PropertyRef.cs
- BindableTemplateBuilder.cs
- WebHttpDispatchOperationSelectorData.cs
- SchemaMapping.cs
- CodeCastExpression.cs
- ArithmeticException.cs
- XmlSerializationWriter.cs
- CodeLabeledStatement.cs
- HttpApplication.cs
- BulletedListEventArgs.cs
- SecUtil.cs
- WebServiceErrorEvent.cs
- SharedPersonalizationStateInfo.cs
- EnumUnknown.cs
- StrokeDescriptor.cs
- MenuItem.cs
- WebRequestModuleElementCollection.cs
- MailMessageEventArgs.cs
- QilName.cs
- RawTextInputReport.cs
- SystemIPInterfaceProperties.cs
- FormViewRow.cs
- Ops.cs
- XmlBindingWorker.cs
- TextLineBreak.cs
- CollectionChange.cs
- SecurityRuntime.cs
- ObjRef.cs
- ActivityXRefConverter.cs
- TextEditorThreadLocalStore.cs
- TextParaClient.cs
- HTMLTagNameToTypeMapper.cs
- SqlInternalConnectionSmi.cs
- QilChoice.cs
- InputMethodStateChangeEventArgs.cs
- GifBitmapEncoder.cs
- DispatchWrapper.cs
- ConnectionPointCookie.cs
- DataComponentMethodGenerator.cs
- GenericTypeParameterBuilder.cs
- XhtmlConformanceSection.cs
- WorkflowViewManager.cs
- counter.cs
- SizeKeyFrameCollection.cs
- DeclarationUpdate.cs
- ObjRef.cs
- TreeView.cs
- RenderData.cs
- TransformGroup.cs
- PaginationProgressEventArgs.cs
- CodeTypeReferenceCollection.cs
- AssignDesigner.xaml.cs
- HwndProxyElementProvider.cs
- InstallerTypeAttribute.cs
- IPAddressCollection.cs
- ApplicationProxyInternal.cs
- RangeValidator.cs
- CroppedBitmap.cs
- SaveFileDialogDesigner.cs
- Point4D.cs
- CrossAppDomainChannel.cs
- DataContractSet.cs
- WriteableBitmap.cs
- Popup.cs
- COM2ComponentEditor.cs
- SchemaMapping.cs
- LabelDesigner.cs
- BufferedStream.cs
- TextDecoration.cs
- XmlSchemaAppInfo.cs
- FreezableCollection.cs
- Model3DGroup.cs
- XmlAttributeHolder.cs
- nulltextnavigator.cs