Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^7: Incremental XML parsing

by runrig (Abbot)
on Feb 05, 2012 at 00:25 UTC ( #951886=note: print w/replies, xml ) Need Help??


in reply to Re^6: Incremental XML parsing
in thread Incremental XML parsing

I still don't see why "large document" == "need incremental parser". I can see why you would need a stream parser (e.g. *::SAX XML::Twig XML::Rules). Non-incremental stream parsers parse large documents just fine without parsing the entire document into memory.

Replies are listed 'Best First'.
Re^8: Incremental XML parsing
by Anonymous Monk on Feb 05, 2012 at 02:51 UTC
    Asked and answered: "...but also to be able to consume the input document in pieces, such as feeding data as it arrives over the wire." If the data is too large for the filesystem, you might want to process it as it arrives.
      Too large in what way? I don't really see how you can gain anything by parsing just part of the XML at a time, unless you only need something near the start of the XML - but in that case you could just as easily keep doing a check for the end tag of the section you want, parse out just that part, and feed it to your regular XML parser. Similarly, if your document is a long series of records, you could parse out each record as it arrives and feed it to your regular XML parser. There's no need to go looking for an incremental solution, imho.
        Really, you need a definition of large? My example was if the file couldn't fit on the filesystem. Does that need clarification? And yet another person who didn't read anything else in the thread. I mentioned an existing incremental parser in my OP: XML::SAX::Expat::Incremental, but my problem was it's too slow. Your proposal would be even slower.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://951886]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2021-12-02 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (18 votes). Check out past polls.

    Notices?