jython lacks working xml processing modules?

gaodexiaozheng at gmail.com gaodexiaozheng at gmail.com
Tue Jul 17 04:35:11 EDT 2012


在 2003年11月24日星期一UTC+8下午7时42分31秒,Paul Boddie写道:
> janeaustine50 at hotmail.com (Jane Austine) wrote in message news:<ba1e306f.0311201805.9df1d9 at posting.google.com>...
> > I'm trying to parse an xml file with jython (not through java parsers
> > like xerces).
> > 
> > I tried minidom in jython 2.1 and 2.2a but all failed.
> > 
> > What can I do? The last resort would be using java parsers. Then how
> > can I use them like python xml parsers? It seems like javadom and
> > javasax has something to do, but I don't know how.
> 
> The Java parsers seem to work quite well with the xml.dom.javadom
> package. First, update your CLASSPATH with references to the necessary
> .jar files - this can be a frustrating process, but I found that
> xercesImpl-2.5.0.jar and xml-apis.jar were a good combination:
> 
>   export CLASSPATH=.../xercesImpl-2.5.0.jar:.../xml-apis.jar
> 
> Then, start jython and try the following:
> 
>   import xml.dom.javadom
>   impl = xml.dom.javadom.XercesDomImplementation()
>   # Use your own filename below!
>   doc = impl.buildDocumentFile("example.xml")
>   # Now, try some PyXML-style DOM properties and methods.
>   doc.childNodes
>   doc.childNodes[0].getAttribute("some-attr")
> 
> I'd seen javadom lurking in PyXML before now, but it's a nice surprise
> to see that it works rather well, especially since I've never seen any
> evidence of anyone using it (as far as I remember).
> 
> Paul

hi,do you know the PyXML whether can be supported by Jython ?
Looking forward to your reply!
Thanks



More information about the Python-list mailing list