When you marshal a list in Castor to XML you typically get XML with a top level 
node of <array-list>.  However, if you have XML where the top level node is 
<array-list> and you feed it to the unmarshaller, you get an error stating:

Caused by: org.exolab.castor.xml.MarshalException: The class for the root 
element 'array-list' could not be found.{File: [not available]; line: 1; 
column: 13}
     at 
org.exolab.castor.xml.Unmarshaller.convertSAXExceptionToMarshalException(Unmarshaller.java:794)
     at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:760)
     at 
org.springframework.oxm.castor.CastorMarshaller.unmarshalInputStream(CastorMarshaller.java:386)
     ... 31 more
Caused by: org.xml.sax.SAXException: The class for the root element 
'array-list' could not be found.
     at 
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1607)
     at 
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1436)

How would I get Castor to respect <array-list> (and essentially build me an 
array list with the objects in the body of the tag)?  I'm using Castor along 
with Spring, so its really the Spring OXM version of the Castor (un)mashaller, 
I mention this only because the marshaller is being used in a "generic" way, 
thus I wouldn't really have insight on a case per case basis to know when to 
create the unmarshaller by passing an ArrayList.class to it's constructor

Craig.

--
Craig Tataryn
site: http://www.basementcoders.com/
podcast: http://www.basementcoders.com/?feed=podcast
itunes: http://itunes.apple.com/podcast/the-basement-coders
irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin
twitter: craiger

Reply via email to