note 42875 deleted from function.xml-parse by didou
| From: | didou@php.net | Date: | Thu, 03 Feb 2005 19:50:35 +0000 |
| Subject: | note 42875 deleted from function.xml-parse by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-84474@lists.php.net to get a copy of this message | ||
Note Submitter: bink at eezi dot net dot au
----
With the xmlC class written below, the attributes of a tag were lost if it contained any CData.
Change the _cData function to this, then, the CData is stored into the Text field in the Object of
the tag (rather than overwriting the object with the CData).
You can replace the word Text with whatever you want, possibly something that won't overlap
with any attributes.
Cheers
Paul
function _cData( $parser, $data )
{
if( trim( $data ) != '')
{
$this->pointer[$this->index]->Text = trim($data) ;
}
}
Eg:
<area>
<city postcode="2222">Michigan</city>
</area>
becomes:
[area] => Array
(
[0] => stdClass Object
(
[city] => Array
(
[0] => stdClass Object
(
[postcode] => 2222
[Text] => Michigan
)
)
)
)