Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
VB to Scan / Iterate Nodes in an XML DocumentSource Code Listing ' This example requires Chilkat XML v3.0.0
' Scan crisp.xml for ArticleTitles and
' create another XML document containing
' only the titles.
Private Sub Command1_Click()
Label1.Caption = "Working..."
Label1.Refresh
Dim xml As New ChilkatXml
Dim outXml As New ChilkatXml
Dim node As ChilkatXml
outXml.Tag = "article_titles"
xml.LoadXmlFile "crisp.xml"
' Iterate over ArticleTitle tags regardless of where
' they occur in the document. Setting the first parameter
' to 0 causes the search to from the document root.
Set node = xml.SearchForTag(Nothing, "ArticleTitle")
Do While Not (node Is Nothing)
' NewChild returns the created child, whereas NewChild2 does not.
outXml.NewChild2 "article", node.Content
' Search for the next ArticleTitle tagged node beginning with the node
' just after the current node in a breadth-first document tree traversal.
Set node = xml.SearchForTag(node, "ArticleTitle")
Loop
outXml.SaveXml "ArticleTitles1.xml"
Label1.Caption = "Done."
End Sub
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.