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
- KoreanLunisolarCalendar.cs
- CompilationLock.cs
- ExpressionDumper.cs
- WindowsListViewSubItem.cs
- DataGridViewRowCancelEventArgs.cs
- RegexCompiler.cs
- VectorValueSerializer.cs
- ZipFileInfoCollection.cs
- NetTcpBinding.cs
- WebPartDeleteVerb.cs
- PeerReferralPolicy.cs
- DbProviderFactories.cs
- ComponentSerializationService.cs
- localization.cs
- XmlAttributes.cs
- RangeValueProviderWrapper.cs
- Accessible.cs
- SmiMetaDataProperty.cs
- WebBrowserDesigner.cs
- BezierSegment.cs
- ParameterBuilder.cs
- HttpWriter.cs
- URLAttribute.cs
- ImageFormat.cs
- DropShadowEffect.cs
- PageAsyncTask.cs
- DataBindingCollection.cs
- Configuration.cs
- ScrollData.cs
- BulletChrome.cs
- RequestBringIntoViewEventArgs.cs
- EntityDataSourceUtil.cs
- AlphaSortedEnumConverter.cs
- WeakRefEnumerator.cs
- SqlDataSourceFilteringEventArgs.cs
- BitHelper.cs
- ConsumerConnectionPoint.cs
- PointHitTestParameters.cs
- TemplateColumn.cs
- AutomationElementIdentifiers.cs
- LinqDataView.cs
- LocalBuilder.cs
- SystemIPInterfaceStatistics.cs
- ComboBoxAutomationPeer.cs
- MatcherBuilder.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- TriState.cs
- PeerApplication.cs
- SafeTokenHandle.cs
- TargetConverter.cs
- SHA512Cng.cs
- HtmlControl.cs
- filewebresponse.cs
- ClientBuildManagerCallback.cs
- XNameConverter.cs
- Operator.cs
- FontInfo.cs
- XPathDocumentIterator.cs
- clipboard.cs
- ExeConfigurationFileMap.cs
- SafeProcessHandle.cs
- ConfigurationPropertyAttribute.cs
- TypeInitializationException.cs
- KeyBinding.cs
- PersonalizableTypeEntry.cs
- httpstaticobjectscollection.cs
- AggregatePushdown.cs
- PropertyTabAttribute.cs
- ConfigurationStrings.cs
- SchemaNotation.cs
- AdRotatorDesigner.cs
- VisualProxy.cs
- DataBoundControl.cs
- MailMessage.cs
- ContractDescription.cs
- WebCategoryAttribute.cs
- EncoderNLS.cs
- RuleSettingsCollection.cs
- MailWriter.cs
- SpeechDetectedEventArgs.cs
- ScrollViewer.cs
- XmlDataSourceNodeDescriptor.cs
- DynamicRendererThreadManager.cs
- SemaphoreSecurity.cs
- BitmapEffectInput.cs
- DataViewManagerListItemTypeDescriptor.cs
- WebServiceParameterData.cs
- HtmlTableRow.cs
- ToolStripOverflow.cs
- DrawingBrush.cs
- HtmlElement.cs
- CustomLineCap.cs
- EntityClassGenerator.cs
- VirtualDirectoryMapping.cs
- OdbcPermission.cs
- WindowsStatusBar.cs
- FormViewDeleteEventArgs.cs
- WebPartDisplayMode.cs
- RadioButtonBaseAdapter.cs
- DataGridSortCommandEventArgs.cs