Sample code for 30+ languages & platforms
PHP

SearchAllForContent

See more XML Examples

Demonstrates the SearchAllForContent method.

Chilkat PHP Downloads

PHP
<?php

use Chilkat2\Xml;

$xml = new Xml();

try {
    $xml->LoadXmlFile('qa_data/xml/pigs.xml');
} catch (\Chilkat2\Exception $e) {
    echo $e->getMessage(), "\n";
    exit;
}

$xBeginAfter = $xml->GetSelf();
$xFound = $xml->SearchAllForContent($xBeginAfter, '*pig*');
$searchForMore = true;
while ($searchForMore) {
    echo $xFound->Tag, "\n";
    echo $xFound->Content, "\n";
    echo "--\n";

    $xBeginAfter = $xFound;
    $xFound = $xml->SearchAllForContent($xBeginAfter, '*pig*');

    $searchForMore = $xml->LastMethodSuccess;
}