[jdom-interest] writing XHTML

Michael Kay mike at saxonica.com
Wed Nov 12 10:13:16 PST 2008


It should be

Namespace.getNamespace("xforms", "http://www.w3.org/2002/xforms");

The "xmlns:" is not part of the namespace prefix.

It's a strange error message though: "Namespace prefixes cannot begin with
"xml" in any combination of case". What the specification actually says is:

<quote>
All other prefixes beginning with the three-letter sequence x, m, l, in any
case combination, are reserved. This means that:

    * users SHOULD NOT use them except as defined by later specifications
    * processors MUST NOT treat them as fatal errors. 
</quote>

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: jdom-interest-bounces at jdom.org 
> [mailto:jdom-interest-bounces at jdom.org] On Behalf Of Jabba Laci
> Sent: 12 November 2008 17:41
> To: jdom
> Subject: [jdom-interest] writing XHTML
> 
> 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
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@you
> rhost.com



More information about the jdom-interest mailing list