Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / DescendantOverDescendantQuery.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Executor.cs
- AlgoModule.cs
- FlowLayoutPanel.cs
- altserialization.cs
- SafeMILHandle.cs
- TrustManagerMoreInformation.cs
- FormsAuthentication.cs
- Region.cs
- safemediahandle.cs
- HttpCookiesSection.cs
- ContextDataSourceContextData.cs
- WindowsFormsHostAutomationPeer.cs
- DeclarativeCatalogPart.cs
- RIPEMD160Managed.cs
- Point3DCollectionConverter.cs
- InvalidPipelineStoreException.cs
- MetadataHelper.cs
- EmptyReadOnlyDictionaryInternal.cs
- RoleGroup.cs
- ComponentDesigner.cs
- DataBindingExpressionBuilder.cs
- RootBrowserWindow.cs
- securitycriticaldataformultiplegetandset.cs
- BinaryNode.cs
- CursorConverter.cs
- BinaryCommonClasses.cs
- ToolStripDropDownClosedEventArgs.cs
- EnvelopeVersion.cs
- MsmqVerifier.cs
- ParallelTimeline.cs
- NotSupportedException.cs
- initElementDictionary.cs
- VerificationAttribute.cs
- ParameterCollection.cs
- PackageFilter.cs
- AspCompat.cs
- PrintPreviewControl.cs
- counter.cs
- XmlLanguage.cs
- RenderingBiasValidation.cs
- AsyncPostBackTrigger.cs
- SQLString.cs
- PageFunction.cs
- LocalServiceSecuritySettings.cs
- ColorConverter.cs
- ConfigXmlSignificantWhitespace.cs
- WindowsGraphics.cs
- DbDataRecord.cs
- ObfuscationAttribute.cs
- BitmapEffectInputData.cs
- DesignTimeParseData.cs
- GlyphRun.cs
- LOSFormatter.cs
- DataGridViewCellStyleEditor.cs
- DataGridGeneralPage.cs
- GridViewRowEventArgs.cs
- ToolboxComponentsCreatedEventArgs.cs
- HttpProxyCredentialType.cs
- InvalidDataContractException.cs
- DrawListViewColumnHeaderEventArgs.cs
- TimelineGroup.cs
- ItemChangedEventArgs.cs
- PropertyMappingExceptionEventArgs.cs
- SafeTimerHandle.cs
- SQLByteStorage.cs
- assemblycache.cs
- UserMapPath.cs
- ManifestSignatureInformation.cs
- Configuration.cs
- VerticalAlignConverter.cs
- EntitySetBase.cs
- KeyInterop.cs
- DbProviderServices.cs
- StreamInfo.cs
- TdsValueSetter.cs
- ControlCollection.cs
- TemplateKey.cs
- DataGridAutomationPeer.cs
- Base64Decoder.cs
- ReachIDocumentPaginatorSerializerAsync.cs
- Interlocked.cs
- ColumnClickEvent.cs
- AdCreatedEventArgs.cs
- SourceChangedEventArgs.cs
- FileDialog.cs
- ApplicationException.cs
- QilReplaceVisitor.cs
- OptionUsage.cs
- UnsafeNativeMethods.cs
- BitStack.cs
- LinqDataSourceContextEventArgs.cs
- SqlMetaData.cs
- SoapEnvelopeProcessingElement.cs
- backend.cs
- CatalogZone.cs
- ThemeableAttribute.cs
- IssuanceTokenProviderState.cs
- XmlILTrace.cs
- ImageButton.cs
- InvokeMethodDesigner.xaml.cs