Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebPartConnectionsCancelVerb.cs
- RequestResizeEvent.cs
- Walker.cs
- TimeSpanStorage.cs
- DataFormat.cs
- XmlText.cs
- DataGridItemCollection.cs
- ListItemsPage.cs
- GenericFlowSwitchHelper.cs
- RenderCapability.cs
- ProxyWebPartConnectionCollection.cs
- PropertyTabChangedEvent.cs
- XmlSchemaSimpleType.cs
- DataAdapter.cs
- FormClosingEvent.cs
- ProcessStartInfo.cs
- TrackingProfileDeserializationException.cs
- TransportBindingElementImporter.cs
- Parameter.cs
- SHA256.cs
- BuildDependencySet.cs
- RequiredFieldValidator.cs
- Exceptions.cs
- EntityContainer.cs
- DispatcherOperation.cs
- LineGeometry.cs
- LambdaCompiler.ControlFlow.cs
- Geometry3D.cs
- UIElement3D.cs
- TraceFilter.cs
- TextServicesProperty.cs
- TransformationRules.cs
- xamlnodes.cs
- HtmlWindow.cs
- SafeCryptoHandles.cs
- Label.cs
- EventProvider.cs
- ShaperBuffers.cs
- Style.cs
- HtmlSelect.cs
- LogWriteRestartAreaAsyncResult.cs
- TraceSection.cs
- InputLangChangeEvent.cs
- CallContext.cs
- MdiWindowListStrip.cs
- PersonalizationStateInfo.cs
- MsmqHostedTransportManager.cs
- XamlToRtfParser.cs
- BrowserTree.cs
- WeakReferenceEnumerator.cs
- PrinterSettings.cs
- TargetException.cs
- FlowDocumentReader.cs
- DocumentEventArgs.cs
- TextRangeBase.cs
- GlyphRun.cs
- EventProperty.cs
- PseudoWebRequest.cs
- RuntimeEnvironment.cs
- SiteMapNode.cs
- Item.cs
- ToolTipAutomationPeer.cs
- SpeechSeg.cs
- AppSettingsExpressionBuilder.cs
- DictionaryMarkupSerializer.cs
- PackageDigitalSignatureManager.cs
- WindowClosedEventArgs.cs
- WriteTimeStream.cs
- ComponentDispatcherThread.cs
- coordinator.cs
- WorkflowFileItem.cs
- ConfigurationErrorsException.cs
- BuildManager.cs
- DataServiceHost.cs
- Visual3D.cs
- EntityPropertyMappingAttribute.cs
- ParagraphVisual.cs
- ObjectListItemCollection.cs
- FormViewDeletedEventArgs.cs
- ArrayConverter.cs
- XmlSchemaInferenceException.cs
- InvalidAsynchronousStateException.cs
- PropertyHelper.cs
- QilNode.cs
- MetadataItemCollectionFactory.cs
- HttpInputStream.cs
- FormsIdentity.cs
- _KerberosClient.cs
- SpecularMaterial.cs
- DataKey.cs
- EnumerableCollectionView.cs
- XmlArrayItemAttributes.cs
- DesignerLinkAdapter.cs
- ShaperBuffers.cs
- ResXResourceWriter.cs
- figurelengthconverter.cs
- CancelEventArgs.cs
- CompoundFileStreamReference.cs
- RuntimeConfigurationRecord.cs
- UnwrappedTypesXmlSerializerManager.cs