Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Data / System / NewXml / TreeIterator.cs / 1305376 / TreeIterator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- #pragma warning disable 618 // ignore obsolete warning about XmlDataDocument namespace System.Xml { 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. // //[....] //[....] //----------------------------------------------------------------------------- #pragma warning disable 618 // ignore obsolete warning about XmlDataDocument namespace System.Xml { 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
- TextServicesDisplayAttribute.cs
- SortableBindingList.cs
- EventlogProvider.cs
- WrappedDispatcherException.cs
- Profiler.cs
- MultitargetUtil.cs
- CategoryList.cs
- UIElement3D.cs
- WmlLabelAdapter.cs
- MainMenu.cs
- WebEventTraceProvider.cs
- TypefaceCollection.cs
- X509CertificateClaimSet.cs
- AssociativeAggregationOperator.cs
- DbParameterCollectionHelper.cs
- ZoneLinkButton.cs
- ReceiveActivityValidator.cs
- AnchoredBlock.cs
- Int16AnimationBase.cs
- TabControlCancelEvent.cs
- RpcResponse.cs
- SqlDesignerDataSourceView.cs
- AncestorChangedEventArgs.cs
- ComIntegrationManifestGenerator.cs
- ButtonFlatAdapter.cs
- View.cs
- ScriptServiceAttribute.cs
- ExpressionUtilities.cs
- SplitterEvent.cs
- Visual3D.cs
- _OverlappedAsyncResult.cs
- OnOperation.cs
- LayoutTableCell.cs
- WinEventWrap.cs
- InstanceContextMode.cs
- VarInfo.cs
- AtomMaterializerLog.cs
- DefaultMemberAttribute.cs
- FilePresentation.cs
- UInt64Storage.cs
- AsymmetricKeyExchangeFormatter.cs
- FormViewDeletedEventArgs.cs
- CSharpCodeProvider.cs
- Vector3DCollection.cs
- DataRecordInternal.cs
- HyperLinkDataBindingHandler.cs
- SqlUserDefinedTypeAttribute.cs
- TransportOutputChannel.cs
- OrderPreservingPipeliningSpoolingTask.cs
- SystemIPAddressInformation.cs
- _HTTPDateParse.cs
- NonVisualControlAttribute.cs
- DoubleCollectionConverter.cs
- BidPrivateBase.cs
- TitleStyle.cs
- PingReply.cs
- SessionStateUtil.cs
- NativeWindow.cs
- ToolBarButtonClickEvent.cs
- safelinkcollection.cs
- Compiler.cs
- SerializationSectionGroup.cs
- DataSourceProvider.cs
- SiteMapPath.cs
- LifetimeServices.cs
- FieldAccessException.cs
- PageRouteHandler.cs
- TreeNode.cs
- KoreanCalendar.cs
- XamlSerializerUtil.cs
- Tile.cs
- SqlRewriteScalarSubqueries.cs
- CorrelationResolver.cs
- Point.cs
- LogSwitch.cs
- TouchesCapturedWithinProperty.cs
- DataPagerFieldCommandEventArgs.cs
- NonVisualControlAttribute.cs
- Byte.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- MissingMethodException.cs
- HelpProvider.cs
- EncryptedType.cs
- PerformanceCounter.cs
- _HeaderInfoTable.cs
- FlowLayout.cs
- GridItemCollection.cs
- GradientSpreadMethodValidation.cs
- PageTheme.cs
- TabControl.cs
- AutomationPropertyInfo.cs
- handlecollector.cs
- ComponentResourceManager.cs
- CalendarDay.cs
- __Error.cs
- TablePatternIdentifiers.cs
- TextSegment.cs
- Compress.cs
- SessionStateItemCollection.cs
- CompilerGeneratedAttribute.cs