(Repost - as the xml was lost in prior post)

We're using Castor 1.2 to generate classes off a schema. The schema has several 
namespace imports used. 

When marshalling the castor generated objects, we'd like to see the namespace 
mapping all defined at the root element and each of the elements referring to 
the namespace by its prefix. Instead, the elements each refer to the namespace 
and add an ns# to be used as a prefix for that element. 

Example ActualResults: 

<order xmlns:pfx1="http://...Item1"; xmlns:pfx2="http://...Item2";...>
<OrderIdReferences>
<ns1:Source xmlns:ns1="http://...Item1"; id=1>ABC123</ns1:SourceCode>
<ns2:Source xmlns:ns2="http://...Item2"; id=2>ABC567</ns2:SourceCode>
</OrderIdReferences>
</order>


Example ExpectedResults: 


<order xmlns:pfx1="http://...Item1"; xmlns:pfx2="http://...Item2";...>
<OrderIdReferences>
<pfx1:Source id=1>ABC123</ns1:SourceCode>
<pfx2:Source id=2>ABC567</ns2:SourceCode>
</OrderIdReferences>
</order>

I've unsuccessfully tried the following when marshalling: 

Marshaller m = context.createMarshaller(); 
m.setRootElement(message.getClass().getSimpleName()); 
m.setUseXSITypeAtRoot(true); 
m.setNSPrefixAtRoot(true); 

m.setNamespaceMapping("pfx1", "http://...Item1";); 
m.setNamespaceMapping("pfx2", "http://...Item2";); 

My apologies if this question has already been answered. 


      

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

    http://xircles.codehaus.org/manage_email


Reply via email to