(Java) SearchAllForContent
Demonstrates the SearchAllForContent method.
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
CkXml xml = new CkXml();
CkXml xBeginAfter;
CkXml xFound;
boolean success = xml.LoadXmlFile("qa_data/xml/pigs.xml");
if (success != true) {
System.out.println(xml.lastErrorText());
return;
}
xBeginAfter = xml.GetSelf();
xFound = xml.SearchAllForContent(xBeginAfter,"*pig*");
boolean searchForMore = true;
while ((searchForMore == true)) {
System.out.println(xFound.tag());
System.out.println(xFound.content());
System.out.println("--");
xBeginAfter = xFound;
xFound = xml.SearchAllForContent(xBeginAfter,"*pig*");
searchForMore = xml.get_LastMethodSuccess();
}
}
}
|