I'm new to castor and I wanted to use a mapping file in order to modify my
xml-file in the marshalling process. But the mapping file has no effect.
Here is the mapping file (Mapping.xml):
<?xml version="1.0" encoding="iso-8859-1"?>
<mapping>
<class name="bestellung.IDOC">
<map-to xml="IDOC"/>
<field name="BEGIN" type="string">
<bind-xml name="BLABLABLA" node="attribute" />
</field>
</class>
</mapping>
Here is the beginning of the original xml file:
<?xml version="1.0" encoding="iso-8859-1"?>
<ORDERS05>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
...
Here is my Java code:
...
FileWriter writer = new FileWriter("Testbestellung_neu.xml");
Marshaller marshaller = new Marshaller(writer);
Mapping mapping = new Mapping();
mapping.loadMapping(new URL("file:/D:/Temp/XML/Mapping.xml"));
marshaller.setMapping(mapping);
marshaller.setEncoding("iso-8859-1");
marshaller.marshal(orders05);
writer.close();
...
I expected the IDOC segment after the marshalling process like the
following:
<IDOC BLABLABLA="1">
The mapping file is in the classpath. When I call the program, there is the
INFO message "Loading mapping descriptors from ...". So the file will be
found. And there are no error messages.
What am I doing wrong ?
--
View this message in context:
http://www.nabble.com/Problem-with-mapping-file-tf4594474.html#a13116384
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email