Hello out there!

I got a problem unmarshalling the following two classes:

--- EXCEPTION: ---
org.xml.sax.SAXException: constructor arguments can only be used with an 
ExtendedFieldHandler.

--- CLASSES: ---
public class Path {
    private final String name;
    public Path(final String name) {
        super();
        this.name = name;
    }
    public final String getName() {
        return name;
    }
}
public class Area {
    private final String name;
    private List pathList;
    public Area(final String name) {
        this.name = name;
    }
    public final String getName() {
        return name;
    }
    public final List getPathList() {
        return pathList;
    }
    public final void setPathList(final List list) {
        this.pathList = list;
    }
}

--- MAPPING: ---
<mapping>
  <class name="xml.problem.Path" verify-constructable="false">
    <field name="name" set-method="%1" get-method="getName" type="string">
      <bind-xml node="attribute" />
    </field>
  </class>
  <class name="xml.problem.Area" verify-constructable="false">
    <field name="name" set-method="%1" get-method="getName" type="string">
      <bind-xml node="attribute"/>      
    </field>
    <field name="pathList" 
           type="xml.problem.Path" 
           collection="arraylist"
           container="false">
      <bind-xml name="path-list" node="element" />
    </field>
  </class>
</mapping>

--- XML: ---
<area name="Hamburg">
    <path-list>
        <path name="/eng/hamburg"/>
        <path name="/deu/hamburg"/>
    </path-list>
</area>

--- VERSIONS: ---
Castor 1.0.5
Java JRE 1.5

The problem seems to be "container=false" - If you marshal/unmarshal
without this attribute everything works fine (but the XML does not
look as expected)!

For a full example including a testcase see the attached source JAR.

Greetings from (snowless) Germany,
Michael

Attachment: xml-problem.jar
Description: Binary data

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to