Hi,

On 29.05.2012 02:57, J p wrote:


Marshaller marshaller = context.createMarshaller();
         marshaller.setMapping(mapping);
         marshaller.setWriter(writer);
         marshaller.setNamespaceMapping("","http://www.books.com/120";);
marshaller.setSuppressNamespaces(true);

the xml generated by castor is not formatting properly if i give
suppress namespace as true. Below is the xml which is being genererated,
schemaLocation should have an xsi  prefix ex: xsi:shemaLocation.

Generated xml by castor;
<books xmlns="http://www.books.com/120";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
schemaLocation="http://www.books.com/120 books.xsd">
<book>
<price>
<value>1000</value>
</price>
</book>
</books>
I am not sure whether this is a bug or not, but can you please create a Jira issue for this (setSuppressNamespaces(true") and no xsi:prefix. I will have to look into this.

the unwanted ns1 is generating if i give suppress namespace as false.
but it generates xsi prefix for shemaLocation,

Marshaller marshaller = context.createMarshaller();
         marshaller.setMapping(mapping);
         marshaller.setWriter(writer);
         marshaller.setNamespaceMapping("","http://www.books.com/120";);
marshaller.setSuppressNamespaces(false);

<books xmlns="http://www.books.com/120";

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.books.com/120
books.xsd">
<book>
<price>
<ns1:value xmlns:ns1="http://castor.exolab.org/";>111111</ns1:value>
</price>
</book>
</books>

i dont want to have above ns1... in the xml. what should i do for that?
What does your mapping for <book> llok like ?

Kind Regards
Werner

Thanks


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to