You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Randy Hoffman <ra...@punkass.com> on 2006/02/02 23:43:47 UTC

OMElement and XML namespaces

I have a question about the way axis2 handles XML namespaces.  I create
three namespaces and then declare them at the root OMElement.  I then
create child OMElements using the namespaces declared in the root element.
Upon the first reference of a prefix in a child element, a xmlns:"mynamespace" 
gets created on that element.  Further use of the prefix does not generate the
xmlns: attribute.  Shouldn't the element be able to reference the declared
namespace in the root element?  Here is an example.

This is what i would expect by declaring ord, prd and ven namespaces:

<ord:ORDER xmlns:ord="http://order/" xmlns:prd="http://product/" xmlns:ven="http://vendor/">
  <prd:id>12345</prd:id>
  <prd:qty>54321</prd:qty>
  <ven:id>123</ven:id>
  <ven:sub>1</ven:sub>
</ord:ORDER>

This is what i get when i build the OMElement:

<ord:ORDER xmlns:ord="http://order/" xmlns:prd="http://product/" xmlns:ven="http://vendor/">
  <prd:id xmlns:prd="http://product/">12345</prd:id>
  <prd:qty>54321</prd:qty>
  <ven:id xmlns:ven="http://vendor/">123</ven:id>
  <ven:sub>1</ven:sub>
</ord:ORDER>

I would expect the namespace definition would not have to be repeated in 
the first reference.

Am i doing something wrong, or is this intentional, or possibly a bug?

Thanks,
randy