[thelist] replacing unwanted data with PHP in xml file...

Kelly Hallman khallman at wrack.org
Mon Dec 30 17:54:01 CST 2002


And in the non-efficient but extremely simple category: To strip out the
header data and run it through the parser, what about this:

//this has been tested to work, considering <?xml to be the data start
list($head,$body) =
	preg_split("/(?=<\?xml)/m",join("",file("dump.xml")),2);

//from the docs, I believe this will work in one shot:
xml_parse(parser_resource,$body,1);

If your XML file is many thousands of lines long, this might not be
efficient enough.  If it's a couple hundred, this may be the ticket.

Kelly


On Mon, 30 Dec 2002, Tom Dell'Aringa wrote:

> Okay, found a easier place to deal with this. Once I get my data, I
> have it in a variable BEFORE I actually write it to the dump.xml
> file.

--
Kelly Hallman
http://wrack.org/





More information about the thelist mailing list