I'm using castor for converting XML to Java object. I need to use hash table as memeber variable in the object.
I've following DATA XMLwhich needs to be converted into Java object:
<?xml version="1.0" encoding="UTF-8"?>
<DeviceResponse1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<NwEntityGrp>
<key>Port1RIP</key>
<value>
<counter name="rip1" value="45" />
<counter name="rip2" value="56" />
<counter name="rip3" value="67" />
</value>
</NwEntityGrp>
</DeviceResponse1>
And I've wriiten following mapping file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version 1.0//EN"
"http://castor.exolab.org/mapping.dtd" >
<mapping>
<class name="StatsDataObject">
<map-to xml="DeviceResponse1" />
<field name="deviceData" collection="hashtable">
<bind-xml name="NwEntityGrp" node="element">
<class name="org.exolab.castor.mapping.MapItem">
<field name="key" type="java.lang.String">
<bind-xml name="key"/>
</field>
<field name="value" collection="hashtable">
<bind-xml name="counter"/>
<class name="org.exolab.castor.mapping.MapItem">
<field name="key" type="java.lang.String">
<bind-xml name="name" node="attribute"/>
</field>
<field name="value" type="long">
<bind-xml name="value" node="attribute"/>
</field>
</class>
</bind-xml>
</field>
</class>
</bind-xml>
</field>
</class>
</mapping>
I'm getting following exception :
Exception during UnMarshallingThe class for the root element 'DeviceResponse1' could not be found.
The problem I guess is I'm unable to specify value tag.
I need Java object with memeber as deviceData (hash table) in which key is Port1RIP and value is again hash table.
This Inner hash table contains key / value pairs of "rip1", "45' etc.
Pls. help
Thanks,
Anagha
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
