Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EventLogSession.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- PaintEvent.cs
- OneWayElement.cs
- SafeProcessHandle.cs
- PageBreakRecord.cs
- HttpCacheParams.cs
- TreeViewCancelEvent.cs
- EmptyReadOnlyDictionaryInternal.cs
- ToggleButtonAutomationPeer.cs
- BuiltInExpr.cs
- _TimerThread.cs
- Style.cs
- BitHelper.cs
- HandledMouseEvent.cs
- UserPersonalizationStateInfo.cs
- SynchronizedInputPattern.cs
- BooleanConverter.cs
- peersecuritysettings.cs
- XmlSecureResolver.cs
- PropertyGroupDescription.cs
- ConstraintCollection.cs
- XslUrlEditor.cs
- Canonicalizers.cs
- TableColumn.cs
- MarginCollapsingState.cs
- Rect3DConverter.cs
- CryptographicAttribute.cs
- DocumentViewer.cs
- ResourceReader.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- precedingquery.cs
- CleanUpVirtualizedItemEventArgs.cs
- DBSqlParserColumn.cs
- XmlNodeComparer.cs
- XmlWrappingReader.cs
- DiagnosticTrace.cs
- ContractDescription.cs
- TileBrush.cs
- Int32Rect.cs
- IdlingCommunicationPool.cs
- MultitargetingHelpers.cs
- BufferedGraphicsContext.cs
- SoapReflectionImporter.cs
- SqlCacheDependencySection.cs
- XpsSerializationManagerAsync.cs
- __ComObject.cs
- FacetValues.cs
- PageCodeDomTreeGenerator.cs
- ProcessRequestArgs.cs
- ReliableChannelListener.cs
- Content.cs
- AdornerDecorator.cs
- FixUp.cs
- HtmlInputButton.cs
- HorizontalAlignConverter.cs
- HtmlInputCheckBox.cs
- ResXResourceSet.cs
- IgnoreFlushAndCloseStream.cs
- IdentityManager.cs
- TrackingMemoryStreamFactory.cs
- XmlObjectSerializerReadContextComplex.cs
- RSAOAEPKeyExchangeFormatter.cs
- InputLangChangeEvent.cs
- CookieParameter.cs
- TraceListener.cs
- X509CertificateCollection.cs
- PropertyChange.cs
- TreeView.cs
- FormViewRow.cs
- PeerToPeerException.cs
- HitTestParameters3D.cs
- NameService.cs
- FreezableOperations.cs
- FileLoadException.cs
- CustomErrorCollection.cs
- FilterRepeater.cs
- CompareInfo.cs
- SafeRegistryHandle.cs
- TextParagraphCache.cs
- DispatcherObject.cs
- CharacterMetrics.cs
- AccessedThroughPropertyAttribute.cs
- DocumentReference.cs
- TagNameToTypeMapper.cs
- ResolveCriteria.cs
- FormClosingEvent.cs
- DataSetMappper.cs
- CategoryAttribute.cs
- GroupBox.cs
- SemaphoreSecurity.cs
- SizeLimitedCache.cs
- KnownTypesHelper.cs
- SocketException.cs
- PointConverter.cs
- DataGridTable.cs
- UnsafeCollabNativeMethods.cs
- MultiTargetingUtil.cs
- Selection.cs
- Image.cs