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
- RectAnimationBase.cs
- AutoGeneratedFieldProperties.cs
- SqlNode.cs
- TransportContext.cs
- StylusPlugin.cs
- LinqToSqlWrapper.cs
- OdbcConnectionString.cs
- DataBoundControlHelper.cs
- DescendantBaseQuery.cs
- RelatedEnd.cs
- MetadataException.cs
- TypeContext.cs
- ImageListStreamer.cs
- XslAst.cs
- DataViewSettingCollection.cs
- ManagementEventArgs.cs
- DrawListViewItemEventArgs.cs
- DataSourceXmlSerializer.cs
- MarkupCompilePass1.cs
- SelectedDatesCollection.cs
- ProxyWebPartManager.cs
- PersonalizationAdministration.cs
- UshortList2.cs
- PhysicalAddress.cs
- IdentitySection.cs
- Int32RectConverter.cs
- PenContext.cs
- SystemNetHelpers.cs
- BamlBinaryReader.cs
- PrimitiveXmlSerializers.cs
- NoPersistHandle.cs
- LocatorGroup.cs
- OdbcCommandBuilder.cs
- Html32TextWriter.cs
- DataGridColumnEventArgs.cs
- HandlerBase.cs
- WebPartConnectionsCancelEventArgs.cs
- BitmapMetadataBlob.cs
- TextClipboardData.cs
- InvalidWMPVersionException.cs
- Calendar.cs
- FileLoadException.cs
- Trace.cs
- XhtmlBasicImageAdapter.cs
- AdornerLayer.cs
- _SafeNetHandles.cs
- ChineseLunisolarCalendar.cs
- ToolStripHighContrastRenderer.cs
- Triplet.cs
- ReadOnlyAttribute.cs
- SqlNodeAnnotations.cs
- AuthenticateEventArgs.cs
- PenContext.cs
- NativeCppClassAttribute.cs
- metadatamappinghashervisitor.cs
- ConfigXmlCDataSection.cs
- CodeDefaultValueExpression.cs
- DataView.cs
- Int16.cs
- RequestSecurityTokenSerializer.cs
- TagPrefixInfo.cs
- ThicknessKeyFrameCollection.cs
- DragCompletedEventArgs.cs
- PositiveTimeSpanValidator.cs
- ProcessManager.cs
- Root.cs
- DropAnimation.xaml.cs
- ArrangedElement.cs
- ListMarkerLine.cs
- TokenizerHelper.cs
- GridItem.cs
- PictureBoxDesigner.cs
- NotFiniteNumberException.cs
- SystemWebCachingSectionGroup.cs
- OpacityConverter.cs
- DataGridViewCellValueEventArgs.cs
- FormatterServicesNoSerializableCheck.cs
- Camera.cs
- XmlWriter.cs
- ProcessingInstructionAction.cs
- CompModSwitches.cs
- PrintPreviewDialog.cs
- ChooseAction.cs
- Attachment.cs
- CursorConverter.cs
- Hashtable.cs
- Schema.cs
- NamedPipeConnectionPoolSettingsElement.cs
- ProcessHostConfigUtils.cs
- SystemIPv4InterfaceProperties.cs
- AsyncContentLoadedEventArgs.cs
- ApplicationServiceHelper.cs
- DataMemberListEditor.cs
- TransformedBitmap.cs
- ActivitiesCollection.cs
- HostedBindingBehavior.cs
- dataSvcMapFileLoader.cs
- CookieParameter.cs
- XmlnsDictionary.cs
- AddInContractAttribute.cs