Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Data / System / NewXml / TreeIterator.cs / 1 / TreeIterator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Xml { using System; using System.Data; using System.Diagnostics; // Iterates over non-attribute nodes internal sealed class TreeIterator : BaseTreeIterator { private XmlNode nodeTop; private XmlNode currentNode; internal TreeIterator( XmlNode nodeTop ) : base( ((XmlDataDocument)(nodeTop.OwnerDocument)).Mapper ) { Debug.Assert( nodeTop != null ); this.nodeTop = nodeTop; this.currentNode = nodeTop; } internal override void Reset() { currentNode = nodeTop; } internal override XmlNode CurrentNode { get { return currentNode; } } internal override bool Next() { XmlNode nextNode; // Try to move to the first child nextNode = currentNode.FirstChild; // No children, try next sibling if ( nextNode != null ) { currentNode = nextNode; return true; } return NextRight(); } internal override bool NextRight() { // Make sure we do not get past the nodeTop if we call NextRight on a just initialized iterator and nodeTop has no children if ( currentNode == nodeTop ) { currentNode = null; return false; } XmlNode nextNode = currentNode.NextSibling; if ( nextNode != null ) { currentNode = nextNode; return true; } // No next sibling, try the first sibling of from the parent chain nextNode = currentNode; while ( nextNode != nodeTop && nextNode.NextSibling == null ) nextNode = nextNode.ParentNode; if ( nextNode == nodeTop ) { currentNode = null; return false; } currentNode = nextNode.NextSibling; Debug.Assert( currentNode != null ); return true; } } } // 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
- BitmapEffectGroup.cs
- DeflateStream.cs
- KnownBoxes.cs
- RemoteWebConfigurationHostServer.cs
- SettingsPropertyNotFoundException.cs
- DuplexChannel.cs
- EmbeddedMailObjectCollectionEditor.cs
- ObjectStateManagerMetadata.cs
- DataGridViewCellConverter.cs
- MessageEnumerator.cs
- CommonGetThemePartSize.cs
- DataGridRow.cs
- ProxyWebPart.cs
- RNGCryptoServiceProvider.cs
- UnsafeNativeMethods.cs
- WebRequestModulesSection.cs
- HttpCapabilitiesBase.cs
- pingexception.cs
- ColorTransform.cs
- OleDbDataAdapter.cs
- PropertyStore.cs
- GlyphRunDrawing.cs
- DateTimeParse.cs
- ConvertEvent.cs
- WsatConfiguration.cs
- SettingsBase.cs
- WeakReferenceList.cs
- StatusBar.cs
- SrgsDocumentParser.cs
- SHA1.cs
- MouseGestureValueSerializer.cs
- Point4DValueSerializer.cs
- AccessedThroughPropertyAttribute.cs
- HandleCollector.cs
- AuthenticationModulesSection.cs
- PropertyInfo.cs
- XPathAncestorIterator.cs
- RegexGroupCollection.cs
- OpCodes.cs
- OleServicesContext.cs
- ApplicationSecurityInfo.cs
- RowsCopiedEventArgs.cs
- AttributeCollection.cs
- SoapProtocolReflector.cs
- ImageListDesigner.cs
- UriWriter.cs
- EntitySqlQueryCacheKey.cs
- ReferenceService.cs
- DataGridViewRowsAddedEventArgs.cs
- SamlAssertionDirectKeyIdentifierClause.cs
- CommonObjectSecurity.cs
- UserNameSecurityToken.cs
- DelayedRegex.cs
- XmlSchemaImport.cs
- DbReferenceCollection.cs
- DiscoveryDocumentSerializer.cs
- Geometry3D.cs
- RtfToken.cs
- BindToObject.cs
- WebPartConnectionsDisconnectVerb.cs
- ProfileGroupSettingsCollection.cs
- ADMembershipUser.cs
- AgileSafeNativeMemoryHandle.cs
- StylusPlugin.cs
- ClientTarget.cs
- X509ServiceCertificateAuthenticationElement.cs
- PixelShader.cs
- ConfigurationSectionGroupCollection.cs
- NavigationProperty.cs
- CodeDomSerializerException.cs
- HtmlEmptyTagControlBuilder.cs
- IssuedTokenParametersElement.cs
- WebPartManager.cs
- XmlSiteMapProvider.cs
- ExtensionSimplifierMarkupObject.cs
- hresults.cs
- WasAdminWrapper.cs
- DateTimeFormatInfo.cs
- BlockCollection.cs
- WinFormsSpinner.cs
- PlaceHolder.cs
- ContextMenuStripGroup.cs
- HtmlElementErrorEventArgs.cs
- ScrollBar.cs
- BufferedGraphics.cs
- TransformProviderWrapper.cs
- Point3DIndependentAnimationStorage.cs
- ImageIndexConverter.cs
- OleDbException.cs
- PersistChildrenAttribute.cs
- XPathConvert.cs
- EventEntry.cs
- CatalogPartCollection.cs
- PtsContext.cs
- ParameterCollection.cs
- BookmarkUndoUnit.cs
- DataRowExtensions.cs
- ipaddressinformationcollection.cs
- AnimationException.cs
- PrinterUnitConvert.cs