Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RadioButton.cs
- ResizeGrip.cs
- SyntaxCheck.cs
- DataKeyCollection.cs
- SystemWebSectionGroup.cs
- WebUtil.cs
- ItemContainerGenerator.cs
- MetadataResolver.cs
- TableSectionStyle.cs
- NetTcpBinding.cs
- PriorityBindingExpression.cs
- XXXOnTypeBuilderInstantiation.cs
- IFlowDocumentViewer.cs
- HelloMessage11.cs
- DocumentViewerConstants.cs
- ISAPIApplicationHost.cs
- DesignerSerializationManager.cs
- BaseComponentEditor.cs
- TemplateField.cs
- TdsEnums.cs
- View.cs
- InboundActivityHelper.cs
- ExpressionBuilder.cs
- EventManager.cs
- GradientBrush.cs
- FontEditor.cs
- BlockExpression.cs
- SqlRetyper.cs
- CompareValidator.cs
- TypeSource.cs
- OracleInfoMessageEventArgs.cs
- EtwTrackingBehavior.cs
- RowType.cs
- SamlEvidence.cs
- PointAnimationUsingKeyFrames.cs
- TableLayoutSettings.cs
- ModulesEntry.cs
- HtmlTableCellCollection.cs
- MetadataPropertyAttribute.cs
- Pair.cs
- MarshalByRefObject.cs
- EntityDataSourceDataSelection.cs
- SQLConvert.cs
- ArrayList.cs
- SafeCryptoHandles.cs
- ModelUtilities.cs
- SignatureDescription.cs
- TransformDescriptor.cs
- GraphicsState.cs
- DbConnectionPoolOptions.cs
- NavigationEventArgs.cs
- DataTemplate.cs
- WebPermission.cs
- FixedSOMLineCollection.cs
- DbParameterCollectionHelper.cs
- CfgArc.cs
- BaseProcessor.cs
- PointAnimationUsingPath.cs
- XmlSiteMapProvider.cs
- EditorPartDesigner.cs
- XmlAttributeAttribute.cs
- XmlCharCheckingReader.cs
- WindowsListBox.cs
- XPathDocument.cs
- SchemaCollectionPreprocessor.cs
- ObjectViewEntityCollectionData.cs
- MenuTracker.cs
- BaseTemplateBuildProvider.cs
- EventListener.cs
- Token.cs
- ClientConfigurationSystem.cs
- DbUpdateCommandTree.cs
- NodeFunctions.cs
- LayoutEvent.cs
- FontSource.cs
- DictionaryEntry.cs
- NameHandler.cs
- LocalTransaction.cs
- ListQueryResults.cs
- invalidudtexception.cs
- EncodingDataItem.cs
- XmlSchemaCollection.cs
- CqlQuery.cs
- XpsS0ValidatingLoader.cs
- Timer.cs
- Metadata.cs
- XamlPointCollectionSerializer.cs
- AspNetSynchronizationContext.cs
- CodeDomDesignerLoader.cs
- Timeline.cs
- PositiveTimeSpanValidator.cs
- SqlDataAdapter.cs
- HtmlInputRadioButton.cs
- TextTreeNode.cs
- ParameterModifier.cs
- MetaType.cs
- StylusEventArgs.cs
- LinearQuaternionKeyFrame.cs
- Button.cs
- ColorMap.cs