Java Mailing List Archive

http://www.junlu.com/

Home » user.castor »

[castor-user] Re: Multiple namespace prefixes for the same schema/ validation issue
with XSI:TYPE

Andriy Kharchuk

2010-09-02

Replies: Find Java Web Hosting

Author LoginPost Reply
Second one was resolved with marshaller.setSuppressXSIType(true);
Still wondering why for some elements of the same kind as arena xsi:type was not used by marshaller.

On Thu, Sep 2, 2010 at 10:08 PM, Andriy Kharchuk <andriy.kharchuk@gmail.com> wrote:
I resolved the first problem by invoking
marshaller.setNamespaceMapping("fifa", "http://www.fifa.com/2014");

Second problem is still there....



On Thu, Sep 2, 2010 at 5:40 PM, Andriy Kharchuk <andriy.kharchuk@gmail.com> wrote:
Dear group,

I used xsd schema to generate java classes/descriptors. Then I created a java object tree using these classes and marshalled it to the xml file.

XML file generated by Castor 1.1.2 is similar to one below:
-------------
<game >
    <ns0:arena xmlns:ns0="http://www.fifa.com/2014" id="1421" xsi:type="ns0:arena"/>
    <ns1:team xmlns:ns1="http://www.fifa.com/2014" country="Brazil" code="BR"/>
</game>
<game>
    <ns2:team xmlns:ns2="http://www.fifa.com/2014" country="Iran" code="IR"/>
</game>
...
<game>
    <ns128:team xmlns:ns128="http://www.fifa.com/2014" country="Mongolia" code="MG"/>
</game>
-------------


1. Is there a way to move namespace definition to the root element so that my xml file doesn't have zillions of namespace prefixes for the same schema (ns*)?
2. Validation in XML Spy  fails with the message 'No type definition found for the type referenced by the attribute 'xsi:type'='ns0:arena' of element <ns0:arena>. Can anything to be done about this?

Thank you,
Andriy



©2008 junlu.com - Jax Systems, LLC, U.S.A.