Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / Xml / System / Xml / XPath / Internal / DescendantOverDescendantQuery.cs / 1 / DescendantOverDescendantQuery.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; // DescendantOverDescendantQuery: for each input it looks for the topmost descendents that matches to ns:name // This is posible when query which has this query as its input (child query) is descendent as well. // Work of this query doesn't depend on DOD of its input. // It doesn't garate DOD of the output even when input is DOD. internal sealed class DescendantOverDescendantQuery : DescendantBaseQuery { private int level = 0; public DescendantOverDescendantQuery(Query qyParent, bool matchSelf, string name, string prefix, XPathNodeType typeTest, bool abbrAxis) : base(qyParent, name, prefix, typeTest, matchSelf, abbrAxis) {} private DescendantOverDescendantQuery(DescendantOverDescendantQuery other) : base(other) { this.level = other.level; } public override void Reset() { level = 0; base.Reset(); } public override XPathNavigator Advance() { while (true) { if (level == 0) { currentNode = qyInput.Advance(); position = 0; if (currentNode == null) { return null; } if (matchSelf && matches(currentNode)) { position = 1; return currentNode; } currentNode = currentNode.Clone(); if (! MoveToFirstChild()) { continue; } } else { if (!MoveUpUntillNext()) { continue; } } do { if (matches(currentNode)) { position++; return currentNode; } } while (MoveToFirstChild()); } } private bool MoveToFirstChild() { if (currentNode.MoveToFirstChild()) { level++; return true; } return false; } private bool MoveUpUntillNext() { // move up untill we can move next while (! currentNode.MoveToNext()) { -- level; if (level == 0) { return false; } bool result = currentNode.MoveToParent(); Debug.Assert(result, "Algorithm error, We always should be able to move up if level > 0"); } return true; } public override XPathNodeIterator Clone() { return new DescendantOverDescendantQuery(this); } } } // 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
- ReferentialConstraint.cs
- EditorBrowsableAttribute.cs
- HttpCachePolicyElement.cs
- DataServiceConfiguration.cs
- IgnoreSection.cs
- DBPropSet.cs
- Rectangle.cs
- RelatedCurrencyManager.cs
- X509SecurityTokenProvider.cs
- SchemaInfo.cs
- ReadOnlyDataSource.cs
- OpCodes.cs
- ThrowHelper.cs
- AnchoredBlock.cs
- DeclaredTypeElementCollection.cs
- CellTreeNode.cs
- TdsParserStaticMethods.cs
- DataGridViewSelectedCellCollection.cs
- ButtonBase.cs
- XPathParser.cs
- Point3DConverter.cs
- GridSplitter.cs
- COM2FontConverter.cs
- SurrogateEncoder.cs
- DocumentCollection.cs
- UnsafeNativeMethods.cs
- XmlDocumentSurrogate.cs
- PreviewPrintController.cs
- ContentPosition.cs
- WmiEventSink.cs
- AsyncCompletedEventArgs.cs
- PopupRootAutomationPeer.cs
- SchemaMapping.cs
- AspNetPartialTrustHelpers.cs
- IncrementalReadDecoders.cs
- ContextMenuService.cs
- SmtpNetworkElement.cs
- ListView.cs
- ContextStack.cs
- SharedUtils.cs
- DataGridViewUtilities.cs
- BuildManagerHost.cs
- PkcsMisc.cs
- SerializationAttributes.cs
- SrgsElementFactory.cs
- InfoCardKeyedHashAlgorithm.cs
- MetafileHeader.cs
- TextSerializer.cs
- ImageCollectionEditor.cs
- ComponentGuaranteesAttribute.cs
- XmlSchemaValidator.cs
- Select.cs
- ObfuscationAttribute.cs
- ChildTable.cs
- BrushConverter.cs
- MenuStrip.cs
- RichTextBoxConstants.cs
- UnicodeEncoding.cs
- ImageClickEventArgs.cs
- DataGridViewAutoSizeModeEventArgs.cs
- PenContext.cs
- FrameworkElement.cs
- MemberNameValidator.cs
- BufferBuilder.cs
- DropDownList.cs
- DropDownList.cs
- ObjectStateFormatter.cs
- GiveFeedbackEventArgs.cs
- RectangleGeometry.cs
- NamespaceListProperty.cs
- GridViewColumnHeaderAutomationPeer.cs
- ImportContext.cs
- FontDriver.cs
- DataGridRowEventArgs.cs
- SelectionProviderWrapper.cs
- lengthconverter.cs
- Selector.cs
- FilterElement.cs
- AuthStoreRoleProvider.cs
- METAHEADER.cs
- contentDescriptor.cs
- WinFormsSecurity.cs
- ObjectDataSourceWizardForm.cs
- DeobfuscatingStream.cs
- SqlDataRecord.cs
- ListBox.cs
- SyndicationDeserializer.cs
- LoggedException.cs
- GenericQueueSurrogate.cs
- OracleDataReader.cs
- FindCriteriaCD1.cs
- ObjectListCommandEventArgs.cs
- XmlStreamStore.cs
- ExpandableObjectConverter.cs
- InternalConfigEventArgs.cs
- OdbcConnectionHandle.cs
- OutgoingWebResponseContext.cs
- COM2ExtendedUITypeEditor.cs
- CustomAttributeFormatException.cs
- BaseContextMenu.cs