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
- CodePropertyReferenceExpression.cs
- DesignerWidgets.cs
- CodeLabeledStatement.cs
- DtcInterfaces.cs
- WebPartDisplayModeEventArgs.cs
- LayoutTableCell.cs
- StructuralObject.cs
- parserscommon.cs
- HintTextConverter.cs
- FormatterServicesNoSerializableCheck.cs
- ClientRuntimeConfig.cs
- DbConnectionOptions.cs
- StylusButtonEventArgs.cs
- Visual3D.cs
- ParserStreamGeometryContext.cs
- XmlDataProvider.cs
- CodeBlockBuilder.cs
- Pair.cs
- ShapeTypeface.cs
- ProjectionPruner.cs
- StylusPlugInCollection.cs
- XmlUtil.cs
- FontStretches.cs
- InstanceKeyCompleteException.cs
- LedgerEntryCollection.cs
- Button.cs
- EntityDataSourceContextCreatingEventArgs.cs
- ApplicationHost.cs
- WebPartPersonalization.cs
- InfoCardMetadataExchangeClient.cs
- BasicBrowserDialog.designer.cs
- AdapterDictionary.cs
- GraphicsState.cs
- ViewDesigner.cs
- TimeBoundedCache.cs
- FontDifferentiator.cs
- TrackBarRenderer.cs
- SinglePageViewer.cs
- WebPartConnectionsDisconnectVerb.cs
- NoneExcludedImageIndexConverter.cs
- DataGridColumnEventArgs.cs
- WebPartAddingEventArgs.cs
- SourceFileBuildProvider.cs
- InternalCache.cs
- BindToObject.cs
- MILUtilities.cs
- ProtocolsSection.cs
- ToolStripDropDownButton.cs
- ExternalException.cs
- AbandonedMutexException.cs
- CopyAttributesAction.cs
- base64Transforms.cs
- CellCreator.cs
- ProgressBarAutomationPeer.cs
- WebPartExportVerb.cs
- OutOfMemoryException.cs
- EvidenceBase.cs
- FixedDocument.cs
- RegexBoyerMoore.cs
- EventWaitHandle.cs
- LabelLiteral.cs
- CodeIterationStatement.cs
- ApplicationServiceManager.cs
- BookmarkResumptionRecord.cs
- PageVisual.cs
- WebScriptServiceHostFactory.cs
- ConfigurationPropertyAttribute.cs
- NetworkAddressChange.cs
- TypeInfo.cs
- DataGridViewCellParsingEventArgs.cs
- DoWorkEventArgs.cs
- WebPartEditorApplyVerb.cs
- MLangCodePageEncoding.cs
- ReflectTypeDescriptionProvider.cs
- OdbcError.cs
- securitycriticaldataClass.cs
- EventRoute.cs
- SqlClientWrapperSmiStream.cs
- PerformanceCountersElement.cs
- ProcessHostServerConfig.cs
- XXXOnTypeBuilderInstantiation.cs
- DirectoryObjectSecurity.cs
- GenericRootAutomationPeer.cs
- PageCodeDomTreeGenerator.cs
- EncoderBestFitFallback.cs
- Compiler.cs
- oledbconnectionstring.cs
- EntitySqlQueryBuilder.cs
- SimpleBitVector32.cs
- Graph.cs
- ResourceProperty.cs
- ManualWorkflowSchedulerService.cs
- ControllableStoryboardAction.cs
- filewebrequest.cs
- ClientUtils.cs
- ToolStripDropDownItem.cs
- GCHandleCookieTable.cs
- OdbcParameter.cs
- VisualBasicReference.cs
- DefaultParameterValueAttribute.cs