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
- CodeIdentifier.cs
- Point.cs
- TextFormattingConverter.cs
- SoapMessage.cs
- MessageBox.cs
- EditorZoneBase.cs
- coordinatorfactory.cs
- MenuAutomationPeer.cs
- ToggleProviderWrapper.cs
- GiveFeedbackEventArgs.cs
- UriParserTemplates.cs
- Crc32Helper.cs
- ConfigPathUtility.cs
- EntityProxyTypeInfo.cs
- StubHelpers.cs
- OptimizedTemplateContentHelper.cs
- ToolStripDropDownClosedEventArgs.cs
- ControlUtil.cs
- XsdBuildProvider.cs
- ParameterSubsegment.cs
- PrintControllerWithStatusDialog.cs
- TraceHandlerErrorFormatter.cs
- SoapCodeExporter.cs
- VisualTarget.cs
- StringFreezingAttribute.cs
- ParameterModifier.cs
- Hex.cs
- BitmapInitialize.cs
- XPathDocument.cs
- WaveHeader.cs
- FixedSOMLineCollection.cs
- ChangePassword.cs
- WindowsFormsDesignerOptionService.cs
- FrameworkName.cs
- XmlText.cs
- TextInfo.cs
- ColorAnimation.cs
- BlobPersonalizationState.cs
- TableStyle.cs
- ProxyWebPartManager.cs
- LeaseManager.cs
- DeviceFiltersSection.cs
- LayoutManager.cs
- PersonalizationAdministration.cs
- EndpointAddress10.cs
- VisualStates.cs
- WebUtil.cs
- WebPartEditorOkVerb.cs
- FormsAuthenticationModule.cs
- PrePostDescendentsWalker.cs
- RuleSettingsCollection.cs
- WindowsGraphicsCacheManager.cs
- XmlSchemaComplexContentRestriction.cs
- IsolatedStorageFilePermission.cs
- AssertSection.cs
- DataList.cs
- DSASignatureDeformatter.cs
- LinkTarget.cs
- FixedLineResult.cs
- Operator.cs
- DispatchWrapper.cs
- WebPartsPersonalization.cs
- Missing.cs
- QuaternionValueSerializer.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- ListControl.cs
- WorkflowRuntimeService.cs
- FactoryMaker.cs
- SettingsAttributes.cs
- UiaCoreApi.cs
- ServerValidateEventArgs.cs
- BinaryParser.cs
- CodeSnippetStatement.cs
- DESCryptoServiceProvider.cs
- KoreanCalendar.cs
- TimeSpan.cs
- RemotingException.cs
- ServiceInstallComponent.cs
- DataList.cs
- SetterBaseCollection.cs
- TableLayoutSettingsTypeConverter.cs
- NativeObjectSecurity.cs
- SecureConversationSecurityTokenParameters.cs
- EmptyEnumerator.cs
- CursorConverter.cs
- HtmlFormWrapper.cs
- CallTemplateAction.cs
- RecipientInfo.cs
- InputManager.cs
- GorillaCodec.cs
- CurrentTimeZone.cs
- InstanceData.cs
- SplashScreenNativeMethods.cs
- TransportOutputChannel.cs
- EventProviderWriter.cs
- XmlKeywords.cs
- DetailsViewAutoFormat.cs
- ObjectNavigationPropertyMapping.cs
- GradientBrush.cs
- RegexGroupCollection.cs