I tried to follow that tutorial.  Here is the structure of the project I am
using:
http://www.nabble.com/file/p18659784/structure.jpg 

Here are the files in the package in the structure:
http://www.nabble.com/file/p18659784/Item.java Item.java 
http://www.nabble.com/file/p18659784/Items.java Items.java 
http://www.nabble.com/file/p18659784/Main.java Main.java 

I added a non-empty constructor to the Item class and an empty one to Items
class.
I also changed the package part of the class name tags in the mapping.xml
file for both classes.

Note, mapping.xml, 
I think that the following:
  <field name="Itemlist" collection="hashtable"> <bind-xml name="MyItem"> 
should read as:
  <field name="Itemlist" collection="hashtable"> <bind-xml name="itemlist"> 
      as that is the name of the item in the items class, no?

The program runs but doesn't output properly.  Here is what I get:
  <?xml version="1.0" encoding="UTF-8" ?> 
  <hashtable empty="false" /> 

So I think the problem is in reading the mapper.xml file.

If you see my Main.java, you'll see I tried it a couple of ways, with a
suggested way commented out.  I was getting nullpointerexception with that
method.  Here is my file directory setup where mapping.xml resides:
http://www.nabble.com/file/p18659784/structure2.jpg 
I played around with the getResource and getResourceAsStream with no avail.

Any suggestions?
-- 
View this message in context: 
http://www.nabble.com/Marshalling-to-XML-conforming-to-existing-XSD-tp18611513p18659784.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


Reply via email to