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
- EntityDataSource.cs
- X509Certificate.cs
- CryptoStream.cs
- CalendarDayButton.cs
- RemoteCryptoRsaServiceProvider.cs
- RolePrincipal.cs
- IncrementalHitTester.cs
- IdentityHolder.cs
- XmlEntity.cs
- LambdaCompiler.Generated.cs
- DesignerDeviceConfig.cs
- X509Utils.cs
- UniqueIdentifierService.cs
- CngKey.cs
- Rotation3DAnimationBase.cs
- CodeAttributeArgumentCollection.cs
- Parser.cs
- AdapterDictionary.cs
- UnaryNode.cs
- HttpListenerRequest.cs
- Typeface.cs
- XmlSchemaDatatype.cs
- XhtmlBasicValidationSummaryAdapter.cs
- PropertySourceInfo.cs
- ActivityUtilities.cs
- ValueExpressions.cs
- ValidatingCollection.cs
- FixedSchema.cs
- ProcessModuleCollection.cs
- TemplateBamlTreeBuilder.cs
- MD5CryptoServiceProvider.cs
- ControlIdConverter.cs
- EventArgs.cs
- HttpCachePolicy.cs
- DecimalAnimationBase.cs
- DecoderExceptionFallback.cs
- XmlWrappingReader.cs
- PeerTransportListenAddressValidator.cs
- CodeMemberEvent.cs
- CellTreeNode.cs
- ContentType.cs
- MsmqProcessProtocolHandler.cs
- ImageList.cs
- Animatable.cs
- SoapHeaders.cs
- X509Certificate2.cs
- XMLUtil.cs
- MediaPlayerState.cs
- ContractMapping.cs
- ExceptionUtil.cs
- shaper.cs
- WebPartTransformer.cs
- ChangeToolStripParentVerb.cs
- ItemChangedEventArgs.cs
- WeakHashtable.cs
- BindingNavigator.cs
- WhitespaceRuleLookup.cs
- DesignerUtility.cs
- NumberAction.cs
- CheckBoxAutomationPeer.cs
- EncoderReplacementFallback.cs
- AutoResetEvent.cs
- Rect.cs
- ReadOnlyMetadataCollection.cs
- HtmlAnchor.cs
- TimeoutValidationAttribute.cs
- SimpleWorkerRequest.cs
- DockProviderWrapper.cs
- MergeFilterQuery.cs
- ConfigurationSectionGroup.cs
- DataGridTextBoxColumn.cs
- HostingEnvironmentWrapper.cs
- Point3DCollection.cs
- HTTPNotFoundHandler.cs
- PartialList.cs
- DbCommandDefinition.cs
- KeyValueConfigurationCollection.cs
- Object.cs
- FocusWithinProperty.cs
- jithelpers.cs
- HttpCachePolicyBase.cs
- WinEventQueueItem.cs
- SqlDataRecord.cs
- PreviewPrintController.cs
- SecurityUtils.cs
- CDSCollectionETWBCLProvider.cs
- ImageAttributes.cs
- TakeQueryOptionExpression.cs
- BinaryReader.cs
- HttpContextServiceHost.cs
- Closure.cs
- Effect.cs
- EditingScopeUndoUnit.cs
- ResourceExpressionEditor.cs
- securitymgrsite.cs
- StateDesignerConnector.cs
- ListViewContainer.cs
- _PooledStream.cs
- DataGridViewMethods.cs
- FileRecordSequenceCompletedAsyncResult.cs