(VBScript) SearchAllForContent
Demonstrates the SearchAllForContent method.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Xml")
set xml = CreateObject("Chilkat.Xml")
success = xml.LoadXmlFile("qa_data/xml/pigs.xml")
If (success <> 1) Then
outFile.WriteLine(xml.LastErrorText)
WScript.Quit
End If
' xBeginAfter is a Chilkat.Xml
Set xBeginAfter = xml.GetSelf()
' xFound is a Chilkat.Xml
Set xFound = xml.SearchAllForContent(xBeginAfter,"*pig*")
searchForMore = 1
Do While (searchForMore = 1)
outFile.WriteLine(xFound.Tag)
outFile.WriteLine(xFound.Content)
outFile.WriteLine("--")
' xBeginAfter is a Chilkat.Xml
Set xBeginAfter = xFound
' xFound is a Chilkat.Xml
Set xFound = xml.SearchAllForContent(xBeginAfter,"*pig*")
searchForMore = xml.LastMethodSuccess
Loop
outFile.Close
|