[jdom-interest] xmlns="" in children elements of root

Rodney S. Foley rsfoley at harddollar.com
Wed Aug 29 09:22:22 PDT 2001

Thanks Alex.

The QUESTION from the FAQ:

"Why do I need to pass in a Namespace to getChild(), when the child element
I'm looking for has no namespace declaration?"

It states that children inherit their namespace from their parent.

It states that when reading you programmatically there for have to get the
children with the namespace. 

It states that when creating you programmatically do NOT have to provide the
children with their namespace when .

But then it contradicts itself and states that if you leave out the
namespace programmatically when creating that you will end up with a ""

And if I add the namespace to every element then it creates correctly,
however this seems like extra work that should not need to be there. That if
I add a child to an element, and it does not have a "xmlns" declared that it
gains the parents namespace.

This seems cleaner from a user of the API's point of view.  And keeps it
more inline with how the XML namespace spec READS on w3c, and therefore less

-----Original Message-----
From: Alex Rosen [mailto:arosen at silverstream.com]
Sent: Wednesday, August 29, 2001 8:56 AM
To: 'Rodney S. Foley'; jdom-interest at jdom.org
Subject: RE: [jdom-interest] xmlns="" in children elements of root

There's a FAQ entry on jdom.org about namespaces that talks about this.


> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Rodney S. Foley
> Sent: Wednesday, August 29, 2001 11:12 AM
> To: 'jdom-interest at jdom.org'
> Subject: [jdom-interest] xmlns="" in children elements of root
> I tried this with the beta 7 binaries, and also downloaded the source
> yesterday (8-28-01) afternoon and have the same problem.
> When I give my root element (using XMLOutputter) a namespace of just
> "xmlns=http://www.someplace.com" I do not explicitly assign a 
> namespace to
> any of the children elements at any level, but the first 
> level children of
> the root are assigned a namespace of 'xmlns=""' which I can 
> not figure out
> why and can not get ride of it.  This should not be happening 
> and makes it
> invalid against the schema.  
> Has anyone had this happen to them, and/or does anyone know 
> how to correct
> this.
> Rodney S. Foley
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com

More information about the jdom-interest mailing list