Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / Xml / System / Xml / XPath / Internal / VariableQuery.cs / 2 / 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
- ListViewItem.cs
- SmiXetterAccessMap.cs
- ActiveXContainer.cs
- NonVisualControlAttribute.cs
- BamlRecordHelper.cs
- EventArgs.cs
- ToolStripPanelCell.cs
- HttpCapabilitiesBase.cs
- SqlRowUpdatedEvent.cs
- UrlPath.cs
- Italic.cs
- DataSourceViewSchemaConverter.cs
- ADMembershipUser.cs
- ColumnWidthChangingEvent.cs
- InputScope.cs
- Int32RectValueSerializer.cs
- Button.cs
- SystemResourceKey.cs
- ValidationEventArgs.cs
- ColorConvertedBitmap.cs
- ControlCachePolicy.cs
- FormatterConverter.cs
- Connector.xaml.cs
- ElementProxy.cs
- SequenceFullException.cs
- AppDomain.cs
- FileAuthorizationModule.cs
- KoreanLunisolarCalendar.cs
- EntityParameterCollection.cs
- CalendarDay.cs
- RelationshipWrapper.cs
- IndexedString.cs
- TableCellCollection.cs
- SafeViewOfFileHandle.cs
- Mutex.cs
- _CommandStream.cs
- DelegateArgumentReference.cs
- CapacityStreamGeometryContext.cs
- ConfigXmlElement.cs
- ObfuscationAttribute.cs
- CodeSnippetTypeMember.cs
- GridEntry.cs
- PageWrapper.cs
- PkcsUtils.cs
- HttpHandler.cs
- CompiledXpathExpr.cs
- DataSourceBooleanViewSchemaConverter.cs
- DefaultSection.cs
- CryptoApi.cs
- _NTAuthentication.cs
- ParallelTimeline.cs
- ChildTable.cs
- AnnotationResourceCollection.cs
- SettingsPropertyValue.cs
- Drawing.cs
- SQLBytesStorage.cs
- Content.cs
- CngKey.cs
- ChooseAction.cs
- CapabilitiesSection.cs
- HScrollBar.cs
- CorrelationTokenInvalidatedHandler.cs
- WebConfigurationManager.cs
- InheritanceContextChangedEventManager.cs
- CodeCompileUnit.cs
- ColorMap.cs
- QuaternionRotation3D.cs
- FileDialog.cs
- HttpClientCredentialType.cs
- Slider.cs
- BeginEvent.cs
- DataGridViewCheckBoxColumn.cs
- CompilerResults.cs
- ScrollBarAutomationPeer.cs
- Rule.cs
- ReliableOutputSessionChannel.cs
- Exceptions.cs
- PageWrapper.cs
- TrackingStringDictionary.cs
- ACE.cs
- EditCommandColumn.cs
- RuleElement.cs
- NameGenerator.cs
- TextDecorationCollectionConverter.cs
- Pen.cs
- GeneralTransform.cs
- LabelAutomationPeer.cs
- WSSecurityOneDotZeroReceiveSecurityHeader.cs
- SEHException.cs
- DisableDpiAwarenessAttribute.cs
- BamlLocalizabilityResolver.cs
- Latin1Encoding.cs
- Track.cs
- StateMachine.cs
- DiscoveryOperationContextExtension.cs
- MouseActionConverter.cs
- TraceHandlerErrorFormatter.cs
- HitTestWithPointDrawingContextWalker.cs
- AudioBase.cs
- HandlerFactoryCache.cs