axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ajith Ranabahu <ajith.ranab...@gmail.com>
Subject Re: [Axis2] Namespace serialization problem
Date Thu, 16 Dec 2004 02:55:12 GMT
On Wed, 15 Dec 2004 13:58:15 -0500, Aleksander Slominski
<aslom@cs.indiana.edu> wrote:
> it seems value and method elements are disconnected? should not value be
> child of method?

Well, yeah, I agree. The code should actually create a text node and
add that as a child I guess. Otherwise setValue will be slightly
confusing.

> >  value.setValue("Isaac Assimov, the foundation Sega");
> >  method.addChild(value);
> >
> >in this case where should the namespace be declared? is it right to
> >have it in the top most element ?
> >

Well What I meant here is that in the text form whether the namespace
declaration is supposed to appear in the top most element.

> i like to declare namespace as constant then reuse it and i like to
> build elements directly
> 
> final static O,Namespace NS = fac.createOMNamespace("http://localhost/my","my");
> 
>  // ...
> 
>  OmElement method =  builder.createOMElement(NS, "echoOMElement",) ;
>  OMElement value =  method.addElement(NS, "myValue") ;
>  value.replaceChildrenWithText("Isaac Assimov, the foundation Sega");
> 

Ok, this is fine. But we can do the same (even if we dont make the
variables static) by configuring the builder so that when you say
createNamespace then it returns the correct instance of the namespace
(if created then the created instance)
 
> >And what should happen if I am to serialize only the value element ?
> >Since this is quite messy I did not deal with it at creation but had a
> >solution for it at the serialization.
> >
> serializer will either declare namespace prefixes automatically or fail
> depending how it is set up - i see no problem here.

Yeah but we have to stick to a policy. I mean we can have a default
namespace declaration in each element (ugly method) or introduce our
own namespace prefix and have it declared once.

> 
> >(this is the approach Srinath
> >refers to as "mess first and sweep later" :)).
> >
> >
> hmm: i prefer to call it creative disorder: one needs  chaos to create
> order out of it :)
> 
> >I keep a list of prefixes that has already being written and writes
> >out the elements own namespace as well as the declared ones if they
> >are already not written.
> >
> >
> StAX and XmlPull serializers can do it automatically no need for OM to
> do it ...

Hmmm.. I have to look into this then! 

> alek
> 

-- 
Ajith Ranabahu

Mime
View raw message