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
- EmptyStringExpandableObjectConverter.cs
- BinaryCommonClasses.cs
- MTConfigUtil.cs
- WebPartMovingEventArgs.cs
- GridViewCellAutomationPeer.cs
- Compilation.cs
- UnmanagedMarshal.cs
- DetailsViewPagerRow.cs
- EdmToObjectNamespaceMap.cs
- VisualProxy.cs
- PersistenceTypeAttribute.cs
- PackUriHelper.cs
- NetworkInterface.cs
- CodeMemberEvent.cs
- XmlCustomFormatter.cs
- ExceptionHandler.cs
- SqlConnectionManager.cs
- UnsafeNetInfoNativeMethods.cs
- SelfIssuedTokenFactoryCredential.cs
- DynamicILGenerator.cs
- CellLabel.cs
- WebControlParameterProxy.cs
- DirectoryNotFoundException.cs
- hwndwrapper.cs
- RC2CryptoServiceProvider.cs
- RemoteWebConfigurationHostServer.cs
- WebDisplayNameAttribute.cs
- DesignerDataStoredProcedure.cs
- TypeKeyValue.cs
- SHA384Managed.cs
- TransformGroup.cs
- CodeAttributeDeclarationCollection.cs
- GenericsInstances.cs
- Buffer.cs
- MembershipPasswordException.cs
- FileDialogPermission.cs
- TreeNodeEventArgs.cs
- XmlElementCollection.cs
- Table.cs
- ErrorProvider.cs
- PlatformNotSupportedException.cs
- PointLightBase.cs
- RegexBoyerMoore.cs
- ReadWriteObjectLock.cs
- MeshGeometry3D.cs
- TreeViewDesigner.cs
- ToolStripComboBox.cs
- ClientSettingsStore.cs
- CompositeControl.cs
- WebConfigurationHostFileChange.cs
- RoutingChannelExtension.cs
- OleDbRowUpdatingEvent.cs
- InvalidDataContractException.cs
- FileDialog.cs
- XmlILIndex.cs
- PaginationProgressEventArgs.cs
- InvalidComObjectException.cs
- UInt16.cs
- Comparer.cs
- HttpValueCollection.cs
- DispatcherSynchronizationContext.cs
- ExcCanonicalXml.cs
- DbConnectionFactory.cs
- PaperSize.cs
- SecurityTokenRequirement.cs
- SecureStringHasher.cs
- EnlistmentState.cs
- basecomparevalidator.cs
- ValidatorCompatibilityHelper.cs
- TextRangeSerialization.cs
- ContextActivityUtils.cs
- Context.cs
- EventLogPermissionEntry.cs
- basenumberconverter.cs
- BoolExpressionVisitors.cs
- COAUTHIDENTITY.cs
- AsymmetricAlgorithm.cs
- WindowsListViewScroll.cs
- AndCondition.cs
- ObjectDataSourceDisposingEventArgs.cs
- MLangCodePageEncoding.cs
- XmlSchemaSimpleTypeUnion.cs
- ImpersonateTokenRef.cs
- Int16Storage.cs
- MatrixAnimationBase.cs
- NullableConverter.cs
- InvalidFilterCriteriaException.cs
- IFlowDocumentViewer.cs
- DefaultCommandConverter.cs
- ISessionStateStore.cs
- CellParaClient.cs
- CommentGlyph.cs
- ParameterEditorUserControl.cs
- WebServiceFault.cs
- DesignerAutoFormatStyle.cs
- Context.cs
- X509WindowsSecurityToken.cs
- DesignerSerializationOptionsAttribute.cs
- TargetConverter.cs
- ServiceErrorHandler.cs