I have a mapping.xml file that I used to marshall and unmarshall the XML
data, this file did not change.
<?xml version="1.0" encoding="UTF-8"?>
<mapping>
<class name="com.bluedot.common.action.component.ComponentData">
<map-to xml="component-data"/>
<field name="config" type="boolean">
<bind-xml name="config" node="attribute"/>
</field>
<field name="comp" type="java.lang.String">
<bind-xml name="comp" node="element"/>
</field>
<field name="hide" type="java.lang.Object" collection="arraylist">
<bind-xml name="hide" node="element"/>
</field>
<field name="others" type="java.lang.Object" collection="map">
<bind-xml name="others" node="element"/>
</field>
<field name="msgs" type="java.lang.Object" collection="map">
<bind-xml name="msgs" node="element"/>
</field>
<field name="labels" type="java.lang.Object" collection="map">
<bind-xml name="labels" node="element"/>
</field>
</class>
</mapping>
This mapping file was generated from the Object class below:
public class ComponentData implements Serializable {
private static final long serialVersionUID = 1L ;
private String comp;
private boolean config;
private HashMap<String,String> msgs ;
private HashMap<String,String> labels ;
private ArrayList<String> hide ;
private HashMap<String,String> others ;
public ComponentData() {
msgs = new HashMap<String,String>() ;
labels = new HashMap<String,String>() ;
others = new HashMap<String,String>() ;
hide = new ArrayList<String>() ;
}
public void setComp( String var ) {
this.comp = var ;
}
public String getComp() {
return this.comp ;
}
public void setConfig( boolean var ) {
this.config = var ;
}
public boolean getConfig() {
return this.config ;
}
public void setMsgs( HashMap<String,String> var ) {
this.msgs = var ;
}
public HashMap<String,String> getMsgs() {
return this.msgs ;
}
public void setLabels( HashMap<String,String> var ) {
this.labels = var ;
}
public HashMap<String,String> getLabels() {
return this.labels ;
}
public void setHide( ArrayList<String> var ) {
this.hide = var ;
}
public ArrayList<String> getHide() {
return this.hide ;
}
public void setOthers( HashMap<String,String> var ) {
this.others = var ;
}
public HashMap<String,String> getOthers() {
return this.others ;
}
}
By just adding these 2 lines to the marshaller the generated XML was
like this:
<?xml version="1.0" encoding="UTF-8"?>
<component-data
config="false"><comp>summary</comp><others><key>extraAction</key><value>Housing
Information</value></others><others><key>graphName</key><value>staff
Registration
Form</value></others><others><key>type</key><value>reg</value></others><others><key>extraActionEntity</key>
<value>show_institution_id</value></others><others><key>listOnly</key><value>0</value></others></component-data>
this is what I expected.
Now if I give this XML data to the unmarshaller with the same mapping
file, it is not populating the Java object ComponentData, but it was before.
Let me know if you need more info.
Thank you for your help
Xav
Werner Guttmann wrote:
Sorry, but you'll need to be a bit more specific, in terms of XML
expected, Java entities, etc.
Werner
Xav wrote:
Hello,
The code I am developing marshalls an object to generate XML data and
another part unmarshall that XML code.
Everything was working fine until I added these 2 lines to the marshaller:
marshaller.setSuppressXSIType( true ) ;
marshaller.setSuppressNamespaces( true ) ;
Now the unmarshall process does not populate the returned object with
the content of the XML.
Is there a way to get it to work without removing these 2 lines that I'd
like to keep to shorten the XML generated?
I'm using the latest castor version.
Thank you
Xav
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
--
A person won't remember you by what you said,
but by how you made them feel.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email