Sample code for 30+ languages & platforms
PureBasic

SearchAllForContent

See more XML Examples

Demonstrates the SearchAllForContent method.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkXml.pb"

Procedure ChilkatExample()

    success.i = 0

    xml.i = CkXml::ckCreate()
    If xml.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    xBeginAfter.i
    xFound.i

    success = CkXml::ckLoadXmlFile(xml,"qa_data/xml/pigs.xml")
    If success <> 1
        Debug CkXml::ckLastErrorText(xml)
        CkXml::ckDispose(xml)
        ProcedureReturn
    EndIf

    xBeginAfter = CkXml::ckGetSelf(xml)
    xFound = CkXml::ckSearchAllForContent(xml,xBeginAfter,"*pig*")
    searchForMore.i = 1
    While (searchForMore = 1)

        Debug CkXml::ckTag(xFound)
        Debug CkXml::ckContent(xFound)
        Debug "--"

        CkXml::ckDispose(xBeginAfter)

        xBeginAfter = xFound
        xFound = CkXml::ckSearchAllForContent(xml,xBeginAfter,"*pig*")

        searchForMore = CkXml::ckLastMethodSuccess(xml)
    Wend

    CkXml::ckDispose(xBeginAfter)



    CkXml::ckDispose(xml)


    ProcedureReturn
EndProcedure