This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XML handling in Kawa


On 11/28/2009 05:40 PM, Colin Fleming wrote:
Hi all,

I'm just getting started with Kawa, and I'd like to write some
XML-handling code. However it's not clear to me what the best way of
handling XML in Kawa is.

Kawa has decent functionality for constructing and printing XML. There is also functionality for selecting and querying XML data, but unfortunately that is mostly accessible via the XQuery language. The Scheme API for reading XML values are not all that complete or convenient, alas.

Can I use SSAX and SXML?

I don't know how portable these libraries are. I haven't tried them.


I've seen some
conflicting reports about how well they work, or if they work at all.
Kawa isn't listed as being supported on the SSAX page. I've seen the
examples in the docs for XML and HTML element creation, but I can't
find much about parsing or manipulation of existing XML content.
parse-xml-from-url fails for me:

#|kawa:9|# (require 'xml)
#|kawa:10|#  (parse-xml-from-url "file:/Volumes/Data/dev/kawa-1.9.90/build.xml")
Invalid parameter, was: gnu.kawa.xml.KDocument cannot be cast to
gnu.lists.TreeList
java.lang.ClassCastException: gnu.kawa.xml.KDocument cannot be cast to
gnu.lists.TreeList
	at gnu.kawa.slib.XML.parseXmlFromUrl(XML.scm:9)
	at atInteractiveLevel$9.run(stdin)
	at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:347)
	at gnu.expr.ModuleExp.evalModule(ModuleExp.java:204)
	at kawa.Shell.run(Shell.java:309)
	at kawa.Shell.run(Shell.java:194)
	at kawa.Shell.run(Shell.java:169)
	at kawa.repl.main(repl.java:1001)

That's a Kawa bug. I just checked in a fix for that. You can checkout the update or as a work-around do:

(gnu.kawa.xml.Document:parse "file:xxxx")

This creates an XML "document" object - which implements
org.w3c.dom.Document, but somewhat incompletely.  (There
appears to be a bug in getDocumentElement.)
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]