From: cliveharber@...
Date: 2007-09-19T19:30:45+09:00
Subject: Re: Parse XML that isn't well formed
Hi
looking at the xml that you have presented, there is no root element to the document - this is why the xml is being rejected - you can only have a single root element in the document - you could try something like this:
http://myserver.edu/data/
myserver.edu
/storage/data/results/
hadcm3l_00012_00000118_0
hadcm3l_00012_00000118_0_6.zip
5154055 485600296bb601ab4a3d1d49a9fb1c86
hadcm3l_00012_00000118_0_7.zip
5153055
36a600296cb60229a3d1d49a9fb1a10
If all the files that you are trying are similar to the set up that you have demonstrated then this could be the root cause. When fixed you should then be able to use whichever xml parser you want.
HTH
Clive
---- Milo Thurston wrote:
> I have some XML looking like the following, other than being very much
> larger (some files are up to 2GB):
>
>
> http://myserver.edu/data/
> myserver.edu
>
>
> /storage/data/results/
> hadcm3l_00012_00000118_0
>
> hadcm3l_00012_00000118_0_6.zip
> 5154055
> 485600296bb601ab4a3d1d49a9fb1c86
>
>
> hadcm3l_00012_00000118_0_7.zip
> 5153055
> 36a600296cb60229a3d1d49a9fb1a10
>
>
>
>
>
> I've tried a few xml parsers such as xml-simple, libxml and quixml, but
> all reject this data as badly formed. One answer would, of course, be
> for the data to be re-generated using properly formed xml. Meanwhile, is
> there anything that could be done with the existing files? Is it a case
> of having to write regexps to parse this sort of thing?
> --
> Posted via http://www.ruby-forum.com/.
>