Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / Xml / System / Xml / XPath / Internal / VariableQuery.cs / 2 / 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
- WindowsSpinner.cs
- ActivationArguments.cs
- StylusPlugInCollection.cs
- HttpRequestContext.cs
- SwitchLevelAttribute.cs
- ShapingWorkspace.cs
- BulletedListDesigner.cs
- HotCommands.cs
- InteropAutomationProvider.cs
- CustomAttribute.cs
- login.cs
- WebPartCollection.cs
- HWStack.cs
- ProfessionalColors.cs
- ProfileProvider.cs
- PageContent.cs
- StringPropertyBuilder.cs
- TransformFinalBlockRequest.cs
- RotationValidation.cs
- TextDecorationLocationValidation.cs
- ContourSegment.cs
- CharKeyFrameCollection.cs
- FontSource.cs
- DllNotFoundException.cs
- EntityDataSourceContextDisposingEventArgs.cs
- SharedStatics.cs
- PermissionSet.cs
- VectorAnimation.cs
- ConstrainedDataObject.cs
- DropDownButton.cs
- ListDictionaryInternal.cs
- CaseDesigner.xaml.cs
- EntityDataSourceValidationException.cs
- XmlDataDocument.cs
- LogExtentCollection.cs
- Run.cs
- XmlSchemaCompilationSettings.cs
- AcceleratedTokenProviderState.cs
- SHA256.cs
- SocketAddress.cs
- ChannelBinding.cs
- SourceLineInfo.cs
- PEFileReader.cs
- CodeCommentStatementCollection.cs
- RecordsAffectedEventArgs.cs
- hebrewshape.cs
- SHA1CryptoServiceProvider.cs
- VarRemapper.cs
- Process.cs
- XmlSchemaImport.cs
- StateChangeEvent.cs
- TypeLoadException.cs
- XPathScanner.cs
- ProjectedSlot.cs
- PriorityChain.cs
- TrustDriver.cs
- ModelItemCollection.cs
- DynamicAttribute.cs
- SafeNativeMethodsMilCoreApi.cs
- CmsUtils.cs
- SqlNotificationRequest.cs
- ListViewHitTestInfo.cs
- ConfigurationElementCollection.cs
- EventLogTraceListener.cs
- BamlRecordHelper.cs
- SqlDataSourceFilteringEventArgs.cs
- CodeChecksumPragma.cs
- ApplicationGesture.cs
- SoapRpcMethodAttribute.cs
- FixedPageAutomationPeer.cs
- _RequestCacheProtocol.cs
- WebPartTracker.cs
- XmlDataSourceNodeDescriptor.cs
- ToolStripTemplateNode.cs
- DesignSurfaceCollection.cs
- StdValidatorsAndConverters.cs
- KeyGesture.cs
- TypeDescriptionProviderAttribute.cs
- DataGridViewCell.cs
- JoinGraph.cs
- NameTable.cs
- DataMemberConverter.cs
- TextParagraphCache.cs
- ContentPresenter.cs
- IIS7UserPrincipal.cs
- SchemaEntity.cs
- DynamicMetaObjectBinder.cs
- xsdvalidator.cs
- AdRotator.cs
- SoapTypeAttribute.cs
- PersonalizationStateInfoCollection.cs
- Fault.cs
- TypeElement.cs
- DependencySource.cs
- LeafCellTreeNode.cs
- RegexRunnerFactory.cs
- HMACSHA512.cs
- ThreadExceptionEvent.cs
- MatrixValueSerializer.cs
- DataGridItemCollection.cs