note 105721 added to simplexmlelement.children
| From: | thetazzbot at gmail dot com | Date: | Fri, 09 Sep 2011 01:56:30 +0000 |
| Subject: | note 105721 added to simplexmlelement.children | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183063@lists.php.net to get a copy of this message | ||
Ok so say you have this xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE nitf
PUBLIC "-//IPTC-NAA//DTD NITF 3.1//EN"
"http://www.nitf.org/site/nitf-documentation/nitf-3-1.dtd">
<nitf>
<head>
<docdata management-status="embargoed">
<!--data/2011/08/23/parties/doc4e53aa5783cca930694817.txt-->
<doc-id id-string="doc4e53aa5783cca930694817"/>
<date.release norm="20110823T000000"/>
<key-list/>
</docdata>
<pubdata type="web" position.section="parties"
position.sequence="0"/>
</head>
-- snip --
If you need to access the nodes named "like.this" such as the date.release above, here is
how I did it:
$xml = new SimpleXMLElement($xhtml);
echo (string)$xml->head->docdata->{"date.release"}["norm"];
Took me a while to figure that one out ;)
----
Server IP: 69.147.83.197
Probable Submitter: 71.123.183.226
----
Manual Page -- http://www.php.net/manual/en/simplexmlelement.children.php
Edit -- https://master.php.net/note/edit/105721
Del: integrated -- https://master.php.net/note/delete/105721/integrated
Del: useless -- https://master.php.net/note/delete/105721/useless
Del: bad code -- https://master.php.net/note/delete/105721/bad+code
Del: spam -- https://master.php.net/note/delete/105721/spam
Del: non-english -- https://master.php.net/note/delete/105721/non-english
Del: in docs -- https://master.php.net/note/delete/105721/in+docs
Del: other reasons-- https://master.php.net/note/delete/105721
Reject -- https://master.php.net/note/reject/105721
Search -- https://master.php.net/manage/user-notes.php