Hello, Castor-experts:

Please forgive if I am making a dumb configuration mistake, but when I run the test:
jdo/Test  in the examples directory I get the following output when the 'computer' object
is marshalled to XML (the last part of the test):
 
<computer id="6" id="6"><cpu>Pentium</cpu><name>MyPC</name><price>300.02</price><group id="3">a group</group><detail id="4">mouse</detail><detail id="5">screen</detail></computer>
 
 
my xml parser rejects this (complaining about id being specified twice)...   I poked in around in the code
a bit and found that I could fix the problem with the following modification to line 328 of
XMLClassDescriptor.java  (the setExtends method).
 
 
      //-- flatten out the hierarchy
  if (_extends != null) { // Add new parent fields, being careful not to dup what is there.   // NEW...
      FieldDescriptor[] myFields    = this.getFields();               
      FieldDescriptor[] newFields   = classDesc.getFields();
      for (int i = 0; i < newFields.length; i++) {
    String  newFieldName = newFields[i].getFieldName();
    boolean doAdd = true;
 
        for (int j = 0; j < myFields.length; j++) {
      if (myFields[j].getFieldName().equals(newFieldName) )
        doAdd = false;
        }
        if (doAdd)
      addFieldDescriptor((XMLFieldDescriptor)newFields[i]);
      }.                                                                                                               // end NEW...
  }
 
 
Not sure if there is a better way to do this....  If anyone could advise I'd be most grateful.
    thanks
        Chris
 
 
PS:
 
Enviroment Settings in effect of observed strange behavior:
 
running castor 9.3.9 (fails on both linux and windows)
 
Here is my database.xml file:
<!DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD Version 1.0//EN" "http://castor.exolab.org/jdo-conf.dtd">
<database name="perigon" engine="postgresql" >
  <data-source class-name="postgresql.PostgresqlDataSource">
    <params server-name="192.168.1.2" port-number="5432"
               database-name="javatest"
                            user="postgres" password="" />
                   </data-source>
  <mapping href="mapping.xml" />
</database>

Reply via email to