axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksander Slominski <as...@cs.indiana.edu>
Subject Re: [Axis2] Namespace serialization problem
Date Mon, 20 Dec 2004 04:48:23 GMT
Ajith Ranabahu wrote:

>Hi all,
>Since there was discussions going down to the code level I guess it
>will be beneficial for all to see how the things would be done with
>the current implementation and give you guys a taste of the code.
>
>        OMFactory factory = OMFactory.newInstance();
>        OMNamespace ns1 = factory.createOMNamespace("bar","x");
>        OMNamespace ns2 = factory.createOMNamespace("bar","y");
>
>        OMElement elt1 = factory.createOMElement("foo",ns1);
>        OMElement elt2 = factory.createOMElement("yuck",ns2);
>
>        OMText txt1 = factory.createText(elt2,"blah");
>
>        elt1.addChild(elt2);
>        elt2.addChild(txt1);
>
>        SimpleOMSerializer serializer = new SimpleOMSerializer();
>        serializer.serialize(elt1, writer);
>
>This is the produced serialization
>
><x:foo xmlns:x="bar">
>   <y:yuck xmlns:y="bar">blah</y:yuck>
></x:foo>
>
>I guess it is desirable to have the y namespace declared in the root
>element but the serializer does the namespace serialization only when
>it encounters the prefix for the first time.
>  
>
so there is no declareNamespace() functionality?

XmlPull (setPrefix() call) and i think StAX serializer allows to 
exlicitly request writing namespace declaration (xmlns:prefix='...') so 
if element has namespace declarations aattached it should be easy to 
make serializer to write them?

thanks,

alek

-- 
The best way to predict the future is to invent it - Alan Kay


Mime
View raw message