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
- MgmtConfigurationRecord.cs
- PeerName.cs
- SettingsContext.cs
- IndexedEnumerable.cs
- PagerStyle.cs
- OrderedDictionary.cs
- LineUtil.cs
- WindowProviderWrapper.cs
- DoubleConverter.cs
- RecognizerInfo.cs
- DefaultPrintController.cs
- RootBrowserWindowProxy.cs
- DispatcherExceptionFilterEventArgs.cs
- ObjectItemAssemblyLoader.cs
- EventHandlerList.cs
- Axis.cs
- ListSortDescriptionCollection.cs
- Environment.cs
- InternalCache.cs
- TrackBar.cs
- ImageSourceConverter.cs
- WebPart.cs
- RowTypeElement.cs
- ServicesExceptionNotHandledEventArgs.cs
- WebPartDeleteVerb.cs
- IntSecurity.cs
- ZipIOLocalFileDataDescriptor.cs
- Vector.cs
- SQLInt16.cs
- MemberHolder.cs
- DbInsertCommandTree.cs
- ElementHostPropertyMap.cs
- CollectionMarkupSerializer.cs
- ExtensionFile.cs
- InvokeWebServiceDesigner.cs
- Char.cs
- MethodCallConverter.cs
- InfiniteIntConverter.cs
- HotSpot.cs
- CommandEventArgs.cs
- WebBrowserNavigatingEventHandler.cs
- GridViewUpdatedEventArgs.cs
- SqlCaseSimplifier.cs
- smtppermission.cs
- ApplicationDirectory.cs
- VScrollBar.cs
- HandleTable.cs
- EventDescriptor.cs
- IOException.cs
- TemplateEditingService.cs
- ReadOnlyNameValueCollection.cs
- ClientProxyGenerator.cs
- ArgumentsParser.cs
- TemplatePagerField.cs
- PassportAuthenticationModule.cs
- DataRow.cs
- WorkflowApplicationUnloadedException.cs
- UnmanagedMemoryStream.cs
- CopyNamespacesAction.cs
- Calendar.cs
- UniqueEventHelper.cs
- Model3D.cs
- SymLanguageType.cs
- NameValuePermission.cs
- SolidBrush.cs
- Error.cs
- XmlWellformedWriter.cs
- ListControl.cs
- XomlCompiler.cs
- ProcessModuleDesigner.cs
- X509ChainElement.cs
- UrlAuthorizationModule.cs
- BinaryMethodMessage.cs
- ScriptReferenceBase.cs
- RowUpdatingEventArgs.cs
- RotationValidation.cs
- ListViewTableRow.cs
- UIElementIsland.cs
- WindowsGrip.cs
- BinaryReader.cs
- SourceFileBuildProvider.cs
- CodeAccessSecurityEngine.cs
- LookupNode.cs
- ObjectDataSource.cs
- ObjectAssociationEndMapping.cs
- OutputCacheSection.cs
- GridItemPattern.cs
- XmlDataImplementation.cs
- ManagementObject.cs
- Visitor.cs
- TypeConstant.cs
- cache.cs
- DependencyPropertyChangedEventArgs.cs
- DataSourceSelectArguments.cs
- DataBoundControlHelper.cs
- TextSearch.cs
- DataServiceEntityAttribute.cs
- EncoderNLS.cs
- Vector3DAnimation.cs
- SystemIcmpV4Statistics.cs