Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

RE: [jdom-interest] Using xml prefix for an attribute

Rolf Lear

2003-11-25


RE: [jdom-interest] Using xml prefix for an attribute

Use:

e.setAttribute("lang", "de", Namespace.XML_NAMESPACE)

Rolf

-----Original Message-----
From: jdom-interest-admin@jdom.org
[mailto:jdom-interest-admin@jdom.org]On Behalf Of Morten
Sent: Tuesday, November 25, 2003 10:59 AM
To: jdom-interest@jdom.org
Subject: [jdom-interest] Using xml prefix for an attribute



Hi.

I'm serializing some data to TMX (an XML based format), which requires
an attribute in the xml NS, eg. xml:lang="de". I've tried the following:

Element e = new Element("elem");
e.setAttribute("lang", "de",
    Namespace.getNamespace("xml","http://www.xml.org/"))

But the JDOM complains:

[sauron]~>java test
Exception in thread "main" org.jdom.IllegalNameException: The name "xml"
is not legal
for JDOM/XML Namespace prefixs: Namespace prefixes cannot begin with
"xml" in any comb
ination of case.
         at org.jdom.Namespace.getNamespace(Namespace.java:154)
         at test.main(test.java:12)

What to do..?

Thanks in advance,

Morten



_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

©2008 junlu.com - Jax Systems, LLC, U.S.A.