Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ //// 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
- ExpressionDumper.cs
- IntSecurity.cs
- CompiledIdentityConstraint.cs
- ByteStorage.cs
- SpeechSynthesizer.cs
- AxisAngleRotation3D.cs
- DataGridViewCheckBoxColumn.cs
- CapacityStreamGeometryContext.cs
- TextDataBindingHandler.cs
- CommandPlan.cs
- M3DUtil.cs
- ManifestResourceInfo.cs
- RuntimeResourceSet.cs
- XLinq.cs
- CommonRemoteMemoryBlock.cs
- TraceLog.cs
- HtmlEmptyTagControlBuilder.cs
- MemberCollection.cs
- CompilationUnit.cs
- CreateUserWizardDesigner.cs
- MeshGeometry3D.cs
- ApplicationManager.cs
- SchemaLookupTable.cs
- WebPartHelpVerb.cs
- VersionedStreamOwner.cs
- StorageEntitySetMapping.cs
- GetTokenRequest.cs
- EntityContainer.cs
- ToolStripSplitButton.cs
- AccessKeyManager.cs
- IPAddressCollection.cs
- SafeRightsManagementHandle.cs
- KeyboardDevice.cs
- DateTimeOffset.cs
- FixedDSBuilder.cs
- BoundColumn.cs
- ChtmlFormAdapter.cs
- WebContext.cs
- EntryIndex.cs
- Triangle.cs
- MemoryMappedViewAccessor.cs
- sortedlist.cs
- KnownTypes.cs
- DataContract.cs
- SmtpLoginAuthenticationModule.cs
- Permission.cs
- WebPartDisplayModeCancelEventArgs.cs
- DynamicDiscoveryDocument.cs
- Attributes.cs
- SolidColorBrush.cs
- DataTableExtensions.cs
- _SSPISessionCache.cs
- RtfNavigator.cs
- EventProviderWriter.cs
- ObjectItemCollection.cs
- DesignerForm.cs
- StringUtil.cs
- QilInvoke.cs
- EncryptedXml.cs
- TransformCollection.cs
- ContainerVisual.cs
- ConstrainedDataObject.cs
- TextWriterEngine.cs
- MessageSmuggler.cs
- AQNBuilder.cs
- Int32EqualityComparer.cs
- DbParameterCollection.cs
- BitmapImage.cs
- sqlinternaltransaction.cs
- BinaryWriter.cs
- WindowsRebar.cs
- PieceDirectory.cs
- BuildProvider.cs
- MemberAccessException.cs
- ExpressionConverter.cs
- SqlException.cs
- AccessedThroughPropertyAttribute.cs
- CustomValidator.cs
- TransactionManager.cs
- SecurityTokenTypes.cs
- LoadGrammarCompletedEventArgs.cs
- SmiContextFactory.cs
- BinaryObjectReader.cs
- ImageFormat.cs
- DocumentReferenceCollection.cs
- WebBrowserContainer.cs
- XmlWriter.cs
- DbQueryCommandTree.cs
- HttpSysSettings.cs
- followingsibling.cs
- AutoResizedEvent.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- XmlWriterDelegator.cs
- TransformerInfoCollection.cs
- ClassHandlersStore.cs
- EdmPropertyAttribute.cs
- QueryExpression.cs
- UncommonField.cs
- UrlMappingsSection.cs
- DashStyle.cs