[m-rev.] For review: Convert Mercury terms to XML

Ian MacLarty maclarty at cs.mu.OZ.AU
Mon Dec 6 15:51:30 AEDT 2004


On Mon, Dec 06, 2004 at 03:29:45PM +1100, Julien Fischer wrote:
> 
> On Mon, 6 Dec 2004, Ian MacLarty wrote:
> 
> > On Sun, Dec 05, 2004 at 07:34:58PM +1100, Julien Fischer wrote:
> > >
> > > On Sat, 4 Dec 2004, Ian MacLarty wrote:
> > >
> > > > For review by anyone.
> > > >
> > > > Estimated hours taken: 60
> > > > Branches: main
> > > >
> > > > Add library module to convert Mercury terms to XML documents and generate DTDs
> > > > for Mercury types.
> > > >
> > > I think that the log message could include more detail than that.
> > >
> > I've added the following:
> >
> > There is a natural mapping from Mercury terms to XML documents since both are
> > tree structures.  Each functor of a Mercury type is mapped to an element name
> > in the XML document.  Extra information such as the original functor name, type
> > and field name are stored as attribute values.
> >
> A sentence or two about the intended uses of this module, e.g as part of
> a term browser woudl also be helpful - otherwise thats ok.
> 
I've added the following:

Once a Mercury term is in XML it can be converted to many different formats 
using the appropriate stylesheet.  For example it could be converted to HTML
for a web server or converted to XUL to generate user interface components.
The advantage of this approach is that once the appropriate stylesheet has been
set up, generating HTML, XUL, MusicXML or whatever is as easy as generating a 
Mercury term.  

This library will be used to create a graphical term browser for mdb and 
possibly browsable HLDS dumps.

> > > > extras/xml_stylesheets/mercury_term.xsl
> > > > extras/xml_stylesheets/xul_tree.xsl
> > > > 	Some example stylesheets.  One to convert XML generate with the
> > > > 	to_xml library to a Mercury term and one to generate a XUL
> > > > 	term browser for viewing with Mozilla or Firefox.
> > > >
> > > You should also have a README file that explains how to use these stylesheets.
> > >
> > Index: extras/xml_stylesheets/README
> > ===================================================================
> > RCS file: extras/xml_stylesheets/README
> > diff -N extras/xml_stylesheets/README
> > --- /dev/null	1 Jan 1970 00:00:00 -0000
> > +++ extras/xml_stylesheets/README	6 Dec 2004 03:40:10 -0000
> > @@ -0,0 +1,17 @@
> > +This directory contains some example stylesheets for use with the term_to_xml
> > +library module.
> > +
> > +You can apply a stylesheet to an XML document using the program
> > +xsltproc (available from http://xmlsoft.org/XSLT) or any other XSLT tool.  You
> > +can also include a reference to the stylesheet in the XML document and have
> > +your browser apply the stylesheet, although this only works with some browsers.
> > +
> > +mercury_term.xsl
> > +	Stylesheet to convert an XML document generated with
> > +	term.write_xml_doc/6 back to a Mercury term suitable for reading with
> > +	io.read/3.
> > +
> > +xul_tree.xsl
> > +	Stylesheet to convert an XML document generated with
> > +	term.write_xml_doc/6 to a XUL tree structure suitable for browsing
> > +	with Mozilla or Firefox.
> >
> s/term.write_xml_doc/term_to_xml.write_xml_doc/
> 
Fixed.


Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list