[XML-SIG] drv_javasax and InputSource

Lars Marius Garshol larsga@garshol.priv.no
14 Jan 2002 19:10:29 +0100


Hi Stéphane,

* Stéphane Bidoul
| 
| With PyXML and Python (C), I typically write this kind of code,
| parser being an XMLReader:
| 
| >> parser.parse(open("test.xml"))
| 
| Now, using jython and drv_javasax, it complains with:
| 
| >> TypeError: parse(): 1st arg can't be coerced to org.xml.sax.InputSource or String

This is a bug, since the library documentation explicitly says that
file-like objects are allowed.
 
On the other hand, this means wrapping PyFile instances to make them
look like Readers or InputStreams, which I seem to recall is quite
difficult.

Could you report this in the bug tracker, and I'll add a comment
explaining what needs to be done. After that we can see who wants to
dea with this. (drv_javasax actually needs more work than just this,
in order to be a full driver.)

| - what is the best way to create a java.io.InputStream from
|   an open python file (sorry if this is a jython FAQ), 
|   or even better an org.xml.sax.InputSource from 
|   a python xml.sax.xmlreader.InputSource? 

Good question. I don't think this is entirely straightforward,
unfortunately. Input on this would be much welcome.

--Lars M.