Due to CXF-3401, it's not easy/straight forward to get the namespaces defined 
upper level.   That will be fixed in 2.3.4/2.4.

That said, I don't know why it's even outputting them.   All the HashMap 
adapter things I've written don't end up with that.    Can you send along a 
sample that does that?

For example, the java-first-jaxws sample we have has a HashMap thing and it 
doesn't generate the xsi:type things and such.  

Dan



On Tuesday 15 March 2011 11:23:03 AM KARR, DAVID (ATTSI) wrote:
> I'm using CXF with classes defined with JAXB annotations.
> 
> All of my JAXB-annotated classes are in a single package, along with a
> package-info.java file.
> 
> In general, the XML and schema rendered from these annotations is fine.
> However, I've been struggling with two Map attributes.  As JAXB can't
> render Maps on its own, I'm using @XmlJavaTypeAdapter to map my HashMap
> type to an adapter.
> 
> My first attempt at getting the schema excerpt for the Map that I wanted
> didn't work, for unexplained reasons (JAXB fails deep within with a
> NPE), but I was able to find a more conventional structure which works
> well enough.  I discussed this problem on a different thread.
> 
> Now I'm trying to do a little cleanup.  Currently, the Map is rendering
> like this:
> 
>               <entries>
>                 <entry>
>                   <key
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:xs="http://www.w3.org/2001/XMLSchema"; xsi:type="xs:string">g</key>
>                   <value
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:xs="http://www.w3.org/2001/XMLSchema";
> xsi:type="xs:string">h</value>
>                 </entry>
>                 <entry>
>                   <key
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:xs="http://www.w3.org/2001/XMLSchema"; xsi:type="xs:string">e</key>
>                   <value
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:xs="http://www.w3.org/2001/XMLSchema";
> xsi:type="xs:string">f</value>
>                 </entry>
>               </entries>
> 
> It puts those namespaces on every key and value it renders.  No other
> elements besides the root element have namespace definitions.  I'd
> prefer to have those namespace definitions appear on the root element.
> I've already tried defining these namespaces in @XmlNs annotations
> inside the @XmlSchema annotation in the package-info.java file, but that
> doesn't fix this.

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com

Reply via email to