NYCPHP Meetup

NYPHP.org

[nycphp-talk] Problem with xml_parse_into_struct

Kamm, William R (Bill), SOLIT wkamm at att.com
Thu Jan 30 09:46:28 EST 2003


Where are you getting the XML source from?  Can that person URL encode
tags such as <b>, so that you can decode them later?  That way, they
wouldn't interfere with your parsing.

Bill

-----Original Message-----
From: Michael Southwell [mailto:southwell at dneba.com] 
Sent: Thursday, January 30, 2003 9:41 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Problem with xml_parse_into_struct


if there is just a limited number of different ones, do it by brute 
force:  clean out each one globally in turn.  This would be easiest and 
probably quickest, again assuming that there are not many many different
ones.

At 01:57 AM 1/30/2003, you 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
>
>
>
>

Michael G. Southwell =================================
DNEBA Enterprises
81 South Road
Bloomingdale, NJ 07403-1419
973/492-7873 (voice and fax)
southwell at dneba.com
http://www.dneba.com
======================================================




--- Unsubscribe at http://nyphp.org/list/ ---






More information about the talk mailing list