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
- SymbolPair.cs
- EllipseGeometry.cs
- ListCollectionView.cs
- StorageRoot.cs
- EntityProxyTypeInfo.cs
- ButtonFlatAdapter.cs
- PageBuildProvider.cs
- Triangle.cs
- FunctionNode.cs
- BamlBinaryWriter.cs
- BezierSegment.cs
- StateItem.cs
- MouseButton.cs
- CachedRequestParams.cs
- FixedSOMImage.cs
- PropertyGridCommands.cs
- UriTemplateVariableQueryValue.cs
- PowerStatus.cs
- InvalidPipelineStoreException.cs
- DataGridState.cs
- SqlEnums.cs
- MbpInfo.cs
- ResourceReader.cs
- Decimal.cs
- NamespaceCollection.cs
- Point3DValueSerializer.cs
- ObjectConverter.cs
- Vector3DCollectionConverter.cs
- ServiceNameElementCollection.cs
- OracleParameter.cs
- _SafeNetHandles.cs
- SqlCharStream.cs
- XmlSchemaComplexType.cs
- DropSourceBehavior.cs
- CodeConstructor.cs
- RulePatternOps.cs
- BaseUriHelper.cs
- SelectionItemProviderWrapper.cs
- MsmqIntegrationProcessProtocolHandler.cs
- MetadataUtilsSmi.cs
- BigInt.cs
- SortDescriptionCollection.cs
- PropertyInfoSet.cs
- TemplatePagerField.cs
- OrthographicCamera.cs
- ContextMenu.cs
- Util.cs
- ToolStripGrip.cs
- InstanceContext.cs
- NetPeerTcpBindingElement.cs
- QualificationDataItem.cs
- ComContractElement.cs
- ToolStripControlHost.cs
- SmtpClient.cs
- IBuiltInEvidence.cs
- RootBrowserWindowProxy.cs
- EdmScalarPropertyAttribute.cs
- HTTPNotFoundHandler.cs
- NullableLongSumAggregationOperator.cs
- IPipelineRuntime.cs
- XmlWellformedWriter.cs
- InheritablePropertyChangeInfo.cs
- FeatureSupport.cs
- BeginStoryboard.cs
- SafeEventHandle.cs
- TripleDES.cs
- ApplicationDirectoryMembershipCondition.cs
- Stackframe.cs
- TCEAdapterGenerator.cs
- SspiWrapper.cs
- SecurityContext.cs
- AncestorChangedEventArgs.cs
- SuppressMergeCheckAttribute.cs
- TextBoxView.cs
- ProfileParameter.cs
- SecurityManager.cs
- ToolStripDropDownClosedEventArgs.cs
- WebBrowserPermission.cs
- TableCell.cs
- PrimitiveSchema.cs
- MissingMemberException.cs
- ProfessionalColors.cs
- GridViewSelectEventArgs.cs
- ObjectNotFoundException.cs
- TableRow.cs
- OleDbConnection.cs
- Group.cs
- WeakEventTable.cs
- RenderTargetBitmap.cs
- SupportingTokenDuplexChannel.cs
- documentsequencetextview.cs
- PerformanceCounterLib.cs
- DecimalStorage.cs
- ListBoxDesigner.cs
- XmlSchemaInferenceException.cs
- AttributeTable.cs
- SemanticResolver.cs
- CapacityStreamGeometryContext.cs
- ExceptionUtil.cs
- SystemUdpStatistics.cs