Sample code for 30+ languages & platforms
Chilkat2-Python

SearchAllForContent

See more XML Examples

Demonstrates the SearchAllForContent method.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

xml = chilkat2.Xml()

success = xml.LoadXmlFile("qa_data/xml/pigs.xml")
if (success != True):
    print(xml.LastErrorText)
    sys.exit()

# xBeginAfter is a CkXml
xBeginAfter = xml.GetSelf()
# xFound is a CkXml
xFound = xml.SearchAllForContent(xBeginAfter,"*pig*")
searchForMore = True
while (searchForMore == True) :

    print(xFound.Tag)
    print(xFound.Content)
    print("--")

    # xBeginAfter is a CkXml
    xBeginAfter = xFound
    # xFound is a CkXml
    xFound = xml.SearchAllForContent(xBeginAfter,"*pig*")

    searchForMore = xml.LastMethodSuccess