[Haskell-cafe] Re: Lazy XML handling
MR K P SCHUPKE
k.schupke at imperial.ac.uk
Sat May 22 00:31:40 EDT 2004
>The standard representation should be a tree datatype
Why not separate the parser and tree builder, have the parser stream the
tags out, and define the tag stream as the interface to a DOM builder...
parse :: String -> [(XmlTreeDepth,XmlElement)]
buildDOM :: [(XmlTreeDepth,XmlElement)] -> DOM
Thats how I would do it anyway. I appreciate the comments about efficency, I
was really talking about simplicity. The algorithms on the steam can be
quite simple, and hence avoid bugs.
I would still want to dispense with the DOM, which if you think about
the system thus:
Parser -> [stream] -> DomBuilder -> DOM - operations on DOM
You can push the operations on the dom via a structural transformation
back through the DomBuilder, such that they operate directly on the
stream...
In other words the user composes the functions as if they are operating
on a real DOM... only the DOM is never constructed and the operations
are applied direct to the stream output of the parser.
make sense?
Keean.
More information about the Haskell-Cafe
mailing list