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
- MD5CryptoServiceProvider.cs
- PersistenceException.cs
- PrivilegedConfigurationManager.cs
- ConnectionStringEditor.cs
- MessageQueueInstaller.cs
- recordstate.cs
- VarInfo.cs
- SystemIcons.cs
- SystemResourceKey.cs
- NotConverter.cs
- DecimalAnimationBase.cs
- XmlRootAttribute.cs
- DataGridViewElement.cs
- MessagingDescriptionAttribute.cs
- CodeActivityContext.cs
- FormViewInsertEventArgs.cs
- InputLanguageSource.cs
- NativeCompoundFileAPIs.cs
- TextSpanModifier.cs
- HttpListenerException.cs
- ImageInfo.cs
- FontUnit.cs
- DetailsViewDeleteEventArgs.cs
- GridLengthConverter.cs
- ParameterToken.cs
- ConfigXmlElement.cs
- HandledEventArgs.cs
- CatalogZone.cs
- ResourceManager.cs
- SystemColorTracker.cs
- ViewLoader.cs
- XmlSigningNodeWriter.cs
- Menu.cs
- HttpResponse.cs
- HierarchicalDataSourceControl.cs
- SafeNativeMethods.cs
- HandlerBase.cs
- TextViewSelectionProcessor.cs
- HtmlWindowCollection.cs
- DecimalSumAggregationOperator.cs
- DocumentPage.cs
- X509ThumbprintKeyIdentifierClause.cs
- TextWriter.cs
- SingleAnimation.cs
- DefaultDiscoveryServiceExtension.cs
- FlagsAttribute.cs
- DynamicDocumentPaginator.cs
- Floater.cs
- DataGridViewCheckBoxColumn.cs
- Int32Animation.cs
- Int64KeyFrameCollection.cs
- TailCallAnalyzer.cs
- StandardToolWindows.cs
- SafeSecurityHelper.cs
- FormsAuthenticationEventArgs.cs
- Model3DCollection.cs
- WorkflowApplicationUnloadedException.cs
- SerialPort.cs
- ProcessInputEventArgs.cs
- InvalidOperationException.cs
- PolicyLevel.cs
- ExternalException.cs
- CompositeKey.cs
- OperationResponse.cs
- SqlErrorCollection.cs
- StorageBasedPackageProperties.cs
- EditorBrowsableAttribute.cs
- FormsAuthenticationEventArgs.cs
- WebBrowser.cs
- ElementInit.cs
- MappingItemCollection.cs
- SourceFilter.cs
- ResolveCriteria.cs
- MimePart.cs
- SynchronizationContext.cs
- ValidationError.cs
- BridgeDataRecord.cs
- MenuItemStyle.cs
- DeclarativeCatalogPart.cs
- PopupControlService.cs
- GestureRecognizer.cs
- KeyboardDevice.cs
- ScriptManagerProxy.cs
- Messages.cs
- ProfileModule.cs
- Expander.cs
- MemberInfoSerializationHolder.cs
- InputProviderSite.cs
- WebResourceAttribute.cs
- AssemblyNameEqualityComparer.cs
- XsltOutput.cs
- GrabHandleGlyph.cs
- RSAProtectedConfigurationProvider.cs
- ObjectPersistData.cs
- ListViewInsertedEventArgs.cs
- StyleSheetRefUrlEditor.cs
- ImageSourceValueSerializer.cs
- StringStorage.cs
- CompoundFileDeflateTransform.cs
- userdatakeys.cs