Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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. // //[....] //[....] //[....] //----------------------------------------------------------------------------- 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProxyHwnd.cs
- X509AsymmetricSecurityKey.cs
- TextRenderer.cs
- StringCollectionMarkupSerializer.cs
- ErasingStroke.cs
- X509CertificateTrustedIssuerElementCollection.cs
- StrokeRenderer.cs
- CngAlgorithm.cs
- UIElementCollection.cs
- NativeMethodsCLR.cs
- XpsFont.cs
- SqlBinder.cs
- WebHttpBinding.cs
- TargetControlTypeAttribute.cs
- EventProviderWriter.cs
- ResponseBodyWriter.cs
- RectKeyFrameCollection.cs
- ParameterElement.cs
- ScrollProperties.cs
- StatusStrip.cs
- ImageBrush.cs
- DataGridViewRowEventArgs.cs
- ColumnTypeConverter.cs
- ObjectDataSourceSelectingEventArgs.cs
- TimeSpanSecondsConverter.cs
- UIElement.cs
- Transform3D.cs
- EncoderNLS.cs
- ServicePoint.cs
- AccessText.cs
- ImageDrawing.cs
- X509WindowsSecurityToken.cs
- XhtmlConformanceSection.cs
- BeginCreateSecurityTokenRequest.cs
- InternalCache.cs
- AuthenticationService.cs
- ACL.cs
- MembershipValidatePasswordEventArgs.cs
- WCFBuildProvider.cs
- ExpressionNode.cs
- UrlRoutingModule.cs
- UrlParameterWriter.cs
- BuildProvider.cs
- WSFederationHttpSecurityMode.cs
- SamlSerializer.cs
- SoapUnknownHeader.cs
- ProxyWebPartConnectionCollection.cs
- DPTypeDescriptorContext.cs
- DbConnectionPoolOptions.cs
- ObjectTypeMapping.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- RoutedPropertyChangedEventArgs.cs
- RowUpdatedEventArgs.cs
- RequiredFieldValidator.cs
- MembershipSection.cs
- Camera.cs
- ContainsRowNumberChecker.cs
- Filter.cs
- StatusBarPanelClickEvent.cs
- ConnectionStringsExpressionBuilder.cs
- ResourcePart.cs
- EntityDataSourceChangedEventArgs.cs
- TickBar.cs
- DataSourceHelper.cs
- PageRequestManager.cs
- WinEventHandler.cs
- MsmqMessageSerializationFormat.cs
- ValidationSummary.cs
- MarshalDirectiveException.cs
- WebExceptionStatus.cs
- GlobalAllocSafeHandle.cs
- DefaultAsyncDataDispatcher.cs
- TextServicesManager.cs
- ClientViaElement.cs
- Point3DAnimationBase.cs
- EventBuilder.cs
- CallbackValidator.cs
- Table.cs
- ExecutionEngineException.cs
- SqlDataAdapter.cs
- CommandDesigner.cs
- WmlLinkAdapter.cs
- XmlSchemaDocumentation.cs
- XmlAnyElementAttributes.cs
- RemotingSurrogateSelector.cs
- WinEventHandler.cs
- ItemsChangedEventArgs.cs
- XPathMessageFilterTable.cs
- TextSegment.cs
- MetadataItemSerializer.cs
- RijndaelCryptoServiceProvider.cs
- DataControlPagerLinkButton.cs
- TransportDefaults.cs
- HyperLinkColumn.cs
- ChangePasswordDesigner.cs
- ProcessHostServerConfig.cs
- Rule.cs
- CustomError.cs
- PeerNameResolver.cs
- XmlDocumentFragment.cs