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
- SortKey.cs
- AxisAngleRotation3D.cs
- EntityViewContainer.cs
- _CacheStreams.cs
- CodeGeneratorOptions.cs
- MachineKeySection.cs
- SafeLibraryHandle.cs
- StylusButtonCollection.cs
- BaseCodePageEncoding.cs
- GroupItem.cs
- InvokeMethodActivity.cs
- EntitySet.cs
- AggregateNode.cs
- Pair.cs
- RoleServiceManager.cs
- TextEditorThreadLocalStore.cs
- LocalizableAttribute.cs
- TemplateColumn.cs
- ShaperBuffers.cs
- XmlDataDocument.cs
- XmlTypeAttribute.cs
- TemplateKeyConverter.cs
- DiscoveryDocumentReference.cs
- FeatureManager.cs
- WrapPanel.cs
- BindableAttribute.cs
- DateTimeConverter2.cs
- XmlAnyAttributeAttribute.cs
- SQLInt32.cs
- XmlRawWriter.cs
- ChangePassword.cs
- BaseCollection.cs
- Pen.cs
- FunctionNode.cs
- UITypeEditor.cs
- ConnectionsZoneAutoFormat.cs
- Span.cs
- FilteredSchemaElementLookUpTable.cs
- ExpressionVisitorHelpers.cs
- GlobalizationSection.cs
- ValidationSummary.cs
- DateTime.cs
- _SingleItemRequestCache.cs
- WebBrowserUriTypeConverter.cs
- EncodingNLS.cs
- CodeAssignStatement.cs
- ContextProperty.cs
- ExpressionBindingCollection.cs
- ResourceManagerWrapper.cs
- Highlights.cs
- DesignerActionService.cs
- KeySpline.cs
- TableRowGroup.cs
- GestureRecognizer.cs
- DataGridViewCellPaintingEventArgs.cs
- ThemeDirectoryCompiler.cs
- ServicePoint.cs
- ReferenceSchema.cs
- X509CertificateStore.cs
- shaperfactoryquerycacheentry.cs
- FlowDocumentPageViewerAutomationPeer.cs
- OwnerDrawPropertyBag.cs
- MLangCodePageEncoding.cs
- contentDescriptor.cs
- ScriptManagerProxy.cs
- HTMLTagNameToTypeMapper.cs
- DispatcherHookEventArgs.cs
- CaseCqlBlock.cs
- Event.cs
- BindingNavigator.cs
- FileLogRecordHeader.cs
- ThousandthOfEmRealDoubles.cs
- Columns.cs
- TreeNodeCollection.cs
- DocumentViewerBase.cs
- AppDomainShutdownMonitor.cs
- OleDbFactory.cs
- IsolatedStorageFileStream.cs
- CompoundFileIOPermission.cs
- ToolStripMenuItem.cs
- DelegatingChannelListener.cs
- TextReader.cs
- ProxyWebPartManagerDesigner.cs
- SqlError.cs
- TimeSpanConverter.cs
- BidPrivateBase.cs
- AlignmentXValidation.cs
- OptionalRstParameters.cs
- Span.cs
- OdbcUtils.cs
- WebPartTracker.cs
- CryptoSession.cs
- GridViewRowEventArgs.cs
- GetImportFileNameRequest.cs
- Vector3DCollectionValueSerializer.cs
- DispatcherTimer.cs
- __TransparentProxy.cs
- HMACRIPEMD160.cs
- WorkflowInstanceSuspendedRecord.cs
- ThreadExceptionEvent.cs