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
- TransformPattern.cs
- TreeViewItemAutomationPeer.cs
- AsyncCallback.cs
- TemplatePagerField.cs
- FileNameEditor.cs
- TextServicesDisplayAttribute.cs
- WebBrowserNavigatedEventHandler.cs
- ChannelCacheSettings.cs
- RsaKeyGen.cs
- BitmapFrame.cs
- InheritablePropertyChangeInfo.cs
- RadioButtonStandardAdapter.cs
- StorageBasedPackageProperties.cs
- EntityProviderFactory.cs
- ImageMap.cs
- BitmapEffectInput.cs
- TextBlock.cs
- MSAAEventDispatcher.cs
- XmlDataSourceNodeDescriptor.cs
- ZipIOExtraFieldZip64Element.cs
- FrameworkContextData.cs
- ImageListUtils.cs
- WebPartDisplayModeEventArgs.cs
- SocketPermission.cs
- DesignerRegionCollection.cs
- DataGridViewIntLinkedList.cs
- RelAssertionDirectKeyIdentifierClause.cs
- RichTextBox.cs
- PropertyPath.cs
- NativeMethods.cs
- HttpCachePolicy.cs
- ButtonBaseAutomationPeer.cs
- FlowPanelDesigner.cs
- SchemaComplexType.cs
- SafeProcessHandle.cs
- UpdatePanelTriggerCollection.cs
- DesignerAdapterAttribute.cs
- mongolianshape.cs
- _AuthenticationState.cs
- AuthorizationSection.cs
- XPathEmptyIterator.cs
- ConfigXmlText.cs
- CodeDOMProvider.cs
- SspiNegotiationTokenProvider.cs
- MapPathBasedVirtualPathProvider.cs
- MultiSelectRootGridEntry.cs
- PropertyGridEditorPart.cs
- ArgumentOutOfRangeException.cs
- MappingMetadataHelper.cs
- JournalEntry.cs
- UnitySerializationHolder.cs
- SchemaCreator.cs
- FlowDocumentFormatter.cs
- ProtocolViolationException.cs
- rsa.cs
- XmlSignatureProperties.cs
- UpnEndpointIdentity.cs
- XmlSequenceWriter.cs
- validationstate.cs
- ThreadPool.cs
- DockProviderWrapper.cs
- isolationinterop.cs
- MsmqMessageProperty.cs
- StringHandle.cs
- XpsFilter.cs
- XmlSchemaRedefine.cs
- SchemaHelper.cs
- DataControlLinkButton.cs
- Debug.cs
- XmlAttributes.cs
- ButtonStandardAdapter.cs
- SystemUnicastIPAddressInformation.cs
- FragmentQueryProcessor.cs
- DataServiceRequest.cs
- NameTable.cs
- ReadOnlyCollection.cs
- Peer.cs
- SystemSounds.cs
- Stylesheet.cs
- XmlQualifiedName.cs
- Itemizer.cs
- SystemIPInterfaceStatistics.cs
- EUCJPEncoding.cs
- JsonFormatGeneratorStatics.cs
- TransformConverter.cs
- XamlDesignerSerializationManager.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- WebPartConnectionsCancelVerb.cs
- MemberMaps.cs
- CredentialCache.cs
- ISAPIRuntime.cs
- CfgSemanticTag.cs
- _ConnectionGroup.cs
- TextFormatterContext.cs
- TextEditor.cs
- BamlBinaryReader.cs
- SHA256.cs
- SymbolType.cs
- TextLineResult.cs
- TextServicesPropertyRanges.cs