Sample code for 30+ languages & platforms
VBScript

SearchAllForContent

See more XML Examples

Demonstrates the SearchAllForContent method.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

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