Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- SubMenuStyleCollection.cs
- DocumentOrderComparer.cs
- BadImageFormatException.cs
- XmlSchemaElement.cs
- dbdatarecord.cs
- FileFormatException.cs
- FolderBrowserDialog.cs
- RuleCache.cs
- ActivityBindForm.Designer.cs
- HttpBufferlessInputStream.cs
- Attributes.cs
- WebPartZoneBase.cs
- UrlUtility.cs
- SignerInfo.cs
- SqlConnectionHelper.cs
- StructureChangedEventArgs.cs
- SpecialFolderEnumConverter.cs
- RedBlackList.cs
- HuffModule.cs
- SettingsPropertyWrongTypeException.cs
- CustomServiceCredentials.cs
- View.cs
- IisTraceWebEventProvider.cs
- DispatcherProcessingDisabled.cs
- MetabaseSettingsIis7.cs
- codemethodreferenceexpression.cs
- ViewCellSlot.cs
- CompModSwitches.cs
- HttpApplicationFactory.cs
- Win32Native.cs
- DataRecordInternal.cs
- SoapIgnoreAttribute.cs
- TrackingCondition.cs
- Shape.cs
- LockCookie.cs
- ActionNotSupportedException.cs
- DesignTimeParseData.cs
- SchemaImporterExtensionsSection.cs
- PageContentCollection.cs
- SQLString.cs
- PropertyDescriptors.cs
- TrackingServices.cs
- ListViewGroupConverter.cs
- NavigationHelper.cs
- DataBindingHandlerAttribute.cs
- ThousandthOfEmRealPoints.cs
- Menu.cs
- followingsibling.cs
- SettingsPropertyNotFoundException.cs
- ByteAnimation.cs
- WebBrowserNavigatingEventHandler.cs
- FormatException.cs
- TextElement.cs
- DataServiceStreamProviderWrapper.cs
- Internal.cs
- PageParser.cs
- DataStreamFromComStream.cs
- ActivityTypeDesigner.xaml.cs
- ParserContext.cs
- ButtonColumn.cs
- CalendarBlackoutDatesCollection.cs
- RotateTransform.cs
- ChunkedMemoryStream.cs
- ImageSourceValueSerializer.cs
- IDQuery.cs
- CallSiteBinder.cs
- XPathScanner.cs
- DetailsViewModeEventArgs.cs
- TextTabProperties.cs
- ToolStripPanel.cs
- ArgumentNullException.cs
- HierarchicalDataSourceControl.cs
- ImportCatalogPart.cs
- TextWriter.cs
- LineBreakRecord.cs
- Padding.cs
- Random.cs
- FlowDocumentReaderAutomationPeer.cs
- SystemDiagnosticsSection.cs
- OpCellTreeNode.cs
- RectAnimationUsingKeyFrames.cs
- SqlError.cs
- CollectionChangeEventArgs.cs
- safemediahandle.cs
- InstallerTypeAttribute.cs
- TransportConfigurationTypeElement.cs
- _AuthenticationState.cs
- XmlLinkedNode.cs
- WebPartConnection.cs
- DrawTreeNodeEventArgs.cs
- ClientConfigurationSystem.cs
- SmiEventSink_DeferedProcessing.cs
- MatrixTransform3D.cs
- Msec.cs
- ConfigXmlComment.cs
- AbstractExpressions.cs
- PagesSection.cs
- OledbConnectionStringbuilder.cs
- PointAnimationBase.cs
- Track.cs