get xml attributes... Help !
Posted: Mon Nov 22, 2004 8:42 am
Hi all,
i have a problem with parse all xml attributes from external my_file.xml
to two arrays.
Can anybody help me with this ??? plz
I need two arrays like this:
Array names
(
[0] => apple
[1] => microsoft
[2] => sun
)
Array links
(
[0] => apple.com
[1] => microsoft.com
[2] => sun.com
)
my_file.xml
<?xml version="1.0"?>
<all>
<data name="apple" link="apple.com"></data>
<data name="microsoft" link="microsoft.com"></data>
<data name="sun" link="sun.com"></data>
</all>
<?
if (file_exists("my_file.xml")) {
$xml = simplexml_load_file("my_file.xml");
foreach($xml->data[0]->attributes() as $values) {
$links[] = $values;
}
}
Thanks
idas
i have a problem with parse all xml attributes from external my_file.xml
to two arrays.
Can anybody help me with this ??? plz
I need two arrays like this:
Array names
(
[0] => apple
[1] => microsoft
[2] => sun
)
Array links
(
[0] => apple.com
[1] => microsoft.com
[2] => sun.com
)
my_file.xml
<?xml version="1.0"?>
<all>
<data name="apple" link="apple.com"></data>
<data name="microsoft" link="microsoft.com"></data>
<data name="sun" link="sun.com"></data>
</all>
<?
if (file_exists("my_file.xml")) {
$xml = simplexml_load_file("my_file.xml");
foreach($xml->data[0]->attributes() as $values) {
$links[] = $values;
}
}
Thanks
idas