Sample code for 30+ languages & platforms
Node.js

SearchAllForContent

See more XML Examples

Demonstrates the SearchAllForContent method.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var xml = new chilkat.Xml();
    // xBeginAfter: Xml
    var xBeginAfter;
    // xFound: Xml
    var xFound;

    success = xml.LoadXmlFile("qa_data/xml/pigs.xml");
    if (success !== true) {
        console.log(xml.LastErrorText);
        return;
    }

    xBeginAfter = xml.GetSelf();
    xFound = xml.SearchAllForContent(xBeginAfter,"*pig*");
    var searchForMore = true;
    while ((searchForMore == true)) {

        console.log(xFound.Tag);
        console.log(xFound.Content);
        console.log("--");

        xBeginAfter = xFound;
        xFound = xml.SearchAllForContent(xBeginAfter,"*pig*");

        searchForMore = xml.LastMethodSuccess;
    }


}

chilkatExample();