Java Mailing List Archive

http://www.junlu.com/

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

Re: [jdom-interest] Second element xmlns=""

Per Norrman

2004-09-17


Myron Uecker wrote:
> I created a brand new XML document, added a root element with two
> namespaces, xmlns="..." and xmlns:xsi="...". I then added several more
> elements and sub-elements. On the second element, I get xmlns="" . Why
> is this? Can it be shut off? Here's an example:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <SubmitRequest xmlns="http://myns"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <ResourcePlan xmlns="" resource="..." day="2004-08-06">
>  <ResourcePlanHourly hour="01">
> ...

You created the <ResourcePlan> elemnt in NO namespace, that's why. You
probably wanted it in "http://myns" namespace.

When dealing with namespaces, always use the namespace aware
constructors and access methods.

/pmn
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)

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