Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- CellLabel.cs
- RefExpr.cs
- WebMessageBodyStyleHelper.cs
- NameValuePermission.cs
- OdbcUtils.cs
- ProviderSettingsCollection.cs
- DetailsView.cs
- InnerItemCollectionView.cs
- TraceHandler.cs
- URLMembershipCondition.cs
- FlowPosition.cs
- Transactions.cs
- FactoryGenerator.cs
- CodeTypeReference.cs
- AliasGenerator.cs
- wpf-etw.cs
- EnumerableRowCollection.cs
- StaticDataManager.cs
- DES.cs
- _Win32.cs
- Int32RectValueSerializer.cs
- ServiceDocumentFormatter.cs
- ResXFileRef.cs
- ZipArchive.cs
- WebPartZoneCollection.cs
- Ipv6Element.cs
- StrongNameKeyPair.cs
- QueryOutputWriterV1.cs
- SQLMoney.cs
- HtmlTableCellCollection.cs
- ZipIOLocalFileDataDescriptor.cs
- SystemBrushes.cs
- CustomWebEventKey.cs
- HotSpotCollection.cs
- ContainerUtilities.cs
- TransactionManager.cs
- XmlSchemaImporter.cs
- ProfileService.cs
- MetaType.cs
- InputBinding.cs
- ToolboxBitmapAttribute.cs
- ServiceMemoryGates.cs
- DelegateTypeInfo.cs
- DesignColumn.cs
- RangeValidator.cs
- Int64Storage.cs
- FontDialog.cs
- ManagedFilter.cs
- AuthenticationException.cs
- HMAC.cs
- Point3DCollection.cs
- ProfileEventArgs.cs
- GradientBrush.cs
- LocalFileSettingsProvider.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- ReferentialConstraint.cs
- ViewEvent.cs
- WebPartConnectionsConnectVerb.cs
- SqlWorkflowInstanceStore.cs
- _ScatterGatherBuffers.cs
- MsmqIntegrationSecurityElement.cs
- SearchForVirtualItemEventArgs.cs
- ObjectAssociationEndMapping.cs
- HttpResponseHeader.cs
- GroupBoxRenderer.cs
- ApplicationTrust.cs
- BitmapEffectInput.cs
- SqlMethodTransformer.cs
- SoapAttributeOverrides.cs
- safelink.cs
- TimeSpan.cs
- CodeBlockBuilder.cs
- SHA384Managed.cs
- OdbcFactory.cs
- RootBrowserWindowProxy.cs
- RelationshipDetailsRow.cs
- CodeDefaultValueExpression.cs
- SoapFault.cs
- Visual3DCollection.cs
- MetadataItemEmitter.cs
- MediaPlayer.cs
- SymbolEqualComparer.cs
- DataGridViewAccessibleObject.cs
- StrongNamePublicKeyBlob.cs
- Unit.cs
- RectAnimationBase.cs
- _BasicClient.cs
- RootBuilder.cs
- OdbcConnectionStringbuilder.cs
- CustomValidator.cs
- RepeaterItem.cs
- NegotiateStream.cs
- SelectionItemPattern.cs
- IdnElement.cs
- LinqExpressionNormalizer.cs
- XsltCompileContext.cs
- AttributeSetAction.cs
- AnimationLayer.cs
- AssemblyNameProxy.cs
- SystemParameters.cs