Re: [Haskell-cafe] Re: Lazy XML handling

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.

At 23:31 21/05/04 +0100, MR K P SCHUPKE wrote:
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...
[...]
make sense?
Makes sense to me, and if I were starting from scratch this approach has some appeal. I don't especially like your correspondent's idea of a "standard representation" in the library, because details are likely to change over time (cf. the introduction of XML namespaces). #g ------------ Graham Klyne For email: http://www.ninebynine.org/#Contact
participants (2)
-
Graham Klyne
-
MR K P SCHUPKE