[jdom-interest] Newbie Namespace question

Jason Hunter jhunter at apache.org
Wed Dec 5 10:55:27 PST 2001


Here's the code:

Namespace nsFO = Namespace.getNamespace("fo",
"http://www.w3.org/1999/XSL/Format");
Element e = new Element("root", nsFO);

Namespaces are special and aren't treated like normal attributes.

-jh-

MarkW wrote:
> 
> Hi,
> how can i generate this:
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
> 
> I tried
>   public final static String FOROOT =
> "\"http://www.w3.org/1999/XSL/Format\"";
>   ....
>   Namespace nsFO = Namespace.getNamespace( "fo" );
>   fop = new Element( "root", nsFO );
>   fop.setAttribute( "fo", FOROOT, Namespace.getNamespace( "xmlns" ) );
> 
> but get the error:
> .....
> org.jdom.IllegalNameException: The name "" is not legal for JDOM/XML
> attribute n
> amespaces: An attribute namespace without a prefix can only be the
> NO_NAMESPACE
> namespace.
> TIA
> Mark
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list