Dear Colegues,

I've just started using Castor. I have a project in which I use XMLDecoder /
XMLEncoder classes in order to put the whole class into XML file and then
edit it by hand and reload.

So, first of all, how I do that:

        Marshal:
          try {
            Writer w = new FileWriter(path + ".new");
            Marshaller.marshal(r, w);
            w.close();
        } catch ( Exception e ) {
            e.printStackTrace();
        }

      Unmarshal:
        try {
          Reader r = new FileReader(path);
        XMLConfigurer re =
(XMLConfigurer)Unmarshaller.unmarshal(XMLConfigurer.class, r);
        r.close();
        } catch ( Exception e ) {
                e.printStackTrace();
        }

XMLConfigurer is a simple class implementing Serializable, having one
important field which is a Hashtable:
        private Hashtable configData = null;
        private static String path = null;
with getters and setters...

The problem is, that Marshalling goes well, but when I unmarshal:

ValidationException: element "config-data" occurs more than once.
(XMLFieldDesciptor: configData AS config-data)
        at org.exolab.castor.xml.UnmarshalHandler.endElement(Unknown Source)
        at
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392)
        at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator
.java:1550)
        at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
LDocumentScanner.java:1149)
        at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
java:381)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
        at org.exolab.castor.xml.Unmarshaller.unmarshal(Unknown Source)
        at org.exolab.castor.xml.Unmarshaller.unmarshal(Unknown Source)
        at org.exolab.castor.xml.Unmarshaller.unmarshal(Unknown Source)

Anybody know what to do ? Thanks for any help!

Regards,

--
Wojciech Kaszycki
Management & Consulting Group Sp. z o.o.






















































---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.391 / Virus Database: 222 - Release Date: 2002-09-19

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to