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
- IsolatedStoragePermission.cs
- SystemEvents.cs
- WebPartVerb.cs
- AQNBuilder.cs
- Hyperlink.cs
- ResXResourceReader.cs
- AsymmetricSignatureFormatter.cs
- XhtmlBasicImageAdapter.cs
- DPTypeDescriptorContext.cs
- LinqDataSourceInsertEventArgs.cs
- CacheAxisQuery.cs
- RuntimeCompatibilityAttribute.cs
- WebReferenceOptions.cs
- PropertyMapper.cs
- DocobjHost.cs
- DBParameter.cs
- glyphs.cs
- DataGridAddNewRow.cs
- FixedSOMSemanticBox.cs
- Baml2006KnownTypes.cs
- Object.cs
- EventBindingService.cs
- DynamicMethod.cs
- BindingElement.cs
- CssClassPropertyAttribute.cs
- HtmlTable.cs
- StrokeNodeData.cs
- RewritingProcessor.cs
- ToolStripGrip.cs
- Wizard.cs
- SmiContextFactory.cs
- WebPartDisplayModeCollection.cs
- IsolatedStorageFilePermission.cs
- SegmentInfo.cs
- FileAuthorizationModule.cs
- Panel.cs
- BitmapPalettes.cs
- UnsafePeerToPeerMethods.cs
- Converter.cs
- Lease.cs
- OleStrCAMarshaler.cs
- WebExceptionStatus.cs
- UIElement3DAutomationPeer.cs
- ExtensionQuery.cs
- Base64WriteStateInfo.cs
- ACL.cs
- PKCS1MaskGenerationMethod.cs
- CheckBoxFlatAdapter.cs
- SafeFindHandle.cs
- SafeUserTokenHandle.cs
- ObjectDataSourceSelectingEventArgs.cs
- XsltInput.cs
- BeginEvent.cs
- EdmSchemaError.cs
- JsonEncodingStreamWrapper.cs
- Scripts.cs
- NativeMethodsOther.cs
- RuleSettings.cs
- FixedPosition.cs
- IntegrationExceptionEventArgs.cs
- SrgsGrammar.cs
- COM2PropertyBuilderUITypeEditor.cs
- DecoderFallbackWithFailureFlag.cs
- RelatedPropertyManager.cs
- HandlerBase.cs
- CodeTypeParameterCollection.cs
- xml.cs
- XamlFigureLengthSerializer.cs
- InvalidCastException.cs
- OutputCacheModule.cs
- RichTextBoxContextMenu.cs
- RegisteredHiddenField.cs
- Script.cs
- SequentialOutput.cs
- DecimalConverter.cs
- LinqToSqlWrapper.cs
- DrawListViewSubItemEventArgs.cs
- Pkcs7Signer.cs
- AccessKeyManager.cs
- ValidatorCompatibilityHelper.cs
- XmlSchemaInferenceException.cs
- BlobPersonalizationState.cs
- filewebrequest.cs
- SecurityPolicyVersion.cs
- BufferModeSettings.cs
- DateTime.cs
- XPathQilFactory.cs
- EnumBuilder.cs
- ResourceType.cs
- RemoteAsymmetricSignatureFormatter.cs
- IncrementalReadDecoders.cs
- WithParamAction.cs
- UniqueSet.cs
- PersonalizationProviderHelper.cs
- MLangCodePageEncoding.cs
- ControlParameter.cs
- UpdateCommandGenerator.cs
- TemplateColumn.cs
- ValueExpressions.cs
- OleDbReferenceCollection.cs