python from Java

Alan Kennedy alanmk at hotmail.com
Tue Sep 7 14:07:04 CEST 2004


[Alan Kennedy]
>>I think the best solution for you is to use and event-based python
>>parser to parse your XML. 

and

>>What you should consider is building your own object model, based on the
>>events generated by your SAX parser. Although this sounds hard, it is
>>actually extremely easy, as this ActiveState cookbook entry shows.
>>
>>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/149368
>>
>>There are also multiple cpython products which will build a python
>>object model from XML events: all of these should be comparatively cpu
>>and memory efficient.
>>
>>Objectify
>>http://gnosis.cx/download/gnosis/xml/objectify
>>
>>Anobind
>>http://uche.ogbuji.net/tech/4Suite/anobind/
>>
>>ElementTree
>>http://effbot.org/downloads/#elementtree

[Ajay]
> okay i tried the above approaches but no luck. See the problem is an XML
> parser which works on a PDA - pythonce. Now elementtree uses pyexpat
> (which  pythonce doesn't have), objectify just needs expat which i dont
> have either and anobind needs 4Suite - there is no port for it to a PDA.
> so i am back to where i was earlier.
> looking for a reasonably fast and efficient xml parser that works on a PDA
> (DOM or SAX, i dont care)

I see.

OK, rather than us trying to suggest multiple possible solutions, only 
to find out that they are not supported on python-ce, because of lack of 
expat, etc, please can you list for us the xml parsers that *do* work on 
python-ce.

Particularly, I'm interested in whether the xml.sax modules work. Also, 
check to see if sgmllib works, since that can also be used as an 
efficient XML parser. There's got to be *some* event-based XML parser on 
python-ce, even if it is pure-python.

Start by looking at this HOWTO, and see if you can get any of the 
examples running.

http://pyxml.sourceforge.net/topics/howto/section-SAX.html

Once you've got a working event parser, then we'll figure out the best 
way to build a python object model for your xml files.

regards,

-- 
alan kennedy
------------------------------------------------------
email alan:              http://xhaus.com/contact/alan



More information about the Python-list mailing list