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
- WorkflowTerminatedException.cs
- CompilationSection.cs
- SpanIndex.cs
- TreeView.cs
- ProtocolProfile.cs
- Hashtable.cs
- OdbcError.cs
- ScrollViewerAutomationPeer.cs
- PanelContainerDesigner.cs
- SmiEventSink.cs
- AliasedSlot.cs
- ConnectionString.cs
- _UncName.cs
- StopStoryboard.cs
- RowToFieldTransformer.cs
- AddInDeploymentState.cs
- EventWaitHandleSecurity.cs
- ApplicationServiceManager.cs
- CompressionTransform.cs
- CustomAttributeBuilder.cs
- Formatter.cs
- TextSearch.cs
- EdmSchemaError.cs
- DataServiceClientException.cs
- RangeContentEnumerator.cs
- TextRunTypographyProperties.cs
- OledbConnectionStringbuilder.cs
- StyleConverter.cs
- ReadWriteSpinLock.cs
- VoiceInfo.cs
- ClassHandlersStore.cs
- Slider.cs
- RequestCacheManager.cs
- IDReferencePropertyAttribute.cs
- RequestCacheManager.cs
- SingleAnimationBase.cs
- ToolStripTextBox.cs
- HostExecutionContextManager.cs
- XmlEventCache.cs
- ValidationPropertyAttribute.cs
- MessageQueuePermissionEntry.cs
- InvalidOperationException.cs
- ModuleConfigurationInfo.cs
- WebPartEditorApplyVerb.cs
- NavigationProperty.cs
- FullTextBreakpoint.cs
- WebScriptMetadataMessage.cs
- ImmutableObjectAttribute.cs
- XmlHierarchicalDataSourceView.cs
- CreateUserWizardStep.cs
- DesignerLoader.cs
- LogFlushAsyncResult.cs
- RangeValueProviderWrapper.cs
- WebServiceBindingAttribute.cs
- FindCriteriaCD1.cs
- BitmapEncoder.cs
- TextCompositionEventArgs.cs
- ToolStrip.cs
- InternalCache.cs
- PriorityItem.cs
- BaseProcessor.cs
- WebExceptionStatus.cs
- TableLayoutStyleCollection.cs
- TextBoxView.cs
- PointUtil.cs
- PointAnimationBase.cs
- HwndHostAutomationPeer.cs
- DataRowExtensions.cs
- EventLogEntry.cs
- TouchEventArgs.cs
- HostingEnvironmentSection.cs
- TrustSection.cs
- ExpandSegment.cs
- ReadOnlyDictionary.cs
- DataTemplate.cs
- EncodingDataItem.cs
- ValueQuery.cs
- Scheduler.cs
- EndCreateSecurityTokenRequest.cs
- IsolatedStorageFileStream.cs
- RequestCachePolicyConverter.cs
- DesignerTransactionCloseEvent.cs
- ObjectStateFormatter.cs
- ImportException.cs
- XmlSchemaFacet.cs
- ProtectedUri.cs
- QueryRelOp.cs
- DataBinder.cs
- CommandField.cs
- _TLSstream.cs
- DurableEnlistmentState.cs
- CookieParameter.cs
- ToolStripItemEventArgs.cs
- _Rfc2616CacheValidators.cs
- DragSelectionMessageFilter.cs
- MostlySingletonList.cs
- GenerateScriptTypeAttribute.cs
- MouseActionConverter.cs
- MouseGestureConverter.cs
- List.cs