Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25472
| From | gaodexiaozheng@gmail.com |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: jython lacks working xml processing modules? |
| Date | 2012-07-17 01:35 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <dbb0ce68-8984-4d18-9fe7-2ad1a77f7e31@googlegroups.com> (permalink) |
| References | <ba1e306f.0311201805.9df1d9@posting.google.com> <23891c90.0311240342.46419188@posting.google.com> |
在 2003年11月24日星期一UTC+8下午7时42分31秒,Paul Boddie写道: > janeaustine50@hotmail.com (Jane Austine) wrote in message news:<ba1e306f.0311201805.9df1d9@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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: jython lacks working xml processing modules? gaodexiaozheng@gmail.com - 2012-07-17 01:35 -0700
Re: jython lacks working xml processing modules? Stefan Behnel <stefan_ml@behnel.de> - 2012-07-17 11:31 +0200
Re: jython lacks working xml processing modules? Matej Cepl <mcepl@redhat.com> - 2012-07-17 11:39 +0200
Re: jython lacks working xml processing modules? Stefan Behnel <stefan_ml@behnel.de> - 2012-07-17 12:02 +0200
Re: jython lacks working xml processing modules? gaodexiaozheng@gmail.com - 2012-07-17 20:12 -0700
Re: jython lacks working xml processing modules? gaodexiaozheng@gmail.com - 2012-07-17 20:12 -0700
Re: jython lacks working xml processing modules? Matej Cepl <mcepl@redhat.com> - 2012-07-18 10:09 +0200
csiph-web