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
- GuidelineSet.cs
- WeakReferenceEnumerator.cs
- SessionEndingEventArgs.cs
- CodeBlockBuilder.cs
- TrackBar.cs
- Rights.cs
- peernodeimplementation.cs
- SmuggledIUnknown.cs
- MediaPlayerState.cs
- Restrictions.cs
- DrawingAttributesDefaultValueFactory.cs
- Page.cs
- XmlElementAttributes.cs
- CryptoApi.cs
- AuthenticationModuleElementCollection.cs
- SqlDataSourceDesigner.cs
- BuildResult.cs
- SafeFileMappingHandle.cs
- Calendar.cs
- DesignerDataParameter.cs
- updatecommandorderer.cs
- StylusPoint.cs
- HttpRequestCacheValidator.cs
- BindingBase.cs
- GradientBrush.cs
- IApplicationTrustManager.cs
- LayoutExceptionEventArgs.cs
- RightsManagementInformation.cs
- AssemblyInfo.cs
- RoleManagerSection.cs
- BezierSegment.cs
- CollectionViewGroupRoot.cs
- ModuleBuilder.cs
- EncryptedKey.cs
- PropertyTab.cs
- BasicCommandTreeVisitor.cs
- CodeAttributeDeclarationCollection.cs
- WpfPayload.cs
- RoleGroupCollection.cs
- Triplet.cs
- SrgsSemanticInterpretationTag.cs
- HandledMouseEvent.cs
- Win32PrintDialog.cs
- OverrideMode.cs
- OpenFileDialog.cs
- FacetDescription.cs
- EntityContainer.cs
- StylusPlugInCollection.cs
- ReflectTypeDescriptionProvider.cs
- SoapElementAttribute.cs
- MetadataUtilsSmi.cs
- Hex.cs
- DataServiceQuery.cs
- CSharpCodeProvider.cs
- SignatureToken.cs
- PathParser.cs
- DirectionalLight.cs
- ObjectAssociationEndMapping.cs
- ToolStripItemCollection.cs
- SqlBulkCopyColumnMapping.cs
- QueryRewriter.cs
- SponsorHelper.cs
- FlowDocumentReaderAutomationPeer.cs
- Attributes.cs
- ClientOperationFormatterProvider.cs
- WebErrorHandler.cs
- TypeLibConverter.cs
- SelectiveScrollingGrid.cs
- StatusStrip.cs
- SqlPersonalizationProvider.cs
- FromRequest.cs
- HebrewCalendar.cs
- XsltFunctions.cs
- RadioButtonFlatAdapter.cs
- SkewTransform.cs
- ProxyWebPartManagerDesigner.cs
- AudioException.cs
- DataServiceClientException.cs
- EncoderBestFitFallback.cs
- FirstQueryOperator.cs
- DuplicateWaitObjectException.cs
- PageBuildProvider.cs
- DataDocumentXPathNavigator.cs
- HttpListener.cs
- WebPartVerb.cs
- DataGridItemEventArgs.cs
- WindowsSidIdentity.cs
- ColorContext.cs
- ServiceBusyException.cs
- DigestComparer.cs
- TextEditorSpelling.cs
- StrongNameMembershipCondition.cs
- DesignerAttribute.cs
- EventNotify.cs
- PointLightBase.cs
- MimeMapping.cs
- EmptyStringExpandableObjectConverter.cs
- TreeWalkHelper.cs
- HtmlInputCheckBox.cs
- InputLanguageCollection.cs