|
|
| |
1. Accesing nodes like ns:stuff |
|
Reply |
|
|
 DarkStar77 | 2008-06-20 04:45:55 |
| I see in your docs that you said you will add a way to access nodes by converting ns:stuff to ns_stuff. Has this been done yet? If not is there any way to access this using your current code base? Thanks for all our hard work, it is greatly appreciated. |
| |
2. Re: Accesing nodes like ns:stuff |
|
Reply |
|
|
 DarkStar77 | 2008-06-21 05:12:09 - In reply to message 1 from DarkStar77 |
| FYI: found a work around by type casting the SimpleXMLObject to an array, this allowed me to access these nodes. (ex: $array = (array)$object; ) |
| |
3. Re: Accesing nodes like ns:stuff |
|
Reply |
|
|
 Taha Paksu | 2008-07-16 15:10:52 - In reply to message 2 from DarkStar77 |
| thats interesting :) I didn't thought like that before.. btw i did what you said in your first message but i think i forgot to post it here :) thats not so hard all you need is to edit array_insert function and add a replace function before building the code to be eval'd. |
| |
4. Re: Accesing nodes like ns:stuff |
|
Reply |
|
|
 Antonius Aji | 2008-10-04 05:03:25 - In reply to message 1 from DarkStar77 |
this what I do:
$data = $sxml -> xml_load_file ($file);
echo "ns:stuff".$data->{'ns:stuff'}
in essence make an array with the content of 'ns:stuff' string.
It is excellent class as alternative for simplexml in PHP4, I wish there is a simple documentation with many example just like the way people explain in php.org
I have to do some experimentation to understand how to retrieve data.
rgds,
antonius aji |
| |
5. Namespaces Work - $item->{"name:space"}; |
|
Reply |
|
|
 Joshua Jackson | 2011-11-30 15:59:13 - In reply to message 4 from Antonius Aji |
Well...
While I was typing this post to get some help, I figured out how to get namespaces working.
echo $item->{"name:space"};
I spent about an hour trying to figure out why the previous example of $data->{'ns:stuff'} wasn't working.
Hehehe...
JJ
Example xml...
<rss>
<channel>
<item>
<title>Title</title>
<mlm:location>Branson, MO</mlm:location>
</item>
</channel>
</rss>
Example code...
<?php echo $item->{"mlm:location"}; ?>
Example output...
Branson, MO |
|