Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / VariableQuery.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- odbcmetadatacolumnnames.cs
- TreeNodeStyle.cs
- XmlCodeExporter.cs
- PagerSettings.cs
- StyleModeStack.cs
- ArraySortHelper.cs
- RealProxy.cs
- TreeNodeStyleCollectionEditor.cs
- SkewTransform.cs
- FixedSOMGroup.cs
- DynamicResourceExtension.cs
- SqlClientWrapperSmiStream.cs
- XamlRtfConverter.cs
- BulletDecorator.cs
- FileEnumerator.cs
- SqlBooleanMismatchVisitor.cs
- ProcessRequestArgs.cs
- DesignObjectWrapper.cs
- PostBackTrigger.cs
- embossbitmapeffect.cs
- DiscoveryClientProtocol.cs
- DisplayInformation.cs
- ProfilePropertyMetadata.cs
- TableLayoutPanelResizeGlyph.cs
- SqlDataReaderSmi.cs
- CodeSubDirectoriesCollection.cs
- BinaryFormatterSinks.cs
- XDeferredAxisSource.cs
- TypeSystemHelpers.cs
- Util.cs
- ToolboxItemCollection.cs
- PermissionAttributes.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- SessionStateSection.cs
- TrailingSpaceComparer.cs
- EnumMemberAttribute.cs
- SystemIcmpV4Statistics.cs
- DataGridViewTextBoxCell.cs
- FragmentQueryProcessor.cs
- ISFTagAndGuidCache.cs
- HashHelper.cs
- TTSEvent.cs
- FrameDimension.cs
- SystemNetHelpers.cs
- LinqDataSourceContextEventArgs.cs
- PagePropertiesChangingEventArgs.cs
- ConstraintStruct.cs
- RectangleGeometry.cs
- SmiTypedGetterSetter.cs
- Peer.cs
- DataTemplate.cs
- BitStack.cs
- XmlNamespaceManager.cs
- TableLayoutStyle.cs
- XmlElementAttribute.cs
- WorkflowExecutor.cs
- TypeToken.cs
- ChameleonKey.cs
- TableChangeProcessor.cs
- ScrollBarAutomationPeer.cs
- ComponentManagerBroker.cs
- ChangeNode.cs
- StatusBar.cs
- ItemsChangedEventArgs.cs
- CachedBitmap.cs
- NameObjectCollectionBase.cs
- CacheDependency.cs
- Pointer.cs
- WebPartChrome.cs
- InProcStateClientManager.cs
- RootProfilePropertySettingsCollection.cs
- ImageAutomationPeer.cs
- SqlDataSourceEnumerator.cs
- ListViewItemMouseHoverEvent.cs
- URLString.cs
- DataBinding.cs
- SQLByte.cs
- SpoolingTaskBase.cs
- Facet.cs
- ComplexObject.cs
- PowerStatus.cs
- OracleParameterBinding.cs
- BinHexEncoder.cs
- PageTheme.cs
- DynamicFilterExpression.cs
- DeclarativeCatalogPart.cs
- NetCodeGroup.cs
- ToolZone.cs
- RunWorkerCompletedEventArgs.cs
- EventLogger.cs
- BitVector32.cs
- HttpListenerContext.cs
- AppearanceEditorPart.cs
- CapiNative.cs
- Pkcs7Signer.cs
- ToolStripRendererSwitcher.cs
- WebBrowserDocumentCompletedEventHandler.cs
- UInt64.cs
- ValueTypeFixupInfo.cs
- TableStyle.cs