[jdom-interest] cannot create xmlns namespace?

Phillip Rhodes spamsucks at rhoderunner.com
Sat Jul 20 16:15:53 PDT 2002


Thanks.  That kind of worked...
But now I have xmlns declarations on all my child elements.  I know I can 
add the namespace manually on all my children content, but that would 
create like <html:head></html:head> instead of <head></head>

Is there anyway to add a namespace to a element so that doesn't 
happen?  What I want is this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>

Here is what is happening now:
<html xmlns="http://www.w3.org/1999/xhtml">
    <head xmlns="" xmlns="http://www.w3.org/1999/xhtml">
       <title xmlns="" xmlns="http://www.w3.org/1999/xhtml">Test</title>
    </head>

Thanks.  I appreciate it.



At 02:20 PM 7/20/2002 -0500, Bradley S. Huffman wrote:
>I think you want:
>
>     Namespace ns2 = Namespace.getNamespace("http://www.w3.org/1999/xhtml");
>
>Brad
>
>Phillip Rhodes writes:
>
> > Hi everyone.
> > I am trying to create an xhtml document with jdom.
> > Here is an example fragment of the document that I want to generate in 
> jdom.
> >
> > <html xmlns="http://www.w3.org/1999/xhtml">
> >
> > I did the following:
> > Namespace ns2 = Namespace.getNamespace("xmlns",
> > "http://www.w3.org/1999/xhtml");
> > Element html = new Element("html",ns2);
> >
> > It errors out when I try to create this namespace because it begins with
> > "xml".
> > The specific error is:
> > The name "xmlns" is not legal for JDO M/XML Namespace prefixs: Namespace
> > prefixes cannot begin with "xml" in any combination of case. [java] at
> > org.jdom.Namespace.getNamespace(Namespace.java:161) Ruby Test
> >
> > Is there a way to generate this element with this namepace?
> >
> > If I can do this, great!  But I fear that at this point you are saying,
> > "what the heck do you want to do this for?"
> > I am programmatically generating this document as an xhtml file that I 
> will
> > transform into fo using a stylesheet.
> > If I don't put this namepace declaration in my html element, the
> > transformation to fo fails.  Here is what I think is the applicable 
> part of
> > the xsl file:
> >
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > xmlns:fo="http://www.w3.org/1999/XSL/Format"
> > xmlns:html="http://www.w3.org/1999/xhtml">
> >
> >
> > Thanks.
> >
> >
> >
> >
> > _______________________________________________
> > 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