Discussion:
[castor-dev] Problem in marshalling elements (sending request)
Westhveg
2009-11-05 10:31:04 UTC
Permalink
Hello,

I'm using castor 1.3. I have a problem with marshalling, let me explain with
some code:

This is my class configuration in mapping.xml file:

<class name="com.mypackage.MyClass">
<map-to xml="myXmlElementA" ns-uri="http://mynamespaceuri/" ns-prefix="tns"
/>

<field name="value" type="java.lang.String" required="true">
<bind-xml name="myXmlElementB" node="element" />
</field>
</class>

And this is the resulting XML when it sends the request:

<tns:myXmlElementA xmlns:tns="http://mynamespaceuri/">
<tns:myXmlElementB>Input Value</tns:myXmlElementB>
</tns:myXmlElementA>


But I need this:

<tns:myXmlElementA xmlns:tns="http://mynamespaceuri/">
<myXmlElementB>Input Value</myXmlElementB>
</tns:myXmlElementA>


How can I remove the 'tns' prefix from 'myXmlElementB'?


Thanks in advance,

Westhveg
--
View this message in context: http://old.nabble.com/Problem-in-marshalling-elements-%28sending-request%29-tp26209995p26209995.html
Sent from the Castor - Dev mailing list archive at Nabble.com.


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

http://xircles.codehaus.org/manage_email
Werner Guttmann
2009-11-28 11:36:33 UTC
Permalink
Hi,

that's difficult to answer, to be honest, as qualification is not
straight-forward.

Let me first ask a question myself: do you have an XML schema for that
XML document instance you are showing below ? If so, what's the
elementFormDefault attribute set to ?

Regards
Werner
Post by Westhveg
Hello,
I'm using castor 1.3. I have a problem with marshalling, let me explain with
<class name="com.mypackage.MyClass">
<map-to xml="myXmlElementA" ns-uri="http://mynamespaceuri/" ns-prefix="tns"
/>
<field name="value" type="java.lang.String" required="true">
<bind-xml name="myXmlElementB" node="element" />
</field>
</class>
<tns:myXmlElementA xmlns:tns="http://mynamespaceuri/">
<tns:myXmlElementB>Input Value</tns:myXmlElementB>
</tns:myXmlElementA>
<tns:myXmlElementA xmlns:tns="http://mynamespaceuri/">
<myXmlElementB>Input Value</myXmlElementB>
</tns:myXmlElementA>
How can I remove the 'tns' prefix from 'myXmlElementB'?
Thanks in advance,
Westhveg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Loading...