Hi,
I am trying the example given in castor references. WHen I try to unmarshal,
I am getting the exception as
The class for the root element 'node' could not be found.
Please help me to understand why I am getting this exception.
Thanks in advance. You can go through the code that I used.
Node node=new Node();
node.setNodeNum(1);
ArrayList<String> siblings= new ArrayList<String>();
siblings.add("str1");
siblings.add("str2");
node.setSiblings(siblings);
String nodeStr = utilNew.marshal(node);
System.out.println("nodeStr=" + nodeStr);
utilNew.unmarshal(nodeStr);//exception at this line
----------------------------------------------------------------------------------
import java.util.List;
public class Node
{
protected int nodeNum;
protected List siblings;
/* ... business fields ... */
public Node() {};
public Node( int nodeNum, List siblings ) {
this.nodeNum = nodeNum;
this.siblings = siblings;
}
public int getNodeNum() { return nodeNum; }
public void setNodeNum( int nodeNum ) { this.nodeNum = nodeNum; }
public List getSiblings() { return siblings; }
public void setSiblings( List siblings ) { this.siblings = siblings; }
/* ... business logic ... */
}
--------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
"http://castor.org/mapping.dtd">
<mapping>
<class name="Node">
<map-to xml="node" />
<field name="nodeNum" type="integer">
<bind-xml name="node-num" node="attribute" />
</field>
<field name="siblings" type="Node" collection="collection">
<bind-xml name="sibling" />
</field>
</class>
</mapping>
--
View this message in context:
http://old.nabble.com/The-class-for-the-root-element-%27xxx%27-could-not-be-found.-tp30936627p30936627.html
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email