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
- XmlQueryCardinality.cs
- XmlIgnoreAttribute.cs
- ClickablePoint.cs
- ConstraintCollection.cs
- CodeRegionDirective.cs
- SystemUdpStatistics.cs
- SafeNativeMethods.cs
- CodeIndexerExpression.cs
- SignedXml.cs
- SecurityKeyType.cs
- SqlCrossApplyToCrossJoin.cs
- NoneExcludedImageIndexConverter.cs
- WrappingXamlSchemaContext.cs
- ManipulationStartingEventArgs.cs
- NoClickablePointException.cs
- DbExpressionVisitor_TResultType.cs
- Renderer.cs
- SqlEnums.cs
- HeaderCollection.cs
- SHA1.cs
- TextAnchor.cs
- WorkflowElementDialog.cs
- DataGridViewRow.cs
- SelectedPathEditor.cs
- XPathDocument.cs
- WebServiceFaultDesigner.cs
- AppSettingsSection.cs
- DataGridViewCellEventArgs.cs
- Int32.cs
- HiddenField.cs
- SafeSecurityHandles.cs
- DbgUtil.cs
- TextTreeInsertElementUndoUnit.cs
- httpapplicationstate.cs
- OptimizerPatterns.cs
- CommandManager.cs
- MultiPageTextView.cs
- SqlInternalConnection.cs
- PageParserFilter.cs
- Int32AnimationUsingKeyFrames.cs
- Barrier.cs
- ObjectQueryProvider.cs
- unitconverter.cs
- assertwrapper.cs
- CorrelationRequestContext.cs
- VerticalAlignConverter.cs
- DynamicPropertyHolder.cs
- ReliableMessagingVersion.cs
- DocumentSequenceHighlightLayer.cs
- HttpCacheVary.cs
- Cursor.cs
- EditorAttribute.cs
- PDBReader.cs
- BooleanKeyFrameCollection.cs
- SqlNotificationEventArgs.cs
- BatchStream.cs
- XmlExceptionHelper.cs
- DocumentViewerAutomationPeer.cs
- SigningCredentials.cs
- XPathNavigatorException.cs
- WmpBitmapDecoder.cs
- WaitHandle.cs
- Storyboard.cs
- DesignTimeType.cs
- StringUtil.cs
- ToolboxItemCollection.cs
- IntegerFacetDescriptionElement.cs
- ConnectivityStatus.cs
- DataSourceControl.cs
- WSAddressing10ProblemHeaderQNameFault.cs
- LayoutUtils.cs
- CompilerErrorCollection.cs
- DataTableExtensions.cs
- Translator.cs
- EventSinkHelperWriter.cs
- DefinitionBase.cs
- EntitySetBaseCollection.cs
- TreeViewEvent.cs
- WarningException.cs
- AncillaryOps.cs
- RadialGradientBrush.cs
- ParameterInfo.cs
- RelatedImageListAttribute.cs
- CatalogUtil.cs
- BitmapEffectGeneralTransform.cs
- RIPEMD160.cs
- Geometry.cs
- Tuple.cs
- MenuBase.cs
- FacetValues.cs
- ApplicationServiceManager.cs
- HostSecurityManager.cs
- CheckBox.cs
- _StreamFramer.cs
- ButtonAutomationPeer.cs
- BitmapVisualManager.cs
- RequestReplyCorrelator.cs
- TextBoxDesigner.cs
- GeneratedView.cs
- DataServiceQuery.cs