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
- DataGridViewRowPostPaintEventArgs.cs
- WindowHelperService.cs
- AnnouncementDispatcherAsyncResult.cs
- GridViewDeleteEventArgs.cs
- CertificateElement.cs
- ErrorProvider.cs
- DiagnosticTraceSource.cs
- ListItem.cs
- ObjectHelper.cs
- ExtensionElementCollection.cs
- Encoding.cs
- ExpressionLexer.cs
- remotingproxy.cs
- ObjectIDGenerator.cs
- CompiledQueryCacheKey.cs
- FtpWebRequest.cs
- CodeArrayCreateExpression.cs
- MatrixTransform3D.cs
- StrokeRenderer.cs
- Serializer.cs
- DataContractFormatAttribute.cs
- NamedPipeActivation.cs
- IdentityValidationException.cs
- AxisAngleRotation3D.cs
- RepeatButtonAutomationPeer.cs
- DelegateOutArgument.cs
- CharacterBufferReference.cs
- PagesChangedEventArgs.cs
- RequestQueryProcessor.cs
- SplineKeyFrames.cs
- ContainerControl.cs
- GridView.cs
- TargetControlTypeCache.cs
- InstanceValue.cs
- Transform3D.cs
- ArrayTypeMismatchException.cs
- XmlCollation.cs
- SqlNotificationRequest.cs
- CodeVariableReferenceExpression.cs
- ThreadSafeList.cs
- SqlBooleanizer.cs
- MailWriter.cs
- SettingsPropertyValueCollection.cs
- PerfCounterSection.cs
- CompModSwitches.cs
- ZipIOLocalFileBlock.cs
- ChangeProcessor.cs
- ComponentEditorForm.cs
- messageonlyhwndwrapper.cs
- ButtonField.cs
- ContextMenuAutomationPeer.cs
- HttpHeaderCollection.cs
- ToolBarButtonClickEvent.cs
- SpecialFolderEnumConverter.cs
- XmlnsCompatibleWithAttribute.cs
- SessionEndingEventArgs.cs
- ServiceActivationException.cs
- UTF7Encoding.cs
- ConfigurationErrorsException.cs
- ResourceExpressionBuilder.cs
- SmiEventStream.cs
- StubHelpers.cs
- Popup.cs
- DataRowExtensions.cs
- MarkupProperty.cs
- BulletChrome.cs
- WebServiceClientProxyGenerator.cs
- StrokeCollection2.cs
- SkinBuilder.cs
- TypePresenter.xaml.cs
- XmlEnumAttribute.cs
- XmlProcessingInstruction.cs
- OdbcParameterCollection.cs
- MessageDescription.cs
- ObservableDictionary.cs
- FontDialog.cs
- DecoderReplacementFallback.cs
- ConsumerConnectionPointCollection.cs
- NotifyParentPropertyAttribute.cs
- DbDataReader.cs
- EnterpriseServicesHelper.cs
- LogicalTreeHelper.cs
- StickyNoteContentControl.cs
- Merger.cs
- ScrollPattern.cs
- InvocationExpression.cs
- RuntimeArgumentHandle.cs
- PipeConnection.cs
- PinnedBufferMemoryStream.cs
- DesignerSerializationVisibilityAttribute.cs
- StreamedWorkflowDefinitionContext.cs
- ManagementObject.cs
- BufferedConnection.cs
- LambdaCompiler.cs
- TableRowGroup.cs
- Point.cs
- File.cs
- Hashtable.cs
- EmissiveMaterial.cs
- EtwTrackingBehavior.cs