Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NativeMethods.cs
- WindowsClaimSet.cs
- NetworkAddressChange.cs
- TextBounds.cs
- Matrix3DStack.cs
- DesignerView.xaml.cs
- OleDbEnumerator.cs
- XamlWrapperReaders.cs
- XmlSchemaSimpleContentExtension.cs
- ListViewDeletedEventArgs.cs
- InternalCache.cs
- ProtocolsSection.cs
- TableRow.cs
- httpapplicationstate.cs
- SelectionPattern.cs
- MonthChangedEventArgs.cs
- BoolExpr.cs
- WebPartDisplayModeEventArgs.cs
- LongTypeConverter.cs
- TemplateControlParser.cs
- ScriptControlDescriptor.cs
- ScriptingScriptResourceHandlerSection.cs
- WebPartConnectionsCancelEventArgs.cs
- LineSegment.cs
- AutomationAttributeInfo.cs
- JournalNavigationScope.cs
- _Rfc2616CacheValidators.cs
- GeometryHitTestResult.cs
- MetabaseServerConfig.cs
- WmfPlaceableFileHeader.cs
- MembershipAdapter.cs
- AssemblyName.cs
- RichTextBoxConstants.cs
- DispatcherOperation.cs
- ImageAttributes.cs
- TreeViewCancelEvent.cs
- ZipIOLocalFileHeader.cs
- SafeLibraryHandle.cs
- SmiRecordBuffer.cs
- ClientSettings.cs
- SqlTopReducer.cs
- PrePrepareMethodAttribute.cs
- CheckBoxField.cs
- SmiMetaDataProperty.cs
- RestHandlerFactory.cs
- _NativeSSPI.cs
- SchemaNames.cs
- WrapPanel.cs
- XmlSchemaAnnotation.cs
- CroppedBitmap.cs
- SchemaEntity.cs
- SecurityRuntime.cs
- CacheDict.cs
- DataBindingExpressionBuilder.cs
- HttpCapabilitiesEvaluator.cs
- PrimitiveSchema.cs
- DesignerAdRotatorAdapter.cs
- WindowShowOrOpenTracker.cs
- QilInvoke.cs
- FormView.cs
- CountdownEvent.cs
- GridErrorDlg.cs
- ValidatingCollection.cs
- DecoderExceptionFallback.cs
- DateTime.cs
- Enum.cs
- CurrentChangedEventManager.cs
- WinEventWrap.cs
- StateMachineWorkflowInstance.cs
- UIntPtr.cs
- ObjectTag.cs
- EditorZone.cs
- StrongNameMembershipCondition.cs
- DisplayMemberTemplateSelector.cs
- TogglePattern.cs
- SolidColorBrush.cs
- UserControlAutomationPeer.cs
- ValueHandle.cs
- DataSourceProvider.cs
- _IPv6Address.cs
- BaseAppDomainProtocolHandler.cs
- PerformanceCounterCategory.cs
- GZipStream.cs
- CompilerScope.Storage.cs
- WriteTimeStream.cs
- RowBinding.cs
- SqlDataAdapter.cs
- DeviceSpecificChoice.cs
- PolyQuadraticBezierSegment.cs
- ImageIndexConverter.cs
- DefaultPerformanceCounters.cs
- GeneralTransform3DTo2D.cs
- IPGlobalProperties.cs
- ExeConfigurationFileMap.cs
- UdpDuplexChannel.cs
- PrePostDescendentsWalker.cs
- DbModificationCommandTree.cs
- DesignerLoader.cs
- FormatSettings.cs
- EnumUnknown.cs