[Jython-users] coercion error
by Andres Corrada-Emmanuel other posts by this author
Oct 31 2001 4:05PM messages near this date
Re: [Jython-users] equivalent of posixmodule.c in jython implementation?
|
[Jython-users] Exception handling ...
Hello,
I'm trying to set-up Jython to use the XML functionality in jaxp.jar and
parser.jar. The code fails with an error of the form:
TypeError: parse(): 1st arg can't be coerced to java.io.File,
org.xml.sax.InputSource, java.io.InputStream or String
The code is as follows:
# Create new SAXParser
factory = SAXParserFactory.newInstance()
saxParser = factory.newSAXParser()
# Create new handler
handler = BookLibrary()
# The test file to parse
file = java.io.File('./books.xml')
saxParser.parse( file, handler)
It seems that "parse" is being fed the class instance first, but I cannot
figure out how to do the call properly. Similar code works within Java
code, so I know classes are being recognized and have the required
methods.
Any clue what I'm doing wrong? Thank you.
Andres Corrada-Emmanuel
Senior Research Fellow
Center for Intelligent Information Retrieval
University of Massachusetts, Amherst
_______________________________________________
Jython-users mailing list
Jython-users@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-users
|