axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ajith Ranabahu <>
Subject Re: [Axis2] Namespace serialization problem
Date Fri, 17 Dec 2004 04:13:07 GMT
On Fri, 17 Dec 2004 09:39:45 +0600, Sanjiva Weerawarana
<> wrote:
> Wait I'm confused. If you say builder.newElement (NS, localName)
> then the new element *better* have the namespace declared or
> its wrong XML+Namespaces.
> Right??

Well, Not always but it has its advantages. imagine that you want to
serialize (into Text) only a part of the Object model (say one single
element). Then that piece of XML should have the correct namespaces
declared. However when the whole object model is converted into text,
the namespaces appear in different places but correctly formatted.
Have a look at my previos mails for a code sample :)
> So the element node has to include this NS declaration, unless the same
> NS node exists "up the tree." Since the node isn't parented yet you
> can't go searning up the tree yet .. so are you suggesting that that
> search occur at the point of being added as a child of another element?
I thought of this. But it seems to be a messy thing. Check the
namespaces in every addChild operation?
> Even if its declared on the parent the user may have re-declared it.
> Do we want to "clean up" the XML in that case and remove redundant
> NS declarations?? Round-tripping would suffer, of course.
> Sanjiva.

what I have already done to prevent this and still make it right, I
deal with it in the serializer. Let the namespace (may be immutable or
may be not) be bound to elements but the serializer deals with it
correctly at the time of writing the XML out.

Ajith Ranabahu

View raw message