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
- ColorMatrix.cs
- NativeMethods.cs
- HelpInfo.cs
- HtmlInputCheckBox.cs
- PartialArray.cs
- ObjectAssociationEndMapping.cs
- SqlProfileProvider.cs
- DecimalConstantAttribute.cs
- Int32.cs
- LayoutEvent.cs
- NavigatorInvalidBodyAccessException.cs
- PlatformNotSupportedException.cs
- _LoggingObject.cs
- AnnotationDocumentPaginator.cs
- UTF32Encoding.cs
- CheckBoxField.cs
- DistributedTransactionPermission.cs
- OptionalMessageQuery.cs
- CodeCommentStatementCollection.cs
- PropertyBuilder.cs
- TraceContext.cs
- UndirectedGraph.cs
- MaterialGroup.cs
- SetterBase.cs
- Vector3DIndependentAnimationStorage.cs
- ListControlConvertEventArgs.cs
- EndpointDiscoveryMetadata.cs
- AsymmetricKeyExchangeDeformatter.cs
- BamlWriter.cs
- SourceFilter.cs
- ResourceBinder.cs
- Vector3dCollection.cs
- SerializationInfoEnumerator.cs
- ConfigXmlReader.cs
- EntityDataSourceChangingEventArgs.cs
- UIPermission.cs
- DurableTimerExtension.cs
- UnicodeEncoding.cs
- AppSecurityManager.cs
- EncoderParameter.cs
- EllipticalNodeOperations.cs
- TrackingProfile.cs
- StandardBindingOptionalReliableSessionElement.cs
- CapiHashAlgorithm.cs
- FilterableAttribute.cs
- PixelFormatConverter.cs
- SafeEventHandle.cs
- DependencyPropertyKind.cs
- GenerateHelper.cs
- Image.cs
- UserThread.cs
- CodeIdentifiers.cs
- XmlSchemaComplexContentExtension.cs
- WorkflowRuntimeServiceElementCollection.cs
- ToolStripLabel.cs
- DataGridViewSelectedCellCollection.cs
- BaseCollection.cs
- LocatorBase.cs
- PropertyGeneratedEventArgs.cs
- CompilationLock.cs
- EdmSchemaError.cs
- cookie.cs
- HttpCacheParams.cs
- ThemeConfigurationDialog.cs
- HtmlInputControl.cs
- CachedBitmap.cs
- Effect.cs
- LambdaExpression.cs
- SHA384CryptoServiceProvider.cs
- StrongNamePublicKeyBlob.cs
- ByteViewer.cs
- GridItem.cs
- remotingproxy.cs
- Currency.cs
- LocalizabilityAttribute.cs
- StorageScalarPropertyMapping.cs
- DefaultEventAttribute.cs
- ISO2022Encoding.cs
- NullReferenceException.cs
- HtmlAnchor.cs
- QilUnary.cs
- RIPEMD160.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- PrtTicket_Editor.cs
- ResourcePermissionBase.cs
- TripleDESCryptoServiceProvider.cs
- KoreanLunisolarCalendar.cs
- InputMethodStateChangeEventArgs.cs
- ValidationEventArgs.cs
- SmtpMail.cs
- ConfigViewGenerator.cs
- Geometry3D.cs
- PropertyEmitter.cs
- UntypedNullExpression.cs
- Token.cs
- JsonQNameDataContract.cs
- DragDeltaEventArgs.cs
- ScrollableControlDesigner.cs
- TreeNodeCollection.cs
- StorageMappingItemLoader.cs