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
- ResizeBehavior.cs
- Activator.cs
- GroupQuery.cs
- LineSegment.cs
- SiteMapSection.cs
- ApplicationId.cs
- CommandManager.cs
- SequentialOutput.cs
- TypeUnloadedException.cs
- StructuralObject.cs
- DbRetry.cs
- StrokeCollectionDefaultValueFactory.cs
- SessionStateItemCollection.cs
- LinkButton.cs
- RegexWorker.cs
- WebBrowsableAttribute.cs
- FloaterParagraph.cs
- MetabaseSettings.cs
- HttpApplication.cs
- DataGridViewRowPostPaintEventArgs.cs
- TranslateTransform3D.cs
- SourceFileBuildProvider.cs
- MatrixKeyFrameCollection.cs
- PropertyInformationCollection.cs
- PropertyPath.cs
- unsafenativemethodsother.cs
- MasterPage.cs
- SimpleType.cs
- MessageFormatterConverter.cs
- AnnotationComponentManager.cs
- RoutedCommand.cs
- DesignerDataRelationship.cs
- ThrowOnMultipleAssignment.cs
- TokenizerHelper.cs
- EventsTab.cs
- GlyphingCache.cs
- OdbcCommandBuilder.cs
- Accessible.cs
- DataSourceView.cs
- WebRequestModuleElementCollection.cs
- BindingsCollection.cs
- OnOperation.cs
- CfgParser.cs
- SessionStateModule.cs
- VariantWrapper.cs
- InputReport.cs
- DeviceFiltersSection.cs
- SamlAssertionKeyIdentifierClause.cs
- DisplayInformation.cs
- TransformPattern.cs
- MsdtcWrapper.cs
- HttpClientCertificate.cs
- SqlBulkCopyColumnMappingCollection.cs
- FontStretch.cs
- ArgumentDirectionHelper.cs
- MDIControlStrip.cs
- RouteCollection.cs
- ImageBrush.cs
- DataServiceQueryOfT.cs
- MenuBase.cs
- Missing.cs
- ListControlConvertEventArgs.cs
- DateTimeFormatInfo.cs
- Int16.cs
- XmlSchema.cs
- EntityContainer.cs
- GeneralTransform3D.cs
- ObjectComplexPropertyMapping.cs
- ReferenceSchema.cs
- DataGridLinkButton.cs
- ComponentSerializationService.cs
- HttpRuntimeSection.cs
- InvokeMethodActivityDesigner.cs
- QuerySafeNavigator.cs
- DeploymentSection.cs
- TreeNodeClickEventArgs.cs
- WindowsListViewGroupHelper.cs
- ColorMap.cs
- Rules.cs
- SessionSymmetricTransportSecurityProtocolFactory.cs
- DirectoryObjectSecurity.cs
- VirtualPathProvider.cs
- _SslSessionsCache.cs
- PolygonHotSpot.cs
- DBParameter.cs
- OleServicesContext.cs
- __TransparentProxy.cs
- StylusCollection.cs
- CompositeDataBoundControl.cs
- VectorConverter.cs
- localization.cs
- MimePart.cs
- PublishLicense.cs
- WebPartsPersonalizationAuthorization.cs
- ContextMenuAutomationPeer.cs
- XDeferredAxisSource.cs
- HtmlInputHidden.cs
- TranslateTransform3D.cs
- IconBitmapDecoder.cs
- MailWriter.cs