Re: Adressing XML Objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Merlin Morgenstern wrote:
ok... it seems that I am doing something fundamentally wrong. I get no output at all with this:

$xmlStr = file_get_contents($filename);
$xmlelement = new SimpleXMLElement($xmlStr);
echo '$xmlelement->xpath("//anbieter/immobilie/anhaenge/anhang[@location='INTERN' and @gruppe='TITELBILD']/daten/anhanginhalt");

The names and structure seems fine. The syntax according to your posting and php.net also.

Any ideas?


yup echo in the wrong place, try:

$xmlStr = file_get_contents($filename);
$xmlelement = new SimpleXMLElement($xmlStr);
$result = $xmlelement->xpath("//anbieter/immobilie/anhaenge/anhang[@location='INTERN' and @gruppe='TITELBILD']/daten/anhanginhalt");
while(list( , $node) = each($result)) {
    print_r($node);
}

failing that, keep shortening the xpath query till you get one that works then go from there

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux