Re: Problem with xml_parse_into_struct

From: Date: Thu, 30 Jan 2003 07:15:00 +0000
Subject: Re: Problem with xml_parse_into_struct
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133602@lists.php.net to get a copy of this message
Hi Phil, Your XML is not well formed, not properly nested use: <news id="1" shortDescription="Stuff Happened Today"><![CDATA[Today on <b>1/29/03</b>, stuff happened]]></news> This way the XML parser wil accept <b> and </b>, otherwise it sees it as XML elements. I hope this helps. Best regards, Davy Obdam mailto:info@davyobdam.com Phil Powell wrote:
I have various XML files that might contain <> tags inside the element body, for example: <news id="1" shortDescription="Stuff Happened Today">Today on <b>1/29/03</b>, stuff happened</news> Because of this I can't use xml_parse_into_struct; when I do this happens: array ( ... [attributes] => array (
                                  [ID] = "1"
                                  [SHORTDESCRIPTION] = "Stuff Happened Today"
                              )
[values] = "Today on" ) and it stops right there on the <b> tag. What I need to do is this: Clean out ALL occurrences of <tags> that are NOT part of the original XML structure from the contents read from the XML file: $fileID = fopen('/phil/xml/news.xml', 'r') or die('Could not open XML'); $stuff = fread($fileID, filesize('/phil/xml/news.xml')); fclose($fileID); $stuff contains the contents of news.xml, so I would have to do my cleanup in $stuff, BUT.. I can't use preg_replace for tags because then ALL of my tags would be altered and xml_parse_into_struct would fail altogether. How then do I make sure to ONLY remove the <trash tags> from each XML row body and nowhere else??? Thanx Phil ===============================================================Deze e-mail is door E-mail VirusScanner van Planet Internet gecontroleerd op virussen. Op http://www.planet.nl/evs staat een verwijzing naar de actuele lijst waar op wordt gecontroleerd.
-- -------------------------------------------------------------------- Davy Obdam - Obdam webdesign© mailto:info@davyobdam.com web: www.davyobdam.com --------------------------------------------------------------------

« previous php.general (#133602) next »