Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // //[....] //----------------------------------------------------------------------------- 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
- List.cs
- SymbolEqualComparer.cs
- InputLangChangeRequestEvent.cs
- Decimal.cs
- ContentFilePart.cs
- _OSSOCK.cs
- EarlyBoundInfo.cs
- ByteKeyFrameCollection.cs
- LockedBorderGlyph.cs
- HitTestDrawingContextWalker.cs
- TextRange.cs
- ZipIOFileItemStream.cs
- CodeDelegateCreateExpression.cs
- Thread.cs
- MasterPageCodeDomTreeGenerator.cs
- PenLineCapValidation.cs
- TreeNodeStyleCollection.cs
- QueryStringParameter.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- BamlBinaryReader.cs
- TextHintingModeValidation.cs
- HttpConfigurationSystem.cs
- UnmanagedMarshal.cs
- WindowsFormsHostAutomationPeer.cs
- AuthorizationRule.cs
- Attachment.cs
- XPathExpr.cs
- ConfigUtil.cs
- Buffer.cs
- WebPartEditorCancelVerb.cs
- StorageMappingFragment.cs
- CodeDomLocalizationProvider.cs
- TraceLevelHelper.cs
- DbParameterCollectionHelper.cs
- CorrelationManager.cs
- ServiceNameCollection.cs
- FieldAccessException.cs
- Matrix3DConverter.cs
- ModuleBuilder.cs
- IntegerCollectionEditor.cs
- UpdateProgress.cs
- DynamicActivityTypeDescriptor.cs
- SizeAnimationClockResource.cs
- SafeViewOfFileHandle.cs
- TextEncodedRawTextWriter.cs
- TerminateSequenceResponse.cs
- DashStyle.cs
- DrawingImage.cs
- QuaternionConverter.cs
- counter.cs
- DataGridView.cs
- VisualStyleRenderer.cs
- ThreadPoolTaskScheduler.cs
- WebServiceHost.cs
- PrimitiveType.cs
- TextDecorationUnitValidation.cs
- DoubleMinMaxAggregationOperator.cs
- Fx.cs
- DataReaderContainer.cs
- XXXInfos.cs
- StorageFunctionMapping.cs
- RectAnimation.cs
- SqlDataSourceRefreshSchemaForm.cs
- HttpApplication.cs
- BufferedGenericXmlSecurityToken.cs
- ClientScriptManagerWrapper.cs
- filewebresponse.cs
- GeneralTransformGroup.cs
- ArraySegment.cs
- RewritingValidator.cs
- RelationshipDetailsRow.cs
- AuthorizationRule.cs
- SecurityRuntime.cs
- AnnotationComponentManager.cs
- DataBinder.cs
- GeometryValueSerializer.cs
- UnknownBitmapEncoder.cs
- Predicate.cs
- BaseCAMarshaler.cs
- BrowserCapabilitiesFactoryBase.cs
- Blend.cs
- CommonDialog.cs
- TextAnchor.cs
- Path.cs
- RootBuilder.cs
- PreservationFileWriter.cs
- EllipticalNodeOperations.cs
- VisualBasicSettingsHandler.cs
- VoiceSynthesis.cs
- XPathLexer.cs
- WebPartConnectionsConfigureVerb.cs
- ConstructorArgumentAttribute.cs
- DocumentEventArgs.cs
- Misc.cs
- Util.cs
- FindCriteria.cs
- ToolStripContentPanelDesigner.cs
- UrlPath.cs
- KeyedByTypeCollection.cs
- ContentPresenter.cs