[jdom-interest] writing XHTML
Jabba Laci
jabba.laci at gmail.com
Wed Nov 12 09:41:26 PST 2008
Hi,
I'm new to the list. I've already used JDOM, but now I have a problem
where I'd like to ask your help.
I want to produce XHTML files, more precisely Xforms. Here is a sample:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</html>
The problem is how to set the xmlns:xforms namespace. I get the
following exception:
Exception in thread "main" org.jdom.IllegalNameException: The name
"xmlns:xforms" is not legal for JDOM/XML Namespace prefixs: Namespace
prefixes cannot begin with "xml" in any combination of case.
Here is what I tried:
Namespace ns;
this.root = new Element("html");
// this line below works for "xmlns"
ns = Namespace.getNamespace("http://www.w3.org/1999/xhtml");
this.root.setNamespace(ns);
// problems arise here:
ns = Namespace.getNamespace("xmlns:xforms", "http://www.w3.org/2002/xforms");
this.root.setNamespace(ns);
Thanks,
Laszlo
More information about the jdom-interest
mailing list