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
- HostUtils.cs
- Matrix.cs
- CompositeControl.cs
- OleCmdHelper.cs
- FileNotFoundException.cs
- Constraint.cs
- ThicknessAnimation.cs
- MachineKeyConverter.cs
- BinaryWriter.cs
- XmlHierarchicalEnumerable.cs
- TransformValueSerializer.cs
- ViewCellRelation.cs
- DataPointer.cs
- AnnotationComponentChooser.cs
- ResourcesBuildProvider.cs
- CellParagraph.cs
- ShaderEffect.cs
- CryptographicAttribute.cs
- HyperlinkAutomationPeer.cs
- MatrixAnimationBase.cs
- PersonalizationEntry.cs
- TouchFrameEventArgs.cs
- AnnotationMap.cs
- RSAOAEPKeyExchangeDeformatter.cs
- VisualProxy.cs
- DatagridviewDisplayedBandsData.cs
- Internal.cs
- ClientFormsAuthenticationCredentials.cs
- ArrayTypeMismatchException.cs
- PointHitTestParameters.cs
- TextBlockAutomationPeer.cs
- ValueChangedEventManager.cs
- SelectionRange.cs
- _SSPIWrapper.cs
- externdll.cs
- CodeAttributeDeclaration.cs
- CanonicalXml.cs
- IPipelineRuntime.cs
- WindowsMenu.cs
- AuthenticateEventArgs.cs
- SimpleApplicationHost.cs
- GeneralTransform3D.cs
- Helpers.cs
- XPathNavigator.cs
- ErrorStyle.cs
- CodeObject.cs
- SettingsAttributeDictionary.cs
- NavigationPropertyEmitter.cs
- SignedXml.cs
- PropertyCondition.cs
- MemberDescriptor.cs
- XmlSchemaComplexContent.cs
- HtmlButton.cs
- BooleanFunctions.cs
- DateTimeValueSerializerContext.cs
- TimeSpanValidatorAttribute.cs
- OdbcParameter.cs
- TypeContext.cs
- PageWrapper.cs
- SQLInt32Storage.cs
- DBCSCodePageEncoding.cs
- WinInetCache.cs
- SourceSwitch.cs
- WebPartsPersonalization.cs
- PageThemeBuildProvider.cs
- DataSourceCacheDurationConverter.cs
- MenuBindingsEditorForm.cs
- DropDownList.cs
- TabControl.cs
- WebSysDescriptionAttribute.cs
- ContractSearchPattern.cs
- FontCacheUtil.cs
- EncodingNLS.cs
- ScriptingProfileServiceSection.cs
- FtpRequestCacheValidator.cs
- HighlightComponent.cs
- HandleCollector.cs
- CharEnumerator.cs
- CatalogPartDesigner.cs
- PingOptions.cs
- SqlInternalConnectionSmi.cs
- HitTestResult.cs
- JsonDeserializer.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- TaskFormBase.cs
- RIPEMD160.cs
- DeferrableContentConverter.cs
- EventHandlerList.cs
- PaintValueEventArgs.cs
- TextComposition.cs
- GenericAuthenticationEventArgs.cs
- SuppressMessageAttribute.cs
- CardSpaceSelector.cs
- MarshalDirectiveException.cs
- EncodingDataItem.cs
- PropertyDescriptorCollection.cs
- ExpressionBindingCollection.cs
- ContextMenu.cs
- UriWriter.cs
- DateTimeValueSerializerContext.cs