Title: Marshaling/unmarshaling Collection of Strings. (pbs)

Hello,

I am having some problems unmarshaling
collection of strings.
I have tried both with Vector of Strings
and Array of Strings with the same error
when unmarshaling.
An in each case I have used a Mapping files
(I tried the differents combination in the field
definition, from specifying or not the collection
attribute, the same for the type).

----------------------- class
public class filter {
   String contexts[];  // tried also Vector contexts;
}
----------------------- mapping
<class name="filter"
                        extends="...">
                <field name="contexts" collection="array" type="string" />
</class>
----------------------- marshall file
<filter>
  <contexts>*<contexts>
  <contexts>string2<contexts>
</filter>
-----------------------

Exception:

public void endElement(String name) {

...
  //-- check for character content
  if ((state.buffer != null) &&
                (state.buffer.length() > 0) &&
                (state.classDesc != null)) {
                  XMLFieldDescriptor cdesc = state.classDesc.getContentDescriptor();
        if (cdesc != null) {
        else {
                //-- check for non-whitespace...and report error
                if (!isWhitespace(state.buffer)) {
                        String err = "Illegal Text data found as child of: "
                                + name;
                        err += "\n  value: \"" + state.buffer + "\"";
                        throw new SAXException(err);
                                ==> exception generated!!!!
                                ==>  buffer = "*" name = "contexts"
                }
        }
...
}



I have used the lastest version of Castor (0.9.3.9),
as well as the day built of the CVS with the same
result.

Any good experience working with collection of strings?
Any ideas what could be wrong?

Note:
I have spent several hours browsing the documentation,
looking at newsgroup, tracing, converting Array to Vector
and I do not know now what to do.

Thanks,


Thierry Nabeth
Research Fellow,
INSEAD CALT (The Centre for Advanced Learning Technologies)
http://www.insead.edu/~nabeth/
http://www.insead.edu/CALT/
[EMAIL PROTECTED]
tel: +33 1 60 72 43 12
fax: +33 1 60 74 55 50

Reply via email to