Re: [xml] Support for Python

On Mon, Jan 28, 2002 at 03:35:34PM -0500, Daniel Veillard wrote:

 On Thu, Jan 24, 2002 at 04:57:39PM -0800, Dave Kuhlman wrote:
 > I've been thinking about ways that libxml (and libxslt) can be used
 > to provide XML support for the Python programming language.

   Right, me too :-)

 >    We should consider providing support in the following areas:
 >      * Support for the DOM interface built on libxml (or gdome?).

    I would split it into:
      - Support for the tree interface built on libxml
      - Support for the DOM2 api built on gdome2

Good idea.  Divide the problem into managable parts.

In two or three more days, I hope to make available what I've done
in the way of SWIG wrappers for the definitions in tree.h.  Then,
we can decide whether that is a worthwhile starting point or not.

 >      * Support for the SAX interface built on libxml.
 >      * Support for XSLT built on libxslt. (Possibly a discussion for the
 >        libxslt list.)

   Yep, let's keep XSLt separate for a bit.

Sounds good.


   SAX support should be close to trivial. I expect something similar
 to your current interface but also allowing a compatible use with
 the xmllib and sgmlop interface where the callbacks are just
     - close
     - getmethodname
     - data
     - start

     - end
     - handle_entityref

I'll look into this.  I believe that the interface is defined (more
or less) in PyXmlversion/doc/xml-ref.txt.  I'm also assuming (until
proven wrong) that pyexpat implements this interface and that I can
discover it by studying the implementation of pyexpat.

I wonder, is there a minimal interface that each driver must
implement?  I believe that we will want to implement that basic
interface _plus_ a few extensions, e.g. (1) request validation, (2)
turn individual event handlers on an off during the parse.  I'll
try to look into this, too.

    Should be trivial to be able to handle both and would allow very easilly
 migration of existing code,

 >    Creating a parser driver for PyXML built on libxml seems like a very
 >    good idea. There are several benefits to be gained from doing so:

    Since I don't know PyXML, I will abstain from commenting on this ATM.
 seems this should be trivially implementable with just glue python code
 on top of the sAx interface.

My understanding is that other support in PyXML (e.g. DOM) is built
on top of the SAX drivers.  For example, when you build a DOM tree,
a SAX driver is used (although it seems a bit tricky to control
which driver is selected).

 >   Additional Notes

    Isn't Python2 internationalization layer based on UTF16 strings ?
 libxml/libxslt uses UTF8 . Is there any gain of trying to follow the
 Python2 conventions ? Is there any risk by staying with UTF8 strings
 seens as usual python strings ?

    Converting to/from UTF16 all the time would be a killer.


 Daniel Veillard      | Red Hat Network
 veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

Dave Kuhlman
dkuhlman rexx com

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