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
- PackageRelationshipCollection.cs
- DataGridViewCellLinkedList.cs
- GroupStyle.cs
- TemplateEditingService.cs
- DragDrop.cs
- Deserializer.cs
- TraceContext.cs
- OdbcRowUpdatingEvent.cs
- PenContexts.cs
- SessionParameter.cs
- PackWebRequest.cs
- RequestCache.cs
- DocumentReference.cs
- ProfileInfo.cs
- SignedXml.cs
- ISAPIWorkerRequest.cs
- RawStylusInputCustomDataList.cs
- Pair.cs
- DesignerTransactionCloseEvent.cs
- NumberFormatter.cs
- ChangeConflicts.cs
- EntitySqlException.cs
- DataGridViewColumn.cs
- ToolboxItemImageConverter.cs
- _CacheStreams.cs
- TriggerCollection.cs
- ToolBar.cs
- EntityRecordInfo.cs
- CodeTypeReference.cs
- DoubleAnimationClockResource.cs
- CellTreeNodeVisitors.cs
- XNodeValidator.cs
- ConditionCollection.cs
- CollectionDataContractAttribute.cs
- ViewCellSlot.cs
- AssociationProvider.cs
- CompositeActivityDesigner.cs
- TextRangeBase.cs
- CharEntityEncoderFallback.cs
- PageWrapper.cs
- DataGrid.cs
- RotationValidation.cs
- DataGridState.cs
- SimpleApplicationHost.cs
- streamingZipPartStream.cs
- GuidConverter.cs
- DataGridTableCollection.cs
- AuthenticatedStream.cs
- MailWebEventProvider.cs
- AutomationPropertyInfo.cs
- NotImplementedException.cs
- GenericPrincipal.cs
- LambdaCompiler.Unary.cs
- SHA384.cs
- PinnedBufferMemoryStream.cs
- ButtonBase.cs
- ButtonField.cs
- CompositeControl.cs
- CodeTypeDelegate.cs
- NamespaceInfo.cs
- ServiceContractListItem.cs
- MonitoringDescriptionAttribute.cs
- HtmlControlPersistable.cs
- ClrPerspective.cs
- StateManager.cs
- ConfigurationValidatorBase.cs
- CallbackException.cs
- OutputCacheModule.cs
- MobileSysDescriptionAttribute.cs
- AutomationPatternInfo.cs
- PropertyTabChangedEvent.cs
- FileDialogCustomPlace.cs
- LinqDataSourceUpdateEventArgs.cs
- InkCanvasSelectionAdorner.cs
- sqlnorm.cs
- DBSqlParser.cs
- UrlAuthorizationModule.cs
- XPathItem.cs
- ExpressionList.cs
- WizardForm.cs
- FolderBrowserDialog.cs
- MultiTrigger.cs
- ComNativeDescriptor.cs
- BezierSegment.cs
- TakeOrSkipQueryOperator.cs
- List.cs
- LocalBuilder.cs
- DPTypeDescriptorContext.cs
- JumpList.cs
- AssemblyCollection.cs
- BuildProviderCollection.cs
- designeractionlistschangedeventargs.cs
- IsolatedStoragePermission.cs
- FlowNode.cs
- Comparer.cs
- StringUtil.cs
- RelationshipType.cs
- rsa.cs
- DesignTimeData.cs
- IndependentAnimationStorage.cs