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

Brian Colfer bcolfer at get.topica.com
Wed Aug 29 11:45:57 PDT 2001


 

-----Original Message-----
From: Rodney S. Foley
To: 'jdom-interest at jdom.org'
Cc: 'Jason Hunter'
Sent: 8/29/01 11:09 AM
Subject: RE: [jdom-interest] xmlns="" in children elements of root


Also if I move the element around in my code and I never gave it a
namespace I would expect it to have the same namespace as it's new parent.
I think coding with any API should be as intuitive as possible. 

Where this:

Namespace ns = Namespace.getNamespace("http://foo.com");
Element y = new Element("y", ns);
x.addContent(y);
Element z = new Element("z", ns);
y.addContent(z);

And this:

Namespace ns = Namespace.getNamespace("http://foo.com");
Element y = new Element("y", ns);
x.addContent(y);
Element z = new Element("z");
y.addContent(z);

Are the same. Because that is intuitive to anyone who knows how to READ
or create from scratch an XML File.

-----------------------------------------------

Note that Element z at the time of its creation is not necessarily a child
of y and cannot inherit y's namespace.  What you are actually proposing is
that y.addContent(z) should check if z has a name space assigned if not then
assign y's namespace.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20010829/029a4abd/attachment.htm


More information about the jdom-interest mailing list