Re: [xml] htmltree module question



dilbertOn Wed, 2004-03-31 at 04:23, è?? å­?è¶? wrote:

I want to parse a XML document and render it into a HTML document.  So far, 
I know libxml2 can parse a XML into a tree.  What I want to know is, how do 
you pass the data in the tree to a HTML document?  Is it HTMLtree module?  
What functions do I use?  Can anyone provide a code example?

You do not provide very much information about what you want to do here.
There are many ways to map and XML document into an (X)HTML document and
which way is most appropriate depends upon a number of things, such as
the semantics of the XML elements you are using.

For example, how do you see a document such as 

        <zz>foo<xx/></zz>

being converted to HTML? There is no "natural" mapping between the
elements, so more domain knowledge is required. It might turn out that
in this case (if you are not using XSLT as I mention below), you will
end up walking the tree you have created and creating an tree with XHTML
elements in it as you go (or directly outputting the result if more
convenient).

It may be that the simplest approach is to write an XSLT document for
converting the XML and then use xsltproc (or the equivalent function
calls in libxslt) to do the translation.

Malcolm



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]