At 10:04 09/05/2006, you wrote:
Message-ID: <BAY102-DAV9C93C36E2073A19465DAD94A90@xxxxxxx>
From: "Andy Rolls-Drew" <andy_rd@xxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Date: Tue, 9 May 2006 10:03:54 +0100
Message-ID:
<!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAGw7HZJPFmUmqr9/4U6rlTMKAAAAQAAAAgtRwhwlg7EuB915j0WrbswEAAAAA@xxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0038_01C6734F.E1250C30"
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 :
see http://www.w3schools.com/xml/xml_syntax.asp
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.
<STOREITEMS>
<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.
<PRODUCT ITEM='603'>
^^^^ Nor is this closed - you see the pattern here ?
<NAME></NAME>
<MODEL></MODEL>
<PRICE></PRICE>
<PRODUCT ITEM='608'>
<NAME></NAME>
<MODEL></MODEL>
<PRICE></PRICE>
<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 ?
HTH
Cheers - Neil
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php