Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- ClearTypeHintValidation.cs
- CommandHelpers.cs
- Int32CollectionValueSerializer.cs
- HtmlTextViewAdapter.cs
- StringInfo.cs
- X509ClientCertificateCredentialsElement.cs
- ChannelSinkStacks.cs
- MaskedTextBox.cs
- PowerModeChangedEventArgs.cs
- CommandID.cs
- ModuleBuilderData.cs
- AutomationIdentifier.cs
- Unit.cs
- DataBoundControl.cs
- WebPartConnectionsCancelVerb.cs
- CompilationRelaxations.cs
- ServiceDescriptionData.cs
- RuntimeHandles.cs
- SizeKeyFrameCollection.cs
- IconConverter.cs
- CalendarDataBindingHandler.cs
- CorePropertiesFilter.cs
- ListMarkerSourceInfo.cs
- FormatStringEditor.cs
- XmlNamespaceManager.cs
- StringValueConverter.cs
- TextAutomationPeer.cs
- ProcessHostMapPath.cs
- DaylightTime.cs
- WsdlBuildProvider.cs
- controlskin.cs
- entitydatasourceentitysetnameconverter.cs
- MenuAutomationPeer.cs
- PolyBezierSegmentFigureLogic.cs
- Scheduler.cs
- BitStream.cs
- DataControlCommands.cs
- Executor.cs
- LoadMessageLogger.cs
- RadioButtonList.cs
- TraceHandler.cs
- ListComponentEditorPage.cs
- TimeZone.cs
- RIPEMD160Managed.cs
- EditorZone.cs
- QueuePathEditor.cs
- ExecutedRoutedEventArgs.cs
- TableAdapterManagerNameHandler.cs
- AncestorChangedEventArgs.cs
- RepeatInfo.cs
- FontUnitConverter.cs
- Inflater.cs
- CustomAttributeFormatException.cs
- basenumberconverter.cs
- BuildManager.cs
- ReliableChannelBinder.cs
- DataGridViewAccessibleObject.cs
- SemanticResultKey.cs
- RemotingHelper.cs
- WindowsFormsEditorServiceHelper.cs
- Script.cs
- ConfigurationPropertyCollection.cs
- HopperCache.cs
- DateTimeSerializationSection.cs
- LocationReferenceEnvironment.cs
- SafeNativeMethods.cs
- EntityAdapter.cs
- TextSimpleMarkerProperties.cs
- PageSettings.cs
- XPathSingletonIterator.cs
- Symbol.cs
- QilXmlReader.cs
- ProtocolElementCollection.cs
- RuleCache.cs
- RNGCryptoServiceProvider.cs
- ReadWriteSpinLock.cs
- SoapDocumentServiceAttribute.cs
- ByteStack.cs
- UnionQueryOperator.cs
- DBNull.cs
- ShaperBuffers.cs
- SByteStorage.cs
- DBCommand.cs
- SqlInternalConnection.cs
- ControlIdConverter.cs
- SystemColorTracker.cs
- ContextDataSourceView.cs
- SystemIPv4InterfaceProperties.cs
- FocusWithinProperty.cs
- TextEditorParagraphs.cs
- ProxyHwnd.cs
- DbConnectionStringCommon.cs
- XmlResolver.cs
- BamlRecordWriter.cs
- OpacityConverter.cs
- TemplateComponentConnector.cs
- SafeTimerHandle.cs
- XmlSchemaAppInfo.cs
- VideoDrawing.cs
- PathSegmentCollection.cs