---------[ Received Mail Content ]----------
> Subject : [castor-user] Marshal namespace and nsPrefix question
> Date : Mon, 05 Jan 2009 17:59:55 -0500 (EST)
> From : "d f"
> To :
>
>We're using Castor 1.2 to generate classes off a schema. The schema has
>several namespace imports used.
>
>When marshalling, 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:
>
>
> ABC123
> ABC567
>
>
>
>Example ExpectedResults:
>
>
> ABC123
> ABC567
>
>
>
>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.
>
---------------------------------------------------------------------
My apologies. The sample was mistranslated by my e-mActual Results:<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>
Expected Results:<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>