my_xml_file.xml is not a valid xml file.

a valid xml file needs to have a root node.

so if you modify the file to include a root node (such as <root>...</root>) 
then the parsing should work.

Lapinski


robert123 wrote:
> 
> 
> i am using the below codes, took from the bakery, straight
> 
>  App::import('Xml');
> 
>     // your XML file's location
>     $file = "my_xml_file.xml";
> 
>     // now parse it
>     $parsed_xml =& new XML($file);
>     $parsed_xml = Set::reverse($parsed_xml); // this is what i call
> magic
> 
>     // see the returned array
>    var_dump($parsed_xml);
>  it shows
> array(1) { ["Order"]=>  array(1) { ["id"]=>  string(7) "3525314" } }
> 
> the  my_xml_file.xml have the data below
> 
> <order id="3525314" ></order><order id="3525317" ></order>
> 
> it has two order data, the my_xml_file.xml was generated from the
> database using $xml->serialize($data);
> 
> but whenever the code above is executed I only get
> Array ( [Order] => Array ( [id] => 3525314 ) )
> 
> that is it is only reads the first order and never the second order,
> how can i make it to read the whole xml data into an array, thank you
> 
> 
> 
> 
> http://www.generics.ws
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/xml-not-parse-correctly-tp24008520p24015474.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to