Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- HtmlImageAdapter.cs
- ConfigurationLockCollection.cs
- ResetableIterator.cs
- AppDomainShutdownMonitor.cs
- DocumentCollection.cs
- CommandBinding.cs
- FrameworkElementFactory.cs
- IsolatedStorageFile.cs
- NativeMethods.cs
- DataTable.cs
- DbUpdateCommandTree.cs
- TypedElement.cs
- ThreadExceptionDialog.cs
- WindowsListViewGroup.cs
- FormViewPageEventArgs.cs
- BitmapMetadata.cs
- ImportContext.cs
- SingleKeyFrameCollection.cs
- TextPointer.cs
- PerformanceCounterCategory.cs
- KeyValueConfigurationElement.cs
- Attributes.cs
- AVElementHelper.cs
- MasterPageCodeDomTreeGenerator.cs
- StringUtil.cs
- TempFiles.cs
- uribuilder.cs
- Error.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- SqlProviderManifest.cs
- SymbolType.cs
- SystemResourceKey.cs
- AsymmetricKeyExchangeFormatter.cs
- ProtocolViolationException.cs
- SiteMapNodeCollection.cs
- SecurityException.cs
- Crc32.cs
- StoreItemCollection.Loader.cs
- PointHitTestParameters.cs
- WindowsListViewItemCheckBox.cs
- XamlBrushSerializer.cs
- AttachedPropertyBrowsableAttribute.cs
- CompositeTypefaceMetrics.cs
- MatrixKeyFrameCollection.cs
- WebBrowserUriTypeConverter.cs
- AssemblyFilter.cs
- TreeNodeCollection.cs
- SqlLiftWhereClauses.cs
- MimeTypeMapper.cs
- SchemaCollectionPreprocessor.cs
- DataBindingExpressionBuilder.cs
- PropertyGridEditorPart.cs
- RepeaterItemEventArgs.cs
- VideoDrawing.cs
- WeakRefEnumerator.cs
- DeleteMemberBinder.cs
- ResourceWriter.cs
- ObjectAnimationBase.cs
- ProviderException.cs
- Atom10FeedFormatter.cs
- OrderingInfo.cs
- ProgressPage.cs
- HttpRequestCacheValidator.cs
- XmlSchemaGroupRef.cs
- ResolveNameEventArgs.cs
- TextElementEnumerator.cs
- BindingContext.cs
- ClientRolePrincipal.cs
- LifetimeServices.cs
- TextTreeUndoUnit.cs
- ADConnectionHelper.cs
- WindowsStartMenu.cs
- HttpRuntimeSection.cs
- ListDataHelper.cs
- HotSpotCollection.cs
- ElementHost.cs
- BamlCollectionHolder.cs
- TcpConnectionPool.cs
- SecurityChannelListener.cs
- CompositeControl.cs
- SystemInfo.cs
- RouteParametersHelper.cs
- AppDomainManager.cs
- Util.cs
- mongolianshape.cs
- ColumnWidthChangingEvent.cs
- WindowsHyperlink.cs
- XmlSignatureProperties.cs
- NavigatorInput.cs
- Mappings.cs
- XmlParserContext.cs
- FontEmbeddingManager.cs
- SettingsProviderCollection.cs
- BitmapFrameEncode.cs
- EnumerableRowCollection.cs
- MemberAssignment.cs
- ObjectDataSourceDesigner.cs
- DesignerHelpers.cs
- HashCryptoHandle.cs
- GridViewRowCollection.cs