> I am looking for an alternative to the following syntax
> $courts = $xml->evaluate($result . '/COURTS_SEARCHED/COURT');
> foreach ($courts as $court):
>                  $courtinfo = $xml->get_attributes($court);
>                print $courtinfo['NAME'];
> endforeach;
> is there a shorter way of getting at that attribute.
> I triad a variety of @ syntax but nothing I did seems to work.

    $courts = $xml->evaluate($result . '/COURTS_SEARCHED/COURT');
    foreach ($courts as $court):
        print  $xml->getAttributes($court, 'NAME');

Is slightly neater.  With the current XPath support, I think it's the best
you will get.

Ultimately there should be some kind of solution where you call getData()
instead of getAttribute() with evaluate() returning an array of
absoluteXPaths to attribute nodes, but if there is we currently aren't
supporting it.  ie evaluate would return
"/COURTS_SEARCH[1]/COURT[1]/attribute::NAME", and you'd pass this to
getAttributes().  You'd end up with the same no. lines of code though, so
perhaps it isn't really any neater?


For the most recent version of phpxml, V1.N.X, and an archive of this list
visit:  http://www.sourceforge.net/projects/phpxmldb

This message has been sent through the <phpXML/> user discussion list. To unsubscribe, 
please visit https:[EMAIL PROTECTED]/

Phpxmldb-phpxml-arc mailing list

Reply via email to