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
- DrawingVisual.cs
- WebPartChrome.cs
- BulletChrome.cs
- DateTimeFormatInfo.cs
- XpsInterleavingPolicy.cs
- HttpStreamMessage.cs
- DataGridBoolColumn.cs
- MetadataException.cs
- RadioButton.cs
- SendingRequestEventArgs.cs
- Int16AnimationBase.cs
- RuleAttributes.cs
- ToolStripSplitStackLayout.cs
- StaticDataManager.cs
- SHA256Managed.cs
- TogglePattern.cs
- MethodCallTranslator.cs
- EventPropertyMap.cs
- _KerberosClient.cs
- XsltSettings.cs
- FormatSettings.cs
- WindowsTokenRoleProvider.cs
- ClientUtils.cs
- PropertyRef.cs
- BitmapFrame.cs
- EngineSite.cs
- SdlChannelSink.cs
- CheckBox.cs
- Random.cs
- XPathException.cs
- UnsafeNativeMethods.cs
- ToggleButton.cs
- CatalogPartChrome.cs
- SafeRightsManagementSessionHandle.cs
- Library.cs
- CachedTypeface.cs
- Function.cs
- LoginAutoFormat.cs
- CodeRegionDirective.cs
- CanonicalFontFamilyReference.cs
- AccessText.cs
- MouseEventArgs.cs
- BmpBitmapEncoder.cs
- PopupRootAutomationPeer.cs
- UIElement.cs
- BufferedStream2.cs
- EdmEntityTypeAttribute.cs
- SID.cs
- DataGridViewCellStyleEditor.cs
- DoubleLinkList.cs
- COM2FontConverter.cs
- ImplicitInputBrush.cs
- TransportOutputChannel.cs
- PointLightBase.cs
- InfoCardAsymmetricCrypto.cs
- CodeTypeReference.cs
- ArithmeticException.cs
- DecimalAnimation.cs
- OleServicesContext.cs
- GridViewUpdateEventArgs.cs
- HGlobalSafeHandle.cs
- SpeechSeg.cs
- DataControlLinkButton.cs
- EdgeProfileValidation.cs
- ClientSponsor.cs
- TimerElapsedEvenArgs.cs
- JsonEncodingStreamWrapper.cs
- HasActivatableWorkflowEvent.cs
- CodeSnippetExpression.cs
- WebServiceEnumData.cs
- AssemblySettingAttributes.cs
- CharEntityEncoderFallback.cs
- ByValueEqualityComparer.cs
- SqlDataReaderSmi.cs
- DataPagerFieldCollection.cs
- SQLBinaryStorage.cs
- BlurBitmapEffect.cs
- ArithmeticException.cs
- Keywords.cs
- TokenBasedSetEnumerator.cs
- PersistenceTypeAttribute.cs
- TemplateComponentConnector.cs
- Viewport3DVisual.cs
- Bidi.cs
- ExclusiveTcpTransportManager.cs
- BooleanKeyFrameCollection.cs
- Vector3DKeyFrameCollection.cs
- EntityDataSourceWizardForm.cs
- SpecularMaterial.cs
- DataSourceHelper.cs
- XomlCompilerResults.cs
- DataServiceKeyAttribute.cs
- PersonalizationDictionary.cs
- WindowsListViewGroup.cs
- ProvidePropertyAttribute.cs
- SortQuery.cs
- ConcatQueryOperator.cs
- SourceFileBuildProvider.cs
- StringPropertyBuilder.cs
- ReferentialConstraint.cs