At 10:04 09/05/2006, you wrote:
Message-ID: <[EMAIL PROTECTED]>
From: "Andy Rolls-Drew" <[EMAIL PROTECTED]>
Date: Tue, 9 May 2006 10:03:54 +0100
Subject: Parse Problem
I am fairly new to parsing XML using PHP and wonder if anyone has a solution
to the following. I have a file eg:-
This is not your exact file (or it's not XML and therefore not
parseable with any XML parser).
You may have some luck adapting SAX to handle this, but it will be
quite hard work.
The document must be 'well formed' to be XML data :
If you were able to post a complete but minimal example, code could
be provided to parse it correctly as XML.
I'm very familiar and happy with working with XML data but it *has*
to meet the requirements of XML data.
<<?xml version="1.0" ?>
^^^^ Cannot begin with 2 << characters, must begin with one.
<CREATED value="Wed Mar 15 8:07:27 GMT 2006">
^^^ This tag is never closed.
<CATEGORY id='67' name='Herbal Pharmacy'>
^^^^ Oh good, a Spam product - greeeeatttt !
^^^^ This tag is never closed, either.
^^^^ Nor is this closed - you see the pattern here ?
<CATEGORY id='69' name='Extras'>
And so on. I have managed to parse a little of it using Magic Parser but I
Yes, you have pulled off a 'miracle' then!
I don't know what "magic parser" is, but it's not an XML parser.
still cant manage to split the products and categories correctly. If there
weren't multiple products for each category I think I would have it.
Correctly *how* ? What are you trying to achieve ? Without knowing
that, we'll all waste our time trying to help. It would make sense to
propose a problem and ask for solutions - the data above is pretty
much unworkable without having to jump through all sorts of hoops.
So lets' begin again : Your data is 'similar' to the above (what's
the source ?) and what is the result you want to achieve ?
Cheers - Neil
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php