Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Xml / System / Xml / XPath / Internal / ExtensionQuery.cs / 2 / ExtensionQuery.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace MS.Internal.Xml.XPath { using System; using System.Xml; using System.Xml.Xsl; using System.Xml.XPath; using System.Diagnostics; using System.Globalization; using System.Collections; internal abstract class ExtensionQuery : Query { protected string prefix; protected string name; protected XsltContext xsltContext; private ResetableIterator queryIterator; public ExtensionQuery(string prefix, string name) : base() { this.prefix = prefix; this.name = name; } protected ExtensionQuery(ExtensionQuery other) : base(other) { this.prefix = other.prefix; this.name = other.name; this.xsltContext = other.xsltContext; this.queryIterator = (ResetableIterator)Clone(other.queryIterator); } public override void Reset() { if (queryIterator != null) { queryIterator.Reset(); } } public override XPathNavigator Current { get { if (queryIterator == null) { throw XPathException.Create(Res.Xp_NodeSetExpected); } if (queryIterator.CurrentPosition == 0) { Advance(); } return queryIterator.Current; } } public override XPathNavigator Advance() { if (queryIterator == null) { throw XPathException.Create(Res.Xp_NodeSetExpected); } if (queryIterator.MoveNext()) { return queryIterator.Current; } return null; } public override int CurrentPosition { get { if (queryIterator != null) { return queryIterator.CurrentPosition; } return 0; } } protected object ProcessResult(object value) { if (value is string ) return value; if (value is double ) return value; if (value is bool ) return value; if (value is XPathNavigator) return value; if (value is Int32 ) return (double)(Int32)value; if (value == null) { queryIterator = XPathEmptyIterator.Instance; return this; // We map null to NodeSet to let $null/foo work well. } ResetableIterator resetable = value as ResetableIterator; if (resetable != null) { // We need Clone() value because variable may be used several times // and they shouldn't queryIterator = (ResetableIterator)resetable.Clone(); return this; } XPathNodeIterator nodeIterator = value as XPathNodeIterator; if (nodeIterator != null) { queryIterator = new XPathArrayIterator(nodeIterator); return this; } IXPathNavigable navigable = value as IXPathNavigable; if(navigable != null) { return navigable.CreateNavigator(); } if (value is Int16 ) return (double)(Int16)value; if (value is Int64 ) return (double)(Int64)value; if (value is UInt32) return (double)(UInt32)value; if (value is UInt16) return (double)(UInt16)value; if (value is UInt64) return (double)(UInt64)value; if (value is Single) return (double)(Single)value; if (value is Decimal) return (double)(Decimal)value; return value.ToString(); } protected string QName { get { return prefix.Length != 0 ? prefix + ":" + name : name; } } public override int Count { get { return queryIterator == null ? 1 : queryIterator.Count; } } public override XPathResultType StaticType { get { return XPathResultType.Any; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataContractSerializerServiceBehavior.cs
- Hex.cs
- StretchValidation.cs
- DateTimeConverter2.cs
- TokenBasedSetEnumerator.cs
- PingOptions.cs
- AnonymousIdentificationModule.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- TextWriter.cs
- ResXResourceWriter.cs
- SafeEventLogReadHandle.cs
- BaseParagraph.cs
- TreeIterator.cs
- FormatterServices.cs
- LinqDataSourceEditData.cs
- DefaultHttpHandler.cs
- AuthenticationModulesSection.cs
- MethodBuilder.cs
- CrossSiteScriptingValidation.cs
- BitmapEffectDrawingContent.cs
- PhysicalOps.cs
- ToolBarButton.cs
- MenuItemBindingCollection.cs
- Size3DConverter.cs
- TextViewSelectionProcessor.cs
- ConstraintStruct.cs
- XmlText.cs
- ScrollPatternIdentifiers.cs
- TableItemPattern.cs
- DataGridViewCellLinkedList.cs
- RuntimeConfigLKG.cs
- InheritanceContextChangedEventManager.cs
- precedingquery.cs
- RecognizerBase.cs
- LinqTreeNodeEvaluator.cs
- Converter.cs
- InternalUserCancelledException.cs
- IApplicationTrustManager.cs
- ExplicitDiscriminatorMap.cs
- Size3DValueSerializer.cs
- HtmlInputControl.cs
- AxHostDesigner.cs
- AsyncStreamReader.cs
- PositiveTimeSpanValidatorAttribute.cs
- TableParagraph.cs
- User.cs
- Point4DConverter.cs
- Metadata.cs
- figurelength.cs
- UnsafeNativeMethods.cs
- SqlDependencyUtils.cs
- DirectionalLight.cs
- MissingManifestResourceException.cs
- Sentence.cs
- EmptyEnumerable.cs
- OracleRowUpdatedEventArgs.cs
- CodeMemberProperty.cs
- DynamicControlParameter.cs
- CultureSpecificStringDictionary.cs
- AsyncStreamReader.cs
- SqlDataSource.cs
- LineSegment.cs
- DocumentApplicationJournalEntry.cs
- SchemaDeclBase.cs
- SocketAddress.cs
- ViewDesigner.cs
- EventProxy.cs
- DataViewManagerListItemTypeDescriptor.cs
- MdiWindowListItemConverter.cs
- Button.cs
- AccessedThroughPropertyAttribute.cs
- VectorCollectionValueSerializer.cs
- Thickness.cs
- QueryExtender.cs
- infer.cs
- CompiledQuery.cs
- TextEditorParagraphs.cs
- DataGridComponentEditor.cs
- DataSourceControlBuilder.cs
- TypeUtil.cs
- RegistrySecurity.cs
- EventRouteFactory.cs
- StringUtil.cs
- ClientBuildManagerCallback.cs
- TextReader.cs
- Vector3D.cs
- XmlSchemaSimpleContent.cs
- ResourceSet.cs
- PropertyCollection.cs
- FixedDocument.cs
- BuildDependencySet.cs
- HwndTarget.cs
- DbMetaDataFactory.cs
- TraceData.cs
- ButtonChrome.cs
- BitArray.cs
- XmlReturnWriter.cs
- InputScope.cs
- ComponentTray.cs
- ParamArrayAttribute.cs