Ruby
Ruby
SearchAllForContent
See more XML Examples
Demonstrates the SearchAllForContent method.Chilkat Ruby Downloads
require 'chilkat'
success = false
xml = Chilkat::CkXml.new()
success = xml.LoadXmlFile("qa_data/xml/pigs.xml")
if (success != true)
print xml.lastErrorText() + "\n";
exit
end
# xBeginAfter is a CkXml
xBeginAfter = xml.GetSelf()
# xFound is a CkXml
xFound = xml.SearchAllForContent(xBeginAfter,"*pig*")
searchForMore = true
while (searchForMore == true)
print xFound.tag() + "\n";
print xFound.content() + "\n";
print "--" + "\n";
# xBeginAfter is a CkXml
xBeginAfter = xFound
# xFound is a CkXml
xFound = xml.SearchAllForContent(xBeginAfter,"*pig*")
searchForMore = xml.get_LastMethodSuccess()
end