Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- UnsafeNativeMethods.cs
- RoutedEventConverter.cs
- ClientData.cs
- ItemCollectionEditor.cs
- SvcMapFileSerializer.cs
- TextTreeText.cs
- dbenumerator.cs
- TextDecorationCollection.cs
- OperatorExpressions.cs
- FilteredDataSetHelper.cs
- AssociatedControlConverter.cs
- SQLByte.cs
- MobileResource.cs
- SmiEventStream.cs
- AttributeQuery.cs
- SelectedDatesCollection.cs
- DataGridCellEditEndingEventArgs.cs
- DataPagerFieldItem.cs
- RoutedEvent.cs
- Image.cs
- PasswordDeriveBytes.cs
- SiblingIterators.cs
- RemoteArgument.cs
- DataGridPageChangedEventArgs.cs
- RawAppCommandInputReport.cs
- SolidColorBrush.cs
- FormViewCommandEventArgs.cs
- DataGridDesigner.cs
- XmlSchemaProviderAttribute.cs
- KeyConstraint.cs
- SpotLight.cs
- MergePropertyDescriptor.cs
- TemplateLookupAction.cs
- HttpGetServerProtocol.cs
- TextureBrush.cs
- RestHandler.cs
- UrlPath.cs
- BamlBinaryWriter.cs
- FormatConvertedBitmap.cs
- RtfToken.cs
- SimpleWorkerRequest.cs
- XmlLinkedNode.cs
- EmissiveMaterial.cs
- PopupRoot.cs
- ClockController.cs
- RecordManager.cs
- ExternalCalls.cs
- TargetFrameworkAttribute.cs
- COMException.cs
- AppSettingsExpressionBuilder.cs
- SrgsText.cs
- DesignerCategoryAttribute.cs
- QilFactory.cs
- FamilyTypeface.cs
- DesignParameter.cs
- SqlRowUpdatingEvent.cs
- TableLayoutCellPaintEventArgs.cs
- ToolboxItem.cs
- HebrewCalendar.cs
- HandlerBase.cs
- UserPreferenceChangedEventArgs.cs
- ColorConvertedBitmap.cs
- IsolatedStorage.cs
- ConnectionsZone.cs
- FixedLineResult.cs
- RoleServiceManager.cs
- EventPrivateKey.cs
- MembershipUser.cs
- ObjectQuery_EntitySqlExtensions.cs
- CollectionChangedEventManager.cs
- ContextQuery.cs
- StateItem.cs
- DebugHandleTracker.cs
- WmlCalendarAdapter.cs
- Command.cs
- DataRow.cs
- DataExpression.cs
- SEHException.cs
- ContentElementAutomationPeer.cs
- WindowsPrincipal.cs
- UserInitiatedNavigationPermission.cs
- NavigationProgressEventArgs.cs
- GPStream.cs
- DesignerActionItem.cs
- SystemColors.cs
- TextServicesCompartmentEventSink.cs
- HtmlSelect.cs
- BooleanSwitch.cs
- ClientUrlResolverWrapper.cs
- BitmapImage.cs
- NotSupportedException.cs
- XPathDocumentBuilder.cs
- SchemaEntity.cs
- CorrelationQuery.cs
- ChangePassword.cs
- OutputCacheProfileCollection.cs
- TextControlDesigner.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- EntityDataSourceWrapperCollection.cs
- SerializationUtilities.cs