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
- TreeViewBindingsEditorForm.cs
- TypeHelpers.cs
- MsmqOutputSessionChannel.cs
- SecurityUtils.cs
- SqlException.cs
- KeyInstance.cs
- DataTemplateSelector.cs
- AffineTransform3D.cs
- _NTAuthentication.cs
- TextFormatter.cs
- TextElementCollectionHelper.cs
- Grid.cs
- CodeGroup.cs
- SHA1Managed.cs
- XmlText.cs
- PropertyExpression.cs
- WSSecurityPolicy.cs
- FastEncoderWindow.cs
- DeviceContexts.cs
- TextWriter.cs
- TemplateEditingVerb.cs
- ParameterModifier.cs
- DataRelation.cs
- RealizationContext.cs
- BitmapPalettes.cs
- PagePropertiesChangingEventArgs.cs
- GridToolTip.cs
- ExceptionValidationRule.cs
- ShadowGlyph.cs
- RedBlackList.cs
- SecurityValidationBehavior.cs
- DesignerRegionMouseEventArgs.cs
- RegexWorker.cs
- Group.cs
- DataGridViewToolTip.cs
- TaskForm.cs
- FixUp.cs
- ValueProviderWrapper.cs
- ProgressBarAutomationPeer.cs
- LinqDataView.cs
- BuiltInExpr.cs
- RenderOptions.cs
- SqlDataSourceQueryEditor.cs
- SamlAssertion.cs
- BrushConverter.cs
- SelectorItemAutomationPeer.cs
- EntityDataSourceColumn.cs
- base64Transforms.cs
- WebSysDefaultValueAttribute.cs
- SessionEndingCancelEventArgs.cs
- ListView.cs
- CodeNamespace.cs
- OdbcParameter.cs
- CommandID.cs
- LoginName.cs
- CapacityStreamGeometryContext.cs
- Comparer.cs
- RawStylusSystemGestureInputReport.cs
- HostingEnvironmentSection.cs
- ProviderCommandInfoUtils.cs
- OrderByQueryOptionExpression.cs
- SchemaCompiler.cs
- PortCache.cs
- GroupStyle.cs
- BatchServiceHost.cs
- ObjectQueryProvider.cs
- EnumValAlphaComparer.cs
- Tuple.cs
- DispatchWrapper.cs
- Compilation.cs
- TransformCryptoHandle.cs
- SystemFonts.cs
- NegationPusher.cs
- ConfigurationManagerHelperFactory.cs
- DesignerGenericWebPart.cs
- NameTable.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- ConfigXmlWhitespace.cs
- Delegate.cs
- CacheMode.cs
- SapiRecoInterop.cs
- OperandQuery.cs
- Transform3DGroup.cs
- TextRangeBase.cs
- Calendar.cs
- HtmlTableCellCollection.cs
- MaxSessionCountExceededException.cs
- CfgParser.cs
- DataConnectionHelper.cs
- PackageRelationshipCollection.cs
- SecurityProtocolCorrelationState.cs
- EditorPartChrome.cs
- InstrumentationTracker.cs
- MaskedTextBoxDesigner.cs
- Wildcard.cs
- ButtonColumn.cs
- ScrollItemPattern.cs
- Accessible.cs
- Figure.cs
- GB18030Encoding.cs