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
- PagesChangedEventArgs.cs
- FixedTextView.cs
- StorageTypeMapping.cs
- UnsignedPublishLicense.cs
- ReferenceConverter.cs
- ToolStripItem.cs
- CustomDictionarySources.cs
- FormattedTextSymbols.cs
- SspiSecurityToken.cs
- SHA256Managed.cs
- Encoder.cs
- Column.cs
- TrackingProfileCache.cs
- AutoSizeToolBoxItem.cs
- DomainConstraint.cs
- StylusButtonEventArgs.cs
- AdapterUtil.cs
- InternalControlCollection.cs
- MobileUserControl.cs
- ControlBuilder.cs
- XamlToRtfWriter.cs
- TextElementEditingBehaviorAttribute.cs
- TypedRowGenerator.cs
- OleDbFactory.cs
- CompilerGlobalScopeAttribute.cs
- MetadataPropertyAttribute.cs
- Site.cs
- ObsoleteAttribute.cs
- RuntimeEnvironment.cs
- SliderAutomationPeer.cs
- MsmqEncryptionAlgorithm.cs
- ExeConfigurationFileMap.cs
- CodeConditionStatement.cs
- XmlHierarchicalDataSourceView.cs
- storepermissionattribute.cs
- CodeTypeReferenceCollection.cs
- WebPartActionVerb.cs
- SQLDateTime.cs
- ListItemParagraph.cs
- PathSegmentCollection.cs
- UnsafeNativeMethodsPenimc.cs
- Rfc2898DeriveBytes.cs
- XmlnsCompatibleWithAttribute.cs
- FrameworkElement.cs
- AuthenticationConfig.cs
- Point3DConverter.cs
- FaultCallbackWrapper.cs
- StructureChangedEventArgs.cs
- SqlClientMetaDataCollectionNames.cs
- PlatformNotSupportedException.cs
- PolyBezierSegment.cs
- webproxy.cs
- EnumUnknown.cs
- SqlStatistics.cs
- SessionStateUtil.cs
- XmlComment.cs
- ObjectNotFoundException.cs
- COM2ExtendedUITypeEditor.cs
- ReachDocumentReferenceCollectionSerializerAsync.cs
- Root.cs
- FormsAuthenticationModule.cs
- Shape.cs
- TimeSpanStorage.cs
- UriSectionReader.cs
- BrowserCapabilitiesFactory.cs
- securitymgrsite.cs
- DynamicUpdateCommand.cs
- KeyInterop.cs
- ScrollViewerAutomationPeer.cs
- ToolBarButtonClickEvent.cs
- WSSecurityOneDotZeroSendSecurityHeader.cs
- FrameworkTemplate.cs
- ExpandCollapsePattern.cs
- Currency.cs
- WebResponse.cs
- DefaultProxySection.cs
- WindowsContainer.cs
- TextChangedEventArgs.cs
- LayoutEvent.cs
- UnmanagedMemoryStream.cs
- _UncName.cs
- ParameterCollection.cs
- SchemaElementDecl.cs
- StreamInfo.cs
- SessionStateContainer.cs
- PerspectiveCamera.cs
- RelOps.cs
- WebEventCodes.cs
- DataGridColumnHeaderCollection.cs
- LinqDataSource.cs
- ChangeBlockUndoRecord.cs
- SystemDiagnosticsSection.cs
- WebException.cs
- SafeCertificateContext.cs
- MustUnderstandSoapException.cs
- ListViewInsertionMark.cs
- CompoundFileDeflateTransform.cs
- RectAnimationBase.cs
- Win32SafeHandles.cs
- ServerValidateEventArgs.cs