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
- HttpConfigurationSystem.cs
- ViewEvent.cs
- DataGridViewEditingControlShowingEventArgs.cs
- RowSpanVector.cs
- WindowsHyperlink.cs
- XmlQueryRuntime.cs
- ReflectionServiceProvider.cs
- Buffer.cs
- LocationUpdates.cs
- SmiSettersStream.cs
- RequestDescription.cs
- LocatorPartList.cs
- FlowchartSizeFeature.cs
- ContentPresenter.cs
- CompoundFileReference.cs
- METAHEADER.cs
- AsyncPostBackErrorEventArgs.cs
- InputMethodStateChangeEventArgs.cs
- _ListenerResponseStream.cs
- BitmapEffectDrawingContextWalker.cs
- Opcode.cs
- WebResponse.cs
- ButtonColumn.cs
- PropertyEmitter.cs
- UInt16.cs
- EdmItemError.cs
- WindowExtensionMethods.cs
- Certificate.cs
- ObjectQueryState.cs
- ContextMenuStripGroup.cs
- TextFormatterHost.cs
- SqlTypesSchemaImporter.cs
- AssertSection.cs
- Image.cs
- HierarchicalDataSourceControl.cs
- AnchorEditor.cs
- DocumentApplicationJournalEntry.cs
- CollectionView.cs
- SqlAggregateChecker.cs
- Triplet.cs
- WebPartConnectionsCloseVerb.cs
- ObjectFullSpanRewriter.cs
- ActivityCollectionMarkupSerializer.cs
- DataView.cs
- TextDecorations.cs
- HoistedLocals.cs
- ExceptionUtil.cs
- ADMembershipProvider.cs
- MultiPropertyDescriptorGridEntry.cs
- SafeProcessHandle.cs
- OleDbRowUpdatingEvent.cs
- ToggleButton.cs
- GlobalItem.cs
- SafeCryptContextHandle.cs
- CroppedBitmap.cs
- Vector3dCollection.cs
- HandleCollector.cs
- ObjectSet.cs
- SqlCommandSet.cs
- HtmlValidatorAdapter.cs
- ParamArrayAttribute.cs
- LoginView.cs
- ToolTip.cs
- Win32MouseDevice.cs
- StrokeFIndices.cs
- WebZone.cs
- ExtensionFile.cs
- Attributes.cs
- TreeViewTemplateSelector.cs
- AdornerHitTestResult.cs
- BasicExpandProvider.cs
- DetailsViewDeleteEventArgs.cs
- HttpCapabilitiesEvaluator.cs
- ResourcesBuildProvider.cs
- ToolStripRenderEventArgs.cs
- EventLogTraceListener.cs
- Journaling.cs
- ToolStripDropDownItem.cs
- controlskin.cs
- XsltInput.cs
- StringReader.cs
- BitmapSource.cs
- AutoResetEvent.cs
- PrintPreviewControl.cs
- ListViewUpdateEventArgs.cs
- Image.cs
- Clock.cs
- FormViewUpdateEventArgs.cs
- AnnotationObservableCollection.cs
- RadioButtonAutomationPeer.cs
- PageCache.cs
- ComponentDispatcherThread.cs
- AttributeProviderAttribute.cs
- VisualBrush.cs
- SHA256Managed.cs
- SessionSwitchEventArgs.cs
- Base64WriteStateInfo.cs
- ProviderCollection.cs
- TableCellAutomationPeer.cs
- ping.cs