Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / ChooseAction.cs / 1305376 / 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 (Ref.Equal(nspace, input.Atoms.UriXsl)) {
IfAction action = null;
if (Ref.Equal(name, input.Atoms.When)) {
if (otherwise) {
throw XsltException.Create(Res.Xslt_WhenAfterOtherwise);
}
action = compiler.CreateIfAction(IfAction.ConditionType.ConditionWhen);
when = true;
}
else if (Ref.Equal(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, "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 (Ref.Equal(nspace, input.Atoms.UriXsl)) {
IfAction action = null;
if (Ref.Equal(name, input.Atoms.When)) {
if (otherwise) {
throw XsltException.Create(Res.Xslt_WhenAfterOtherwise);
}
action = compiler.CreateIfAction(IfAction.ConditionType.ConditionWhen);
when = true;
}
else if (Ref.Equal(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, "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
- TraceEventCache.cs
- ColumnCollection.cs
- JsonReaderDelegator.cs
- SamlAction.cs
- ServiceHostFactory.cs
- SimpleWorkerRequest.cs
- RepeatBehavior.cs
- TagPrefixCollection.cs
- MessageEncoderFactory.cs
- VoiceObjectToken.cs
- CorruptingExceptionCommon.cs
- FlowDocumentPageViewerAutomationPeer.cs
- TablePattern.cs
- SessionStateUtil.cs
- RegexInterpreter.cs
- Cursor.cs
- URLString.cs
- DataControlReferenceCollection.cs
- SkewTransform.cs
- GlobalizationSection.cs
- CodeDOMUtility.cs
- BindValidationContext.cs
- ClientTargetSection.cs
- HotCommands.cs
- ProjectedSlot.cs
- XmlRootAttribute.cs
- TraceLog.cs
- SqlTrackingWorkflowInstance.cs
- HandledMouseEvent.cs
- ClientScriptManager.cs
- Vector3DAnimationBase.cs
- LabelEditEvent.cs
- StreamingContext.cs
- InternalBufferOverflowException.cs
- ArcSegment.cs
- TemplateBindingExpression.cs
- GridViewColumnCollection.cs
- WindowsListViewSubItem.cs
- DynamicDocumentPaginator.cs
- QilTernary.cs
- NotCondition.cs
- PrimarySelectionGlyph.cs
- Double.cs
- MDIControlStrip.cs
- NoResizeSelectionBorderGlyph.cs
- LinearGradientBrush.cs
- QilUnary.cs
- DataSourceSelectArguments.cs
- AccessibleObject.cs
- TitleStyle.cs
- SpotLight.cs
- CheckBoxField.cs
- DocumentSequence.cs
- OdbcEnvironmentHandle.cs
- DetailsViewDeleteEventArgs.cs
- BevelBitmapEffect.cs
- Switch.cs
- Dump.cs
- XpsFont.cs
- DataGridBeginningEditEventArgs.cs
- Source.cs
- RadioButtonDesigner.cs
- ResetableIterator.cs
- XamlSerializerUtil.cs
- RequestSecurityToken.cs
- ApplicationServiceHelper.cs
- LingerOption.cs
- RepeatBehaviorConverter.cs
- RowUpdatingEventArgs.cs
- MatrixUtil.cs
- JoinCqlBlock.cs
- ExitEventArgs.cs
- BrowserCapabilitiesFactory.cs
- CatalogPartCollection.cs
- AssemblyLoader.cs
- StoreAnnotationsMap.cs
- BitmapEffectOutputConnector.cs
- EntityDataSourceWizardForm.cs
- DataRowCollection.cs
- DiscardableAttribute.cs
- MiniCustomAttributeInfo.cs
- Geometry.cs
- DataTableTypeConverter.cs
- MergePropertyDescriptor.cs
- MenuItemStyleCollection.cs
- SchemaImporterExtension.cs
- RangeContentEnumerator.cs
- XPathNodeHelper.cs
- ScriptControlManager.cs
- XmlSchemaImporter.cs
- TableCellAutomationPeer.cs
- CodeTypeReferenceExpression.cs
- DefaultSection.cs
- PersonalizationEntry.cs
- MediaContext.cs
- UriSection.cs
- CompositionAdorner.cs
- Byte.cs
- GPPOINT.cs
- OdbcStatementHandle.cs