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
- AssemblyInfo.cs
- SoapEnumAttribute.cs
- JournalNavigationScope.cs
- DataGridViewCell.cs
- EnvironmentPermission.cs
- AffineTransform3D.cs
- TemplateControlBuildProvider.cs
- GridViewSelectEventArgs.cs
- ErrorHandlerModule.cs
- EntityDataSourceDataSelection.cs
- Knowncolors.cs
- RenderDataDrawingContext.cs
- ApplyTemplatesAction.cs
- MenuTracker.cs
- ListItemCollection.cs
- UserPreferenceChangingEventArgs.cs
- OverflowException.cs
- FontUnit.cs
- ParameterModifier.cs
- HyperLink.cs
- DesignerOptionService.cs
- TextSelectionHelper.cs
- AuthenticationModulesSection.cs
- QueueProcessor.cs
- DefaultDiscoveryServiceExtension.cs
- VirtualizingStackPanel.cs
- TextRangeSerialization.cs
- DeferredElementTreeState.cs
- ClientBuildManager.cs
- XmlTextWriter.cs
- BrowserDefinition.cs
- PrivilegeNotHeldException.cs
- SystemTcpStatistics.cs
- WindowClosedEventArgs.cs
- TypeElement.cs
- DebugView.cs
- HttpCachePolicy.cs
- Terminate.cs
- DataGridViewCellStyleConverter.cs
- TreeNodeCollection.cs
- WasEndpointConfigContainer.cs
- XmlChoiceIdentifierAttribute.cs
- FontUnitConverter.cs
- errorpatternmatcher.cs
- BorderGapMaskConverter.cs
- SelectionItemProviderWrapper.cs
- ChangeProcessor.cs
- LineVisual.cs
- HebrewCalendar.cs
- EventSetter.cs
- MemoryMappedFile.cs
- AnimationStorage.cs
- LayoutEvent.cs
- LookupNode.cs
- BooleanToVisibilityConverter.cs
- DoubleAnimationClockResource.cs
- StreamResourceInfo.cs
- ISFTagAndGuidCache.cs
- ReferenceSchema.cs
- TcpConnectionPoolSettingsElement.cs
- SortDescriptionCollection.cs
- DiscoveryClientChannelBase.cs
- ProjectionRewriter.cs
- WindowsFormsLinkLabel.cs
- MediaElement.cs
- StoreAnnotationsMap.cs
- XPathBinder.cs
- HtmlFormParameterReader.cs
- DynamicMetaObjectBinder.cs
- ListViewDesigner.cs
- DialogResultConverter.cs
- StylusShape.cs
- TextParaLineResult.cs
- SmiContextFactory.cs
- PKCS1MaskGenerationMethod.cs
- SizeValueSerializer.cs
- UInt32Converter.cs
- XmlDomTextWriter.cs
- InputLanguageProfileNotifySink.cs
- StringReader.cs
- BitmapDecoder.cs
- OdbcParameterCollection.cs
- SystemIPAddressInformation.cs
- CalculatedColumn.cs
- RequestValidator.cs
- CheckBoxField.cs
- ExpressionPrinter.cs
- FastPropertyAccessor.cs
- CopyAttributesAction.cs
- safex509handles.cs
- ArcSegment.cs
- SystemDropShadowChrome.cs
- RestClientProxyHandler.cs
- DoubleConverter.cs
- UpdateTranslator.cs
- MsmqOutputSessionChannel.cs
- CellConstant.cs
- HtmlTitle.cs
- OracleInternalConnection.cs
- documentation.cs