Parse Problem

Parse Problem

am 09.05.2006 11:03:54 von Andy Rolls-Drew

------=_NextPart_000_0038_01C6734F.E1250C30
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

All,

=20

I am fairly new to parsing XML using PHP and wonder if anyone has a =
solution
to the following. I have a file eg:-

=20

<









































=20

And so on. I have managed to parse a little of it using Magic Parser but =
I
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.

=20

Any help would be a start.

=20

Thanks in advance

=20

Andy=20

=20

=20





ARD Drive Consultants

Drive to Perfection

=20



Rolls-Drew, Andrew
Director=20

ARD Drive Consultants Ltd
169 Nottingham Road
Melton Mowbray
Leicestershire
UK=20


andyrd@ard-drive.co.uk
AIM: DarkoneARDDrive=20


tel:=20
fax:=20
mobile:=20
Skype ID:

+44 7092 162782
+44 7092 162782
+447929418215
andyrd=20

=20



=
87> Add
me to your address book...

Want a signature like this?

=20


------=_NextPart_000_0038_01C6734F.E1250C30--

Re: Parse Problem

am 09.05.2006 13:00:27 von Miles Thompson

At 06:03 AM 5/9/2006, Andy Rolls-Drew wrote:

>All,
>
>
>
>I am fairly new to parsing XML using PHP and wonder if anyone has a solution
>to the following. I have a file eg:-
>
>
>
><
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>And so on. I have managed to parse a little of it using Magic Parser but I
>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.
>
>
>
>Any help would be a start.
>
>
>
>Thanks in advance
>
>
>
>Andy

I don't know much about XML, but is not closed in you example,
neither is PRODUCT ITEM ... are you sure the XML is well-formed?
And now we don't want a sig like yours. Could you please shorten it?

Regards - Miles Thompson


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.392 / Virus Database: 268.5.5/334 - Release Date: 5/8/2006

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Parse Problem

am 10.05.2006 20:30:49 von gmc

Andy Rolls-Drew escribió:

>All,
>
>
>
>I am fairly new to parsing XML using PHP and wonder if anyone has a solution
>to the following. I have a file eg:-
>
>
>
><
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>And so on. I have managed to parse a little of it using Magic Parser but I
>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.
>
>
>
>Any help would be a start.
>
>
>
>Thanks in advance
>
>
>
>Andy
>
>
>
>
>
>
>
>
>
>ARD Drive Consultants
>
>Drive to Perfection
>
>
>
>
>
>Rolls-Drew, Andrew
>Director
>
>ARD Drive Consultants Ltd
>169 Nottingham Road
>Melton Mowbray
>Leicestershire
>UK
>
>
> andyrd@ard-drive.co.uk
>AIM: DarkoneARDDrive
>
>
>tel:
>fax:
>mobile:
>Skype ID:
>
>+44 7092 162782
>+44 7092 162782
>+447929418215
>andyrd
>
>
>
>
>
> Add
>me to your address book...
>
> Want a signature like this?
>
>
>
>
>
>
Hi,

That is only a piece of your XML data? or mayve did you wrote it by hand
to send us the email?

If that's a piece of the real data you use, bad!! you wouldn't be able
to use any XML parser as it isn't valid XML data. All tags must be
closed before opening again the same tag name -unless it does belong to
the previous tag (but I don't bet for this in your case)-. Your data
should look similar to this: (notice the *missing* closure tags. ah! I
added the dots for indentation purposes, it is not valid in XML!). Where
did you got this XML file? or perhaps is it created by yourself?


...
.....
.....
.....
...
.....
.....
.....
...*
* ->> *missing*!
*
* ->> *missing*!

...
.....
.....


Anyway, you could have a look to this thread on php-general, about an example I've sent some days ago, as simple XML parsing for dynamic structures. Give a look to the xml file structure, that is a correct XML file, and the parsing example: http://archive.netbsd.se/?ml=php-general&a=2006-04&m=1973183

Regards,
Gonzalo Monzón.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php