[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Parse XML that isn't well formed

cliveharber

9/19/2007 10:31:00 AM

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:

<?xml version="1.0" encoding="UTF-8"?>
<server>
<server_url>http://myserver.edu/data/</serv...
<server_name>myserver.edu</server_name>
<uploads>
<result>
<dir>/storage/data/results/</dir>
<result_name>hadcm3l_00012_00000118_0</result_name>
<file_info>
<name>hadcm3l_00012_00000118_0_6.zip</name>
<nbytes>5154055</nbytes> <md5_checksum>485600296bb601ab4a3d1d49a9fb1c86</md5_checksum>
</file_info>
<file_info>
<name>hadcm3l_00012_00000118_0_7.zip</name>
<nbytes>5153055</nbytes>
<md5_checksum>36a600296cb60229a3d1d49a9fb1a10</md5_checksum>
</file_info>
</result>
</uploads>
</server>

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 <knirirr@gmail.com> wrote:
> I have some XML looking like the following, other than being very much
> larger (some files are up to 2GB):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <server_url>http://myserver.edu/data/</serv...
> <server_name>myserver.edu</server_name>
> <uploads>
> <result>
> <dir>/storage/data/results/</dir>
> <result_name>hadcm3l_00012_00000118_0</result_name>
> <file_info>
> <name>hadcm3l_00012_00000118_0_6.zip</name>
> <nbytes>5154055</nbytes>
> <md5_checksum>485600296bb601ab4a3d1d49a9fb1c86</md5_checksum>
> </file_info>
> <file_info>
> <name>hadcm3l_00012_00000118_0_7.zip</name>
> <nbytes>5153055</nbytes>
> <md5_checksum>36a600296cb60229a3d1d49a9fb1a10</md5_checksum>
> </file_info>
> </result>
> </uploads>
> </xml>
>
> 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-....
>


8 Answers

Adam H. Kerman

5/6/2013 1:57:00 PM

0

Barry Margolin <barmar@alum.mit.edu> wrote:
>"Adam H. Kerman" <ahk@chinet.com> wrote:
>>Alan Curry <pacman@kosh.dhis.org> wrote:

>> >
>> >.
>> >
>> >..
>> >
>> >.
>> >
>> >...
>> >
>> >.
>> >
>> >..
>> >
>> >.
>> >
>> >....
>> >
>> >.
>> >
>> >..
>> >
>> >.
>> >
>> >...
>> >
>> >.
>> >
>> >..
>> >
>> >.
>> >
>> >.....

>>>When Sarah and Allison are discussing whether Donny is the monitor, why
>>>do they assume the monitor is less likely to be someone they've known a
>>>long time? I'd assume the opposite. The experiment has been running
>>>since they were cloned, right? (Assuming that they were cloned. I'm not
>>>sure that's even the answer, but it's the working theory.) Each clone may
>>>have had a series of monitors throughout their lives. It's possible that
>>>there was a long unmonitored period, but Sarah and Allison can't know
>>>that yet.

>>Good point. The experiment's been going on since birth.

>I think the idea is just that they wouldn't hire a high school boy to be
>a monitor -- he wouldn't be reliable enough, and you couldn't depend on
>him to keep the secret (especially from a hot girl that he's dating).

I know what Sarah and Allison were thinking, Barry. I saw the episode.
Viewers are going to be misdirected, so that doesn't rule out Donny. Given
that the experiment has been going on since birth, you're not going to get
much in the way of observations of a child if you rely exclusively on
adults. The point is to watch her throughout her life without interfering;
an adult would alter a child's behavior. It's too much of a coincidence
to set up Allison and Donny as life-long lovers from childhood, though.

Similarly, I won't rule out either Mrs. S. or Felix as Sarah's monitors.
Vic's too stupid, though, despite the way he tracked Felix.

As they wanted Beth to see a psychiatrist, somehow they were monitoring
her that way as well, but they may have just bugged the office and copied
files without recruiting the psychiatrist.

Hunter

5/7/2013 6:02:00 PM

0

On Mon, 6 May 2013 13:56:30 +0000 (UTC), "Adam H. Kerman"
<ahk@chinet.com> wrote:

>Barry Margolin <barmar@alum.mit.edu> wrote:
>>"Adam H. Kerman" <ahk@chinet.com> wrote:
>>>Alan Curry <pacman@kosh.dhis.org> wrote:
>
>>> >
>>> >.
>>> >
>>> >..
>>> >
>>> >.
>>> >
>>> >...
>>> >
>>> >.
>>> >
>>> >..
>>> >
>>> >.
>>> >
>>> >....
>>> >
>>> >.
>>> >
>>> >..
>>> >
>>> >.
>>> >
>>> >...
>>> >
>>> >.
>>> >
>>> >..
>>> >
>>> >.
>>> >
>>> >.....
>
>>>>When Sarah and Allison are discussing whether Donny is the monitor, why
>>>>do they assume the monitor is less likely to be someone they've known a
>>>>long time? I'd assume the opposite. The experiment has been running
>>>>since they were cloned, right? (Assuming that they were cloned. I'm not
>>>>sure that's even the answer, but it's the working theory.) Each clone may
>>>>have had a series of monitors throughout their lives. It's possible that
>>>>there was a long unmonitored period, but Sarah and Allison can't know
>>>>that yet.
>
>>>Good point. The experiment's been going on since birth.
>
>>I think the idea is just that they wouldn't hire a high school boy to be
>>a monitor -- he wouldn't be reliable enough, and you couldn't depend on
>>him to keep the secret (especially from a hot girl that he's dating).
>
>I know what Sarah and Allison were thinking, Barry. I saw the episode.
>Viewers are going to be misdirected, so that doesn't rule out Donny.
-----
I think it has been established that Donny is a monitor as per his
burning notes from the steel box that he and Allison struggled over.
He was on the phone as he did it.
>
>Given
>that the experiment has been going on since birth, you're not going to get
>much in the way of observations of a child if you rely exclusively on
>adults. The point is to watch her throughout her life without interfering;
>an adult would alter a child's behavior. It's too much of a coincidence
>to set up Allison and Donny as life-long lovers from childhood, though.
>
>Similarly, I won't rule out either Mrs. S. or Felix as Sarah's monitors.
>Vic's too stupid, though, despite the way he tracked Felix.
----
I agree, especially about Felix. A man at the end of the fourth
episode picked up Helena, the Ukrainian one, from the alley she
collapeed in and put her in a van. To me looked suspiciously like
Felix despite his identity being obsured by a hat. His height, build,
skin color and the coat he was wearing seemed very similar to Felix.
>
>As they wanted Beth to see a psychiatrist, somehow they were monitoring
>her that way as well, but they may have just bugged the office and copied
>files without recruiting the psychiatrist.
-----
Either could be true, but I think planting a psychiatrist that is one
of their own is the safer route since bugs can be discovered and if
they can have monitors then I think they could have their own
psychiatrist working in cover.

------>Hunter

"No man in the wrong can stand up against
a fellow that's in the right and keeps on acomin'."

-----William J. McDonald
Captain, Texas Rangers from 1891 to 1907

Jim G.

5/8/2013 8:14:00 PM

0

Adam H. Kerman sent the following on 5/6/2013 12:19 AM:
> My guess is she isn't a clone, which is how she had a child,

Agreed. My guess is that she is the original. The source material.

> but I have
> no clue as to how they could all be identical in age.

Suspended animation (like we're already studying for deep space
missions) is one possibility. Or just freeze the embryos at some point
until you have found suitable maternal environments for them. I'm sure
that there are plenty of other reasonable options, but either of these
would work fine in a skiffy show.

--
Jim G. | A fan of the good and the bad, but not the mediocre
"Can you and your stupid hair let us in?" -- Carlton Lassiter, PSYCH

David Johnston

5/8/2013 8:34:00 PM

0

On 5/8/2013 2:13 PM, Jim G. wrote:
> Adam H. Kerman sent the following on 5/6/2013 12:19 AM:
>> My guess is she isn't a clone, which is how she had a child,
>
> Agreed. My guess is that she is the original. The source material.

That would mean she's older than the others.

Adam H. Kerman

5/8/2013 10:01:00 PM

0

David Johnston <David@block.net> wrote:
>On 5/8/2013 2:13 PM, Jim G. wrote:
>>Adam H. Kerman sent the following on 5/6/2013 12:19 AM:

>>>My guess is she isn't a clone, which is how she had a child,

>>Agreed. My guess is that she is the original. The source material.

>That would mean she's older than the others.

We don't know that the cells to clone from were taken from a human baby.
Nor do we know the gestation period if they were grown in laboratory.

Mason Barge

5/8/2013 10:47:00 PM

0

On Wed, 08 May 2013 15:13:42 -0500, "Jim G."
<jimgysin@geemail.com.invalid> wrote:

>Adam H. Kerman sent the following on 5/6/2013 12:19 AM:
>> My guess is she isn't a clone, which is how she had a child,
>
>Agreed. My guess is that she is the original. The source material.

Do you guys have a reason for thinking that a clone can't have a
child?

Jim G.

5/9/2013 4:21:00 PM

0

David Johnston sent the following on 5/8/2013 3:33 PM:
> On 5/8/2013 2:13 PM, Jim G. wrote:
>> Adam H. Kerman sent the following on 5/6/2013 12:19 AM:
>>> My guess is she isn't a clone, which is how she had a child,
>>
>> Agreed. My guess is that she is the original. The source material.
>
> That would mean she's older than the others.

Older by what measurement? A calendar? Yes. Organically? Maybe not. We
simply don't know how far they're gonna push the skiffy bits here, so
there could be some rapid aging of the embryos, or some such thing. Time
<cough> will tell.

--
Jim G. | A fan of the good and the bad, but not the mediocre
"Can you and your stupid hair let us in?" -- Carlton Lassiter, PSYCH

Jim G.

5/9/2013 4:22:00 PM

0

Mason Barge sent the following on 5/8/2013 5:46 PM:
> On Wed, 08 May 2013 15:13:42 -0500, "Jim G."
> <jimgysin@geemail.com.invalid> wrote:
>
>> Adam H. Kerman sent the following on 5/6/2013 12:19 AM:
>>> My guess is she isn't a clone, which is how she had a child,
>>
>> Agreed. My guess is that she is the original. The source material.
>
> Do you guys have a reason for thinking that a clone can't have a
> child?

For me, it's less of a fertility issue and more of a "one of these
things is not like the others" deal. AFAIAC, they could easily flip
things around and make Sarah the only one who can*not* conceive.

--
Jim G. | A fan of the good and the bad, but not the mediocre
"Can you and your stupid hair let us in?" -- Carlton Lassiter, PSYCH