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
- AnnotationAuthorChangedEventArgs.cs
- XmlDataSourceNodeDescriptor.cs
- TraceContextEventArgs.cs
- ListViewItemMouseHoverEvent.cs
- FontStretch.cs
- BitmapEffectGeneralTransform.cs
- WebConfigurationHostFileChange.cs
- ObjectViewQueryResultData.cs
- OLEDB_Util.cs
- IDispatchConstantAttribute.cs
- Int32CAMarshaler.cs
- ColumnResult.cs
- IsolatedStorageFile.cs
- ActivityMarkupSerializationProvider.cs
- QueryCreatedEventArgs.cs
- AvTraceFormat.cs
- CurrencyWrapper.cs
- PopupControlService.cs
- ListCommandEventArgs.cs
- manifestimages.cs
- IisTraceWebEventProvider.cs
- OrCondition.cs
- ResourcePermissionBase.cs
- AppliedDeviceFiltersDialog.cs
- QueryCursorEventArgs.cs
- _ShellExpression.cs
- securestring.cs
- PropertyDescriptorGridEntry.cs
- ReadWriteSpinLock.cs
- LeftCellWrapper.cs
- SignatureDescription.cs
- DataGridColumn.cs
- FormViewCommandEventArgs.cs
- ItemMap.cs
- SQLDecimal.cs
- FlowPanelDesigner.cs
- ToolStripSplitStackLayout.cs
- ProvidePropertyAttribute.cs
- StdRegProviderWrapper.cs
- Point3DAnimationBase.cs
- WebServiceHostFactory.cs
- XmlImplementation.cs
- invalidudtexception.cs
- SqlException.cs
- RelatedEnd.cs
- SHA512.cs
- Byte.cs
- EntityDataSourceSelectingEventArgs.cs
- FileLogRecord.cs
- TrackingServices.cs
- XmlSchemas.cs
- GlyphInfoList.cs
- TagMapCollection.cs
- XmlBaseWriter.cs
- App.cs
- TraceSection.cs
- ThreadWorkerController.cs
- WebPartDisplayModeCancelEventArgs.cs
- Menu.cs
- StronglyTypedResourceBuilder.cs
- _AutoWebProxyScriptEngine.cs
- SkipStoryboardToFill.cs
- ActionMismatchAddressingException.cs
- BinaryReader.cs
- EraserBehavior.cs
- TagElement.cs
- ToggleProviderWrapper.cs
- PinProtectionHelper.cs
- ChangeDirector.cs
- DrawingVisual.cs
- FastPropertyAccessor.cs
- ErrorFormatter.cs
- EventLogWatcher.cs
- Comparer.cs
- SwitchDesigner.xaml.cs
- SinglePhaseEnlistment.cs
- TemplateControlParser.cs
- ValidationPropertyAttribute.cs
- CommandBindingCollection.cs
- IERequestCache.cs
- NavigatingCancelEventArgs.cs
- KeyTimeConverter.cs
- RegexCharClass.cs
- AssemblyHash.cs
- HttpRuntimeSection.cs
- DecoderFallbackWithFailureFlag.cs
- Token.cs
- SystemTcpStatistics.cs
- StrokeNodeOperations2.cs
- AnnotationComponentChooser.cs
- SQLConvert.cs
- ResourceManagerWrapper.cs
- DesignerAutoFormatCollection.cs
- ProvidersHelper.cs
- StructuredTypeInfo.cs
- HttpFileCollection.cs
- AccessibleObject.cs
- DivideByZeroException.cs
- SettingsPropertyValueCollection.cs
- ConfigurationStrings.cs