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
- DateTimeAutomationPeer.cs
- MemberExpression.cs
- CryptoApi.cs
- StatusBarItem.cs
- HttpCachePolicyElement.cs
- PerformanceCounterLib.cs
- TextViewSelectionProcessor.cs
- StringExpressionSet.cs
- DbProviderServices.cs
- BoundPropertyEntry.cs
- EntitySetRetriever.cs
- ActivityCodeDomSerializer.cs
- TabPage.cs
- Rijndael.cs
- assemblycache.cs
- Cloud.cs
- CodeMemberEvent.cs
- WpfMemberInvoker.cs
- ColumnReorderedEventArgs.cs
- ForceCopyBuildProvider.cs
- IDispatchConstantAttribute.cs
- PropertyEmitter.cs
- ClockGroup.cs
- ActionItem.cs
- DataGridViewTextBoxEditingControl.cs
- LongValidator.cs
- DuplicateDetector.cs
- StringPropertyBuilder.cs
- PersistenceTypeAttribute.cs
- FillErrorEventArgs.cs
- RowToParametersTransformer.cs
- XmlSchemaValidator.cs
- DataTemplateKey.cs
- FontInfo.cs
- TextParagraphCache.cs
- CuspData.cs
- OrderByQueryOptionExpression.cs
- SqlBulkCopyColumnMappingCollection.cs
- DataKeyCollection.cs
- SqlConnectionPoolProviderInfo.cs
- ReadContentAsBinaryHelper.cs
- XmlStreamStore.cs
- COM2ColorConverter.cs
- Parameter.cs
- XmlNodeReader.cs
- FileUpload.cs
- XmlCustomFormatter.cs
- MethodToken.cs
- SqlTrackingWorkflowInstance.cs
- ComponentGuaranteesAttribute.cs
- QualifiedCellIdBoolean.cs
- ToolStripDesignerUtils.cs
- WebPartConnectionsCancelEventArgs.cs
- ComNativeDescriptor.cs
- WsatProxy.cs
- QuaternionKeyFrameCollection.cs
- Pen.cs
- DataGridViewRowsAddedEventArgs.cs
- TypedReference.cs
- BufferedWebEventProvider.cs
- InvalidOperationException.cs
- AuthStoreRoleProvider.cs
- PrintEvent.cs
- XmlSchemaDocumentation.cs
- Transform.cs
- ImageClickEventArgs.cs
- TreeViewEvent.cs
- XslNumber.cs
- XmlBinaryReader.cs
- RetrieveVirtualItemEventArgs.cs
- CellTreeNode.cs
- DataStreamFromComStream.cs
- FacetValues.cs
- DataBindingHandlerAttribute.cs
- DashStyle.cs
- Activity.cs
- VirtualPathUtility.cs
- StoreAnnotationsMap.cs
- TransactionTraceIdentifier.cs
- XhtmlBasicControlAdapter.cs
- CompositeFontFamily.cs
- DescendantQuery.cs
- ToolStripDropDownMenu.cs
- FileInfo.cs
- InteropAutomationProvider.cs
- DoubleConverter.cs
- CompiledXpathExpr.cs
- InvalidPropValue.cs
- HttpWebRequestElement.cs
- EdmType.cs
- WindowsRebar.cs
- ColumnResult.cs
- ServiceReflector.cs
- GeneralTransform3DCollection.cs
- GregorianCalendar.cs
- XmlElementAttributes.cs
- MeasureItemEvent.cs
- SoapAttributeAttribute.cs
- NetworkInterface.cs
- WebReferencesBuildProvider.cs