ok i found a workaround
where you add the namespaces to the root you can add the following line;
root.setAttribute(new Attribute("base", "
http://foo.bar/owlTest", Namespace.XML_NAMESPACE));
this does the job ... at least in my case
regards
Larry Levin wrote:
Hi:
I've been using JDom for quite some time with no probelems but just hit
a snag when trying to create an OWL ontology using it. This issue is
that while I set a baseURI for the document, it isnt showing up when the
document is written using the XMLOutputer. The code is as follows:
Namespace rdfsNs = Namespace.getNamespace("rdfs",
"
http://www.w3.org/2000/01/rdf-schema#"); Element root = new
Element("RDF", rdfNs);
:
{ add various namespaces to root }
:
Document doc = new Document(root);
doc.setBaseURI("
http://foo.bar/owlTest");
After building the document, I write it as follows:
Format myFormat = Format.getPrettyFormat();
XMLOutputter outputter = new XMLOutputter(myFormat);
FileOutputStream fo = new FileOutputStream(fileName);
outputter.output(doc, fo);
fo.flush();
fo.close();
The problem is that the xml base decalaration
xml:base="
http://foo.bar/owlTest" must explicitly appear in the output
but doesnt. Any help would be greatly appreciated.
Thanks
Larry Levin
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com