Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ThousandthOfEmRealPoints.cs
- OletxTransactionFormatter.cs
- _AcceptOverlappedAsyncResult.cs
- FixedSOMGroup.cs
- WebServiceTypeData.cs
- XmlBindingWorker.cs
- StaticTextPointer.cs
- XsdBuilder.cs
- StringAnimationBase.cs
- AmbientProperties.cs
- DigitShape.cs
- WebPartChrome.cs
- TypeConverterValueSerializer.cs
- XmlMapping.cs
- Vector3DAnimation.cs
- XhtmlBasicTextViewAdapter.cs
- BehaviorEditorPart.cs
- tooltip.cs
- PageTheme.cs
- ServiceDescriptionSerializer.cs
- SpellerError.cs
- CreateUserErrorEventArgs.cs
- SQLUtility.cs
- EdmScalarPropertyAttribute.cs
- DispatcherHookEventArgs.cs
- ZoneMembershipCondition.cs
- OpCodes.cs
- WinInet.cs
- Single.cs
- SymbolMethod.cs
- DataControlButton.cs
- QilInvokeLateBound.cs
- ExclusiveTcpListener.cs
- GridViewRowPresenterBase.cs
- CodeTypeDeclarationCollection.cs
- PositiveTimeSpanValidatorAttribute.cs
- ColumnResizeUndoUnit.cs
- ButtonStandardAdapter.cs
- XamlToRtfWriter.cs
- DataControlFieldHeaderCell.cs
- PropertyGridDesigner.cs
- ManagementClass.cs
- CallInfo.cs
- XmlSchemaInferenceException.cs
- BindingUtils.cs
- SizeChangedInfo.cs
- SubclassTypeValidatorAttribute.cs
- SmtpException.cs
- COM2EnumConverter.cs
- UnmanagedMemoryStreamWrapper.cs
- PictureBox.cs
- TreeViewImageKeyConverter.cs
- AppearanceEditorPart.cs
- Transaction.cs
- DetailsView.cs
- StreamGeometry.cs
- HandleRef.cs
- ParameterBinding.cs
- counter.cs
- CustomTypeDescriptor.cs
- ImageMapEventArgs.cs
- RenderTargetBitmap.cs
- SapiRecoInterop.cs
- XslException.cs
- StatusStrip.cs
- ModuleConfigurationInfo.cs
- WebPartEditorCancelVerb.cs
- QuestionEventArgs.cs
- PointCollection.cs
- ListViewSelectEventArgs.cs
- XmlILModule.cs
- ReliableMessagingVersion.cs
- Attributes.cs
- XsltFunctions.cs
- SqlCacheDependencyDatabaseCollection.cs
- Matrix3DStack.cs
- PerspectiveCamera.cs
- QueryContinueDragEventArgs.cs
- DataSourceXmlTextReader.cs
- MouseActionValueSerializer.cs
- Regex.cs
- Bits.cs
- MenuCommands.cs
- LabelDesigner.cs
- Substitution.cs
- CriticalFinalizerObject.cs
- RadioButtonPopupAdapter.cs
- ImageFormat.cs
- XmlDocumentSurrogate.cs
- SamlConstants.cs
- CircleHotSpot.cs
- PageClientProxyGenerator.cs
- BinaryNode.cs
- UserControl.cs
- PeerResolverBindingElement.cs
- HtmlTernaryTree.cs
- MSAAWinEventWrap.cs
- ElementProxy.cs
- PropertyPath.cs
- CodeDomConfigurationHandler.cs