I just tried the same thing with Zend_Dom_Query::queryXpath(), and I got the
same results:
$listings = $dom->queryXpath('/Manifest/Listings/ListingDocument');

Maybe there is something wrong with my XML?

-Hector


On Mon, Nov 10, 2008 at 8:53 PM, Hector Virgen <[EMAIL PROTECTED]> wrote:

> I am using the 1.6.2 branch of ZF, and I'm having trouble using
> Zend_Dom_Query with a simple XML file. I have followed the example from
> http://framework.zend.com/manual/en/zend.dom.query.html#zend.dom.query.methods.zenddomquerybut
>  it doesn't seem to be working for me. Am I doing something wrong?
> Here's my XML:
>
> <?xml version="1.0" encoding="utf-8"?>
> <Manifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
> xmlns="http://platform.point2.com/schemas/2.0/manifest";>
>   <BuildDate>2008-05-15T01:18:25.0434624Z</BuildDate>
>   <Listings>
>     <ListingDocument name="listings-1.xml" />
>     <ListingDocument name="listings-10.xml" />
>     <ListingDocument name="listings-2.xml" />
>     <ListingDocument name="listings-3.xml" />
>     <ListingDocument name="listings-4.xml" />
>     <ListingDocument name="listings-5.xml" />
>     <ListingDocument name="listings-6.xml" />
>     <ListingDocument name="listings-7.xml" />
>     <ListingDocument name="listings-8.xml" />
>     <ListingDocument name="listings-9.xml" />
>   </Listings>
>   <Orders />
> </Manifest>
>
> Here's my PHP code:
>
> <?php
> $manifest = 'manifest.xml';
> $xml = file_get_contents($manifest);
> var_dump($xml); // <-- looks good
>
> $dom = new Zend_Dom_Query();
> $dom->setDocumentXml($xml);
> var_dump($dom); // <-- looks good
>
> $listings = $dom->query('Listings ListingDocument');
> var_dump($listings->getCssQuery()); // <-- looks good
> var_dump(count($listings)); // <-- 0  not correct, should be 10
>
> // This dumps out "NULL" just once.
> foreach ($listings as $listing) {
>     var_dump($listing);
> }
>
> ?>
>
> Thanks for your help :)
>
> -Hector
>

Reply via email to