Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- ClientOptions.cs
- IIS7UserPrincipal.cs
- SafeArrayTypeMismatchException.cs
- DataTableCollection.cs
- InputBuffer.cs
- TemplatePropertyEntry.cs
- SqlSelectStatement.cs
- XmlToDatasetMap.cs
- DiscoveryViaBehavior.cs
- CollectionBase.cs
- LogManagementAsyncResult.cs
- XmlReflectionMember.cs
- RootBuilder.cs
- Size.cs
- MembershipPasswordException.cs
- RootAction.cs
- XmlSerializerAssemblyAttribute.cs
- Nodes.cs
- MemoryStream.cs
- FindCriteriaApril2005.cs
- InputBinding.cs
- SiteMembershipCondition.cs
- MailAddress.cs
- UrlEncodedParameterWriter.cs
- NewArray.cs
- XsdBuildProvider.cs
- ExtenderProvidedPropertyAttribute.cs
- DirtyTextRange.cs
- OutputScope.cs
- StyleConverter.cs
- TemplateBamlTreeBuilder.cs
- UniqueTransportManagerRegistration.cs
- TextWriter.cs
- ToolStripTextBox.cs
- CodePropertyReferenceExpression.cs
- SymbolEqualComparer.cs
- XPathEmptyIterator.cs
- GenericEnumConverter.cs
- ContourSegment.cs
- DataGridViewDesigner.cs
- SlipBehavior.cs
- CodeAttributeDeclaration.cs
- CustomAssemblyResolver.cs
- HttpWebResponse.cs
- FlowDocumentPage.cs
- NamespaceInfo.cs
- RewritingPass.cs
- ObjectResult.cs
- EntityTypeEmitter.cs
- BlockCollection.cs
- IEnumerable.cs
- SqlVisitor.cs
- GCHandleCookieTable.cs
- DotExpr.cs
- CFStream.cs
- Executor.cs
- EndpointDispatcherTable.cs
- DbProviderSpecificTypePropertyAttribute.cs
- ZoomPercentageConverter.cs
- CompilerParameters.cs
- RelatedPropertyManager.cs
- BrowserTree.cs
- InputManager.cs
- SecurityUtils.cs
- messageonlyhwndwrapper.cs
- ParseChildrenAsPropertiesAttribute.cs
- UxThemeWrapper.cs
- QueryMatcher.cs
- FilterElement.cs
- MouseGestureConverter.cs
- ComponentEditorForm.cs
- AppModelKnownContentFactory.cs
- HttpResponse.cs
- CursorConverter.cs
- HttpHeaderCollection.cs
- CapabilitiesSection.cs
- RadioButtonAutomationPeer.cs
- SupportsEventValidationAttribute.cs
- ExtensionFile.cs
- basemetadatamappingvisitor.cs
- PerformanceCounterManager.cs
- XmlNamespaceMapping.cs
- ColorConvertedBitmapExtension.cs
- SurrogateSelector.cs
- PersonalizationAdministration.cs
- SerTrace.cs
- OutputCacheProviderCollection.cs
- OwnerDrawPropertyBag.cs
- XmlDataFileEditor.cs
- SapiRecognizer.cs
- StateManagedCollection.cs
- ImageAutomationPeer.cs
- ExtenderProvidedPropertyAttribute.cs
- ConfigurationValues.cs
- UrlMappingsSection.cs
- HttpModuleAction.cs
- StandardOleMarshalObject.cs
- ContainerFilterService.cs
- WmiInstallComponent.cs
- TextRange.cs