in reply to XML::Simple noisy option?

I didn't read the source code of XML::Simple and all those related, but theoretically no SAX parser should slurp a whole file before it start parsing, if it does, it is really poorly designed, and should not consider to use it at all.

The design objective of SAX is to parse XML data as a stream on fly. Remember the data source can be a TCP port, SAX would parse the XML stream when data is still coming.

As a design cosideration, it would be terribly inefficient, not to use the idle time in between TCP communication. Terrible.

On the other hand, remember, even with all the best design consideration, XML parsing is still very slow. This is not something you can escape at this stage of XML's life cycle.

Update:

After received serveral msg's from mirod. I realized that this is some orange/apple thing.

  1. XML::Simple does not "slurp" the file in order to use SAX parser. When I say "slurp", I mean to read in the whole file BEFORE parsing. This is my version of "slurp".
  2. XML::Simple would eventually store the WHOLE result it got back from the parser in memory, so eventually the file is "slurped". That's his version of "slurp".

    I understood that XML::Simple did that, that's okay with me and that's the purpose of XML::Simple, but that's not my "slurp" ;-)
A person finished 9 scoops of ice cream in 1 minute, I will say he slurped it. Another person finished 9 scoops of ice cream in 1 hour, yes, the ice cream eventually all stored in his gut ;-) but I don't call that slurp.

I think we down voted each other, that's fine and that's part of the life here ;-). Couple of XP points is much less important than to make the facts straight. In this sense, we both did well.

Replies are listed 'Best First'.
Re: Re: XML::Simple noisy option?
by mirod (Canon) on Jan 30, 2003 at 04:16 UTC

    XML::Simple is not a SAX parser. It is a module that lets you load XML data into a Perl structure. It works on top of a parser, which can be XML::Parser or, since versions 1.08_01, any SAX parser. So by (good) design it slurps a whole XML file into memory.

    Not only did you not read the code, it looks like you did not read the documentation either ;--)

      "So by (good) design it slurps a whole XML file into memory."

      Okay, now I traced each line of the source code. I think we are lucky that the XML::Simple module didn't follow your good design and slurp the file.

      Slurping a whole file, in order to use a SAX::Parser? Good he/she didn't do it.

      To be frank with you, the point is really not whether XML::Simple slurp the whole file or not, that's not something you or me can change, it was just done in that way, but it is a very poor judgement to praise "slurp a whole file" as a good design in this context.