Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Xml / System / Xml / XPath / Internal / VariableQuery.cs / 1 / VariableQuery.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace MS.Internal.Xml.XPath { using System; using System.Xml; using System.Xml.XPath; using System.Diagnostics; using System.Globalization; using System.Xml.Xsl; internal sealed class VariableQuery : ExtensionQuery { private IXsltContextVariable variable; public VariableQuery(string name, string prefix) : base(prefix, name) {} private VariableQuery(VariableQuery other) : base(other) { this.variable = other.variable; } public override void SetXsltContext(XsltContext context) { if (context == null) { throw XPathException.Create(Res.Xp_NoContext); } if (this.xsltContext != context) { xsltContext = context; variable = xsltContext.ResolveVariable(prefix, name); // Since null is allowed for ResolveFunction, allow it for ResolveVariable as well if (variable == null) { throw XPathException.Create(Res.Xp_UndefVar, QName); } } } public override object Evaluate(XPathNodeIterator nodeIterator) { if (xsltContext == null) { throw XPathException.Create(Res.Xp_NoContext); } return ProcessResult(variable.Evaluate(xsltContext)); } public override XPathResultType StaticType { get { if (variable != null) { // Temp. fix to overcome dependency on static type return GetXPathType(Evaluate(null)); } XPathResultType result = variable != null ? variable.VariableType : XPathResultType.Any; if (result == XPathResultType.Error) { // In v.1 we confused Error & Any so now for backward compatibility we should allow users to return any of them. result = XPathResultType.Any; } return result; } } public override XPathNodeIterator Clone() { return new VariableQuery(this); } public override void PrintQuery(XmlWriter w) { w.WriteStartElement(this.GetType().Name); w.WriteAttributeString("name", prefix.Length != 0 ? prefix + ':' + name : name); w.WriteEndElement(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace MS.Internal.Xml.XPath { using System; using System.Xml; using System.Xml.XPath; using System.Diagnostics; using System.Globalization; using System.Xml.Xsl; internal sealed class VariableQuery : ExtensionQuery { private IXsltContextVariable variable; public VariableQuery(string name, string prefix) : base(prefix, name) {} private VariableQuery(VariableQuery other) : base(other) { this.variable = other.variable; } public override void SetXsltContext(XsltContext context) { if (context == null) { throw XPathException.Create(Res.Xp_NoContext); } if (this.xsltContext != context) { xsltContext = context; variable = xsltContext.ResolveVariable(prefix, name); // Since null is allowed for ResolveFunction, allow it for ResolveVariable as well if (variable == null) { throw XPathException.Create(Res.Xp_UndefVar, QName); } } } public override object Evaluate(XPathNodeIterator nodeIterator) { if (xsltContext == null) { throw XPathException.Create(Res.Xp_NoContext); } return ProcessResult(variable.Evaluate(xsltContext)); } public override XPathResultType StaticType { get { if (variable != null) { // Temp. fix to overcome dependency on static type return GetXPathType(Evaluate(null)); } XPathResultType result = variable != null ? variable.VariableType : XPathResultType.Any; if (result == XPathResultType.Error) { // In v.1 we confused Error & Any so now for backward compatibility we should allow users to return any of them. result = XPathResultType.Any; } return result; } } public override XPathNodeIterator Clone() { return new VariableQuery(this); } public override void PrintQuery(XmlWriter w) { w.WriteStartElement(this.GetType().Name); w.WriteAttributeString("name", prefix.Length != 0 ? prefix + ':' + name : name); w.WriteEndElement(); } } } // 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
- Rotation3DAnimation.cs
- CachedPathData.cs
- MsmqBindingElementBase.cs
- SiteMapDataSourceView.cs
- SqlDependencyUtils.cs
- PublisherMembershipCondition.cs
- DispatcherHookEventArgs.cs
- FixedSOMSemanticBox.cs
- EncryptedData.cs
- QueryOutputWriterV1.cs
- PaintEvent.cs
- RegexRunnerFactory.cs
- PageParserFilter.cs
- Interlocked.cs
- AuthenticationService.cs
- BlurEffect.cs
- CodeTypeParameterCollection.cs
- FontEmbeddingManager.cs
- ObjectContextServiceProvider.cs
- CodeMethodReturnStatement.cs
- ActivityDesigner.cs
- SqlProviderManifest.cs
- NamespaceList.cs
- LocalizeDesigner.cs
- HebrewCalendar.cs
- CookieProtection.cs
- UrlAuthorizationModule.cs
- UserControl.cs
- WorkItem.cs
- TreeNodeBinding.cs
- TimeoutValidationAttribute.cs
- Matrix3D.cs
- ConversionContext.cs
- ToolStripMenuItem.cs
- AssociationSetMetadata.cs
- Table.cs
- WhereQueryOperator.cs
- SaveRecipientRequest.cs
- FilterEventArgs.cs
- ChtmlTextBoxAdapter.cs
- CodeAttributeDeclaration.cs
- WebEvents.cs
- AmbientLight.cs
- Codec.cs
- WebResourceAttribute.cs
- AuthenticationSection.cs
- Bezier.cs
- _IPv4Address.cs
- UseAttributeSetsAction.cs
- FrameworkContentElementAutomationPeer.cs
- ModelVisual3D.cs
- Input.cs
- Operand.cs
- NullToBooleanConverter.cs
- SemanticAnalyzer.cs
- WebPartCatalogAddVerb.cs
- ObjectStateEntryDbDataRecord.cs
- FileDialogCustomPlace.cs
- METAHEADER.cs
- LinqDataSourceDisposeEventArgs.cs
- HtmlShimManager.cs
- ByteKeyFrameCollection.cs
- FixedSOMPage.cs
- CodeTypeParameterCollection.cs
- WSFederationHttpBindingElement.cs
- SecurityDescriptor.cs
- DetailsViewInsertEventArgs.cs
- ResourceWriter.cs
- NumericUpDown.cs
- SerialPinChanges.cs
- ProvidePropertyAttribute.cs
- AsymmetricSignatureDeformatter.cs
- MasterPageBuildProvider.cs
- EnumCodeDomSerializer.cs
- PopOutPanel.cs
- CodeFieldReferenceExpression.cs
- Canvas.cs
- RowBinding.cs
- HttpVersion.cs
- IdentifierService.cs
- TreeViewAutomationPeer.cs
- NamespaceListProperty.cs
- DocumentPageView.cs
- WebScriptServiceHost.cs
- IdentityNotMappedException.cs
- XPathParser.cs
- ResponseStream.cs
- WebPartExportVerb.cs
- JoinSymbol.cs
- ContentOperations.cs
- CryptoApi.cs
- OptimalTextSource.cs
- CurrencyWrapper.cs
- TimelineGroup.cs
- StickyNote.cs
- DataExpression.cs
- SelectingProviderEventArgs.cs
- NetworkCredential.cs
- InvalidCommandTreeException.cs
- SignatureHelper.cs