This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Announce: an XML parser for Guile


Thierry Bezecourt <bezecourt@globeid.com> writes:

> I have written a Guile interface to expat, James Clark's XML parser
> library.  Expat is an XML 1.0, non-validating parser written in C, which is
> present for example in Mozilla.

> ;; Create the parser object
> (let ((parser (expat:parser-create)))
>  ;; Specify callback functions


Hmm.  This is only a SAX style parser, isn't it?  



>The following functions are extensions to the raw expat interface,
>but I still don't know exactly what to do here. An object-oriented
>interface based on GOOPS and maybe DOM would be very convenient.

Have you looked at GDOM and gnome-xml?

-> http://xmlsoft.org/
-> http://www.levien.com/gnome/domination.html

Basically XML is just the serialized form of the DOM
contents.  By using the SAX style parser you define a state
machine which parses your document.  DOM style parsing
on the other hand means that you create the whole tree in
memory and then pass the nodes to a function which examines
the nodes.

However, GDOM handles it differently.  You create a generic
class which takes a number of "rendering contexts" so that you
can parameterize it with your concrete classes.  For example:
   <p>      -->  render_paragraph
   <img>    -->  render_image
   <table>  -->  render_table

This is pretty much the same as the java beans specification or
(constrained) generics in eiffel.

Yes, I think you need GOOPS to implement this properly.


Jost


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]