Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / DescendantQuery.cs / 1305376 / DescendantQuery.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; internal class DescendantQuery : DescendantBaseQuery { XPathNodeIterator nodeIterator; internal DescendantQuery(Query qyParent, string Name, string Prefix, XPathNodeType Type, bool matchSelf, bool abbrAxis) : base(qyParent, Name, Prefix, Type, matchSelf, abbrAxis) {} public DescendantQuery(DescendantQuery other) : base(other) { this.nodeIterator = Clone(other.nodeIterator); } public override void Reset() { nodeIterator = null; base.Reset(); } public override XPathNavigator Advance() { while (true) { if (nodeIterator == null) { position = 0; XPathNavigator nav = qyInput.Advance(); if (nav == null) { return null; } if (NameTest) { if (TypeTest == XPathNodeType.ProcessingInstruction) { nodeIterator = new IteratorFilter(nav.SelectDescendants(TypeTest, matchSelf), Name); } else { nodeIterator = nav.SelectDescendants(Name, Namespace, matchSelf); } } else { nodeIterator = nav.SelectDescendants(TypeTest, matchSelf); } } if (nodeIterator.MoveNext()) { position++; currentNode = nodeIterator.Current; return currentNode; } else { nodeIterator = null; } } } public override XPathNodeIterator Clone() { return new DescendantQuery(this); } } } // 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; internal class DescendantQuery : DescendantBaseQuery { XPathNodeIterator nodeIterator; internal DescendantQuery(Query qyParent, string Name, string Prefix, XPathNodeType Type, bool matchSelf, bool abbrAxis) : base(qyParent, Name, Prefix, Type, matchSelf, abbrAxis) {} public DescendantQuery(DescendantQuery other) : base(other) { this.nodeIterator = Clone(other.nodeIterator); } public override void Reset() { nodeIterator = null; base.Reset(); } public override XPathNavigator Advance() { while (true) { if (nodeIterator == null) { position = 0; XPathNavigator nav = qyInput.Advance(); if (nav == null) { return null; } if (NameTest) { if (TypeTest == XPathNodeType.ProcessingInstruction) { nodeIterator = new IteratorFilter(nav.SelectDescendants(TypeTest, matchSelf), Name); } else { nodeIterator = nav.SelectDescendants(Name, Namespace, matchSelf); } } else { nodeIterator = nav.SelectDescendants(TypeTest, matchSelf); } } if (nodeIterator.MoveNext()) { position++; currentNode = nodeIterator.Current; return currentNode; } else { nodeIterator = null; } } } public override XPathNodeIterator Clone() { return new DescendantQuery(this); } } } // 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
- StyleModeStack.cs
- TagPrefixAttribute.cs
- XXXOnTypeBuilderInstantiation.cs
- XmlSchemaAttributeGroup.cs
- Image.cs
- Trigger.cs
- UIPropertyMetadata.cs
- FixedHighlight.cs
- UserPreferenceChangingEventArgs.cs
- NameValueFileSectionHandler.cs
- X500Name.cs
- ScriptingProfileServiceSection.cs
- EntityParameter.cs
- SerialPort.cs
- CollectionViewGroup.cs
- SafeWaitHandle.cs
- CommandManager.cs
- CookieParameter.cs
- WriteTimeStream.cs
- QuadTree.cs
- StreamReader.cs
- GeneralTransformGroup.cs
- MulticastOption.cs
- InvalidProgramException.cs
- FileCodeGroup.cs
- DbQueryCommandTree.cs
- MessageQueueKey.cs
- WebPartZoneBase.cs
- PingReply.cs
- MappingSource.cs
- InvalidStoreProtectionKeyException.cs
- CharKeyFrameCollection.cs
- Types.cs
- BulletedList.cs
- ProfileModule.cs
- SoapSchemaMember.cs
- RestHandlerFactory.cs
- KeyMatchBuilder.cs
- RunInstallerAttribute.cs
- listitem.cs
- ExpressionsCollectionConverter.cs
- StateBag.cs
- SnapshotChangeTrackingStrategy.cs
- XPathExpr.cs
- IconConverter.cs
- SystemTcpConnection.cs
- DataBinding.cs
- PointHitTestResult.cs
- ListItemCollection.cs
- As.cs
- MultiView.cs
- SQLDoubleStorage.cs
- HttpHandlerActionCollection.cs
- SmiXetterAccessMap.cs
- ResourceCategoryAttribute.cs
- Environment.cs
- HtmlAnchor.cs
- DataGridColumnCollection.cs
- PopOutPanel.cs
- Int32CAMarshaler.cs
- MetadataArtifactLoaderCompositeFile.cs
- hwndwrapper.cs
- GenericRootAutomationPeer.cs
- ObjectDataSourceWizardForm.cs
- _ConnectOverlappedAsyncResult.cs
- ReaderWriterLockSlim.cs
- ObjectStateManagerMetadata.cs
- TypeToken.cs
- XmlParserContext.cs
- CharacterBuffer.cs
- QuaternionRotation3D.cs
- GridViewColumnHeaderAutomationPeer.cs
- ObjectNotFoundException.cs
- StrokeNodeOperations.cs
- DesignerOptionService.cs
- RepeatBehavior.cs
- RunWorkerCompletedEventArgs.cs
- XmlIgnoreAttribute.cs
- MatrixTransform.cs
- BuildResultCache.cs
- XmlAttribute.cs
- Directory.cs
- XhtmlBasicFormAdapter.cs
- Calendar.cs
- MembershipValidatePasswordEventArgs.cs
- GenericQueueSurrogate.cs
- MultiplexingFormatMapping.cs
- InkPresenterAutomationPeer.cs
- GeneralTransform3D.cs
- XdrBuilder.cs
- CancellationToken.cs
- LocalServiceSecuritySettingsElement.cs
- AuthenticatedStream.cs
- TextBoxBase.cs
- RegexTree.cs
- ServiceRoute.cs
- XdrBuilder.cs
- BamlWriter.cs
- AutoGeneratedFieldProperties.cs
- DescendantBaseQuery.cs