Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- CardSpaceException.cs
- Assert.cs
- HwndMouseInputProvider.cs
- Point3D.cs
- CodeMemberEvent.cs
- TableColumnCollection.cs
- ResourceDictionaryCollection.cs
- StatementContext.cs
- SimpleWebHandlerParser.cs
- SafeFileHandle.cs
- AttachedPropertyInfo.cs
- SqlCacheDependency.cs
- Processor.cs
- MemberMemberBinding.cs
- ImageSourceConverter.cs
- TdsEnums.cs
- SafeNativeMethods.cs
- VariableQuery.cs
- ComponentDesigner.cs
- AnimatedTypeHelpers.cs
- EdmError.cs
- RadioButtonBaseAdapter.cs
- RemotingConfiguration.cs
- SystemDiagnosticsSection.cs
- DefaultValueConverter.cs
- WindowPatternIdentifiers.cs
- ResourceIDHelper.cs
- RelationshipConverter.cs
- ReferentialConstraint.cs
- ResourceReader.cs
- TextAdaptor.cs
- RadioButton.cs
- GroupBox.cs
- ScriptControlDescriptor.cs
- PerfService.cs
- NullableBoolConverter.cs
- XmlUtf8RawTextWriter.cs
- EntityDataSourceContainerNameConverter.cs
- EDesignUtil.cs
- EnumValAlphaComparer.cs
- QuaternionAnimation.cs
- HttpAsyncResult.cs
- CacheOutputQuery.cs
- HMACRIPEMD160.cs
- UniqueIdentifierService.cs
- SmtpFailedRecipientException.cs
- GenericUriParser.cs
- GridViewRowEventArgs.cs
- Rect.cs
- TrimSurroundingWhitespaceAttribute.cs
- FileSystemEventArgs.cs
- pingexception.cs
- CaseInsensitiveOrdinalStringComparer.cs
- IntPtr.cs
- ProcessingInstructionAction.cs
- AuthorizationSection.cs
- HttpModulesSection.cs
- SmiRequestExecutor.cs
- TreeViewItem.cs
- AppDomainUnloadedException.cs
- DetailsViewModeEventArgs.cs
- HttpConfigurationContext.cs
- DataSourceXmlClassAttribute.cs
- UriSection.cs
- ComboBoxItem.cs
- AudienceUriMode.cs
- BamlCollectionHolder.cs
- PropertyReferenceSerializer.cs
- CellRelation.cs
- NameValueSectionHandler.cs
- MailAddressCollection.cs
- ToolStripRenderer.cs
- WindowsGrip.cs
- SoapAttributeOverrides.cs
- DataObjectAttribute.cs
- StylusCaptureWithinProperty.cs
- StylusTip.cs
- CollectionView.cs
- AuthenticatedStream.cs
- PointConverter.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- DmlSqlGenerator.cs
- ToolStripKeyboardHandlingService.cs
- QilPatternVisitor.cs
- MdiWindowListItemConverter.cs
- BrushConverter.cs
- GuidelineCollection.cs
- JsonCollectionDataContract.cs
- UnsafeNativeMethods.cs
- ExtensionFile.cs
- FamilyTypefaceCollection.cs
- SiteMembershipCondition.cs
- AspNetSynchronizationContext.cs
- XpsDocument.cs
- XmlWrappingReader.cs
- Label.cs
- HtmlTableRow.cs
- DefinitionBase.cs
- LinqDataSourceValidationException.cs
- Win32.cs