[XML-SIG] drv_javasax and InputSource

Stéphane Bidoul stephane.bidoul@softwareag.com
Mon, 14 Jan 2002 17:49:39 +0100


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 error message looks normal given the implementation
of drv_javasax, which simply delegates to the jaxp reader.

So my questions are:

- is this the expected behaviour? while normal in a java environment,
  this is somewhat disturbing when porting python code to jython...
- 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?