Re: python from Java

From: Alan Kennedy (alanmk_at_hotmail.com)
Date: 09/07/04


Date: Tue, 07 Sep 2004 13:07:04 +0100


[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


Relevant Pages

  • Re: Word 2003 XML
    ... In essence the parser determines whether the XML provided to it, ... have much info. about the schemas associated with an XML document. ... (which is what namespaces are all about). ...
    (microsoft.public.mac.office.word)
  • Re: My Regexp XML Parser -> Structured Perl Data, Cut & Paste Version, No Modules (Vol I)
    ... >>>but that's totally useless for XML parsing. ... >Your parser has no appreciation of nesting beyond the very trivial, ... >going to be for your parser to validate against one. ... Wheather or not I can use it to write a schema checker is something I ...
    (comp.lang.perl.misc)
  • Re: XML SAX parser bug?
    ... > I think I ran into a bug in the XML SAX parser. ... the SAX parser misreads the line. ... > I put a 'print characters' line in the 'characters' method of the ...
    (comp.lang.python)
  • [ANN] XSD/e 1.1.0 - validating XML parser generator for embedded systems
    ... I am pleased to announce the availability of CodeSynthesis XSD/e 1.1.0. ... CodeSynthesis XSD/e is an open-source XML ... parser generator for mobile and embedded systems. ...
    (comp.arch.embedded)
  • [ANN] XSD/e 1.1.0 - validating XML parser generator for embedded systems
    ... I am pleased to announce the availability of CodeSynthesis XSD/e 1.1.0. ... CodeSynthesis XSD/e is an open-source XML ... parser generator for mobile and embedded systems. ...
    (microsoft.public.windowsce.embedded.vc)