On Dec 17, 2007 10:44 PM, VamVan <[EMAIL PROTECTED]> wrote:

> Hello,
>
> I receive an output  as an  XML File. Please  provide some scripts that I
> can use for extraction of the values.
>
> For Example:
> <title>hello</title>
>
> <title>hello2</title>
>
> <title>hello3</title>
>
> are 3 different records in the XML File. How can I retrieve the result set
> in a loop and also sort it like DESC and ASC for example.
>
> While()
> {
>  xml['title'] // Value
> }
>


<?php
$xml=
<<<XML
<container>
        <title>i</title>
        <title>care</title>
        <title>about</title>
        <title>things</title>
        <arbitraryContent>xmlInPhpIsFun</arbitraryContent>
</container>
XML;

$simpleXmlElt = new SimpleXMLElement($xml);
$titleElements = $simpleXmlElt->xpath('//title');
foreach($titleElements as $curTitleElement) {
        echo $curTitleElement . PHP_EOL;
}
?>

no charge ;) hehe
-nathan

Reply via email to