Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Xml / System / Xml / XPath / Internal / DescendantQuery.cs / 1 / 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
- GeometryCollection.cs
- HtmlElementEventArgs.cs
- XPathExpr.cs
- TokenBasedSet.cs
- TypeForwardedToAttribute.cs
- CodeValidator.cs
- SplashScreen.cs
- SqlDelegatedTransaction.cs
- VariantWrapper.cs
- MediaContextNotificationWindow.cs
- ThreadAbortException.cs
- InvalidProgramException.cs
- webclient.cs
- Misc.cs
- HttpListenerContext.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- ExtensionSimplifierMarkupObject.cs
- X509AsymmetricSecurityKey.cs
- RuntimeWrappedException.cs
- XmlDataCollection.cs
- CodeExpressionCollection.cs
- Vector3DIndependentAnimationStorage.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- Point3DCollection.cs
- ItemCollection.cs
- AttributeXamlType.cs
- FigureParagraph.cs
- InternalResources.cs
- XPathNodeHelper.cs
- ISFTagAndGuidCache.cs
- DbConnectionClosed.cs
- Visual3D.cs
- ConfigXmlComment.cs
- SubclassTypeValidatorAttribute.cs
- ScriptControlDescriptor.cs
- WebServicesInteroperability.cs
- DataPagerFieldCollection.cs
- SocketStream.cs
- SmiEventStream.cs
- ExceptionValidationRule.cs
- SplitterCancelEvent.cs
- OptimizerPatterns.cs
- Utils.cs
- UInt32Storage.cs
- RemotingAttributes.cs
- KoreanLunisolarCalendar.cs
- PagerSettings.cs
- AnnouncementInnerClientCD1.cs
- Form.cs
- OrderedDictionary.cs
- AssociationType.cs
- BulletedListEventArgs.cs
- COM2FontConverter.cs
- Marshal.cs
- TextEmbeddedObject.cs
- StandardToolWindows.cs
- RepeaterItemEventArgs.cs
- CodeNamespaceCollection.cs
- ApplicationProxyInternal.cs
- UriTemplateDispatchFormatter.cs
- SafeLocalAllocation.cs
- IdentityValidationException.cs
- XmlSchemaObjectCollection.cs
- TypeConvertions.cs
- QueryExtender.cs
- ChangeDirector.cs
- Encoder.cs
- ColorAnimationBase.cs
- DoubleAnimation.cs
- ButtonField.cs
- ToolboxItemCollection.cs
- EventSource.cs
- SimplePropertyEntry.cs
- FrameworkTemplate.cs
- UnknownBitmapEncoder.cs
- SparseMemoryStream.cs
- DataViewSettingCollection.cs
- XslUrlEditor.cs
- FileAuthorizationModule.cs
- Compiler.cs
- DeviceSpecificDialogCachedState.cs
- DefaultBindingPropertyAttribute.cs
- LoadGrammarCompletedEventArgs.cs
- XmlElementCollection.cs
- CodeGeneratorOptions.cs
- RegexCode.cs
- DataServiceException.cs
- AlignmentYValidation.cs
- Transform.cs
- QueueProcessor.cs
- Paragraph.cs
- Utils.cs
- _LocalDataStore.cs
- ParserOptions.cs
- SiteMapNodeItemEventArgs.cs
- DbConnectionPoolGroup.cs
- UserNameSecurityTokenProvider.cs
- RequestQueryProcessor.cs
- UIPermission.cs
- HitTestWithPointDrawingContextWalker.cs