Clearwater, Pete
2003-06-04 17:16:48 UTC
Hi.
I'm trying to use the castor-xml package to generate a very basic xml representation of my java object, then take this xml output and run it through some xslt to generate html. The problem is that Castor seems to be putting in default namespaces (ns1,
ns2, ns3,...) whenever I use a mapping file. If I don't use a mapping file then Castor does not put in any namespace information (which is OK) but the default mappings do not work as I need them to. My example is quite large, but I'll give some
abbreviated text to show the problem:
from mapping file:
<class name="ubc.ems.core.awards.CyclicalAward" access="shared">
<description>Default mapping for class ubc.ems.core.awards.CyclicalAward</description>
<map-to xml="cyclical-award" ns-uri="http://students.ubc.ca" ns-prefix="ubcns"/>
<field name="minDistAmount" type="double">
<bind-xml name="min-dist-amount" node="element"/>
</field>
<field name="rollCycle" type="integer">
<bind-xml name="roll-cycle" node="element"/>
</field>
... plus more...
to do the mapping:
Mapping map = ch.getMapping(obj.getClass().getName());
StringWriter sw = new StringWriter();
BufferedWriter bw = new BufferedWriter(sw);
Marshaller mar = new Marshaller(bw);
mar.setMapping(map);
mar.marshal(obj);
output with mapping file:
<?xml version="1.0" encoding="UTF-8"?>
<ubcns:cyclical-award xmlns:ubcns="http://students.ubc.ca">
<ns1:min-dist-amount xmlns:ns1="http://castor.exolab.org/">100.0</ns1:min-dist-amount>
<ns2:roll-cycle xmlns:ns2="http://castor.exolab.org/">1</ns2:roll-cycle>
... and a whole lot more...
Anyways, if anyone can shed some light on this, it would be greatly appreciated. I've tried various marshaller.setNameSpaceMappings with virtually no effect.
thanks.
pete.
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
***@exolab.org with a subject of:
unsubscribe castor-dev
I'm trying to use the castor-xml package to generate a very basic xml representation of my java object, then take this xml output and run it through some xslt to generate html. The problem is that Castor seems to be putting in default namespaces (ns1,
ns2, ns3,...) whenever I use a mapping file. If I don't use a mapping file then Castor does not put in any namespace information (which is OK) but the default mappings do not work as I need them to. My example is quite large, but I'll give some
abbreviated text to show the problem:
from mapping file:
<class name="ubc.ems.core.awards.CyclicalAward" access="shared">
<description>Default mapping for class ubc.ems.core.awards.CyclicalAward</description>
<map-to xml="cyclical-award" ns-uri="http://students.ubc.ca" ns-prefix="ubcns"/>
<field name="minDistAmount" type="double">
<bind-xml name="min-dist-amount" node="element"/>
</field>
<field name="rollCycle" type="integer">
<bind-xml name="roll-cycle" node="element"/>
</field>
... plus more...
to do the mapping:
Mapping map = ch.getMapping(obj.getClass().getName());
StringWriter sw = new StringWriter();
BufferedWriter bw = new BufferedWriter(sw);
Marshaller mar = new Marshaller(bw);
mar.setMapping(map);
mar.marshal(obj);
output with mapping file:
<?xml version="1.0" encoding="UTF-8"?>
<ubcns:cyclical-award xmlns:ubcns="http://students.ubc.ca">
<ns1:min-dist-amount xmlns:ns1="http://castor.exolab.org/">100.0</ns1:min-dist-amount>
<ns2:roll-cycle xmlns:ns2="http://castor.exolab.org/">1</ns2:roll-cycle>
... and a whole lot more...
Anyways, if anyone can shed some light on this, it would be greatly appreciated. I've tried various marshaller.setNameSpaceMappings with virtually no effect.
thanks.
pete.
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
***@exolab.org with a subject of:
unsubscribe castor-dev