works like a charm using latest version from cvs.

/ eitan

-----Original Message-----
From: Eitan Suez [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 21, 2002 4:00 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] does MappingTool work on classes with
collection-type properties?


hold on a minute.  i just realized i'm running
0.9.3 on this box.  i will upgrade to latest version
from cvs and will re-test.

sorry about that.  i will let you know if this really
is an issue.  sorry for the false alarm.

/ eitan

-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 21, 2002 3:40 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] does MappingTool work on classes with
collection-type properties?



Eitan,

Are you using the CVS version?

What does the generated Mapping file look like? Does it look valid?

--Keith

Eitan Suez wrote:
>
> Hi All,
>
>   I have taken a little time to review the castor documentation
>   this weekend.  I have also skimmed through some of the mailing
>   list archives (how it has grown!).
>
>   I have discovered castor features I wasn't familiar with such
>   as the org.exolab.castor.tools.MappingTool that can be used
>   to automatically generate a skeleton mapping file which can
>   be used as a starting point for a custom mapping file.  It
>   takes a lot of the drudgery out of writing the mappings for
>   existing java classes.
>
>   Question: i got mappingtool to work for a class with a
>   list of properties.  when i tried to run it again using a
>   class with a collection property, it failed.  i may be using
>   the tool wrong.  here's simple code i used to run MappingTool:
>
> ===============================
> package com.u2d.tests;
>
> import org.exolab.castor.tools.*;
> import java.io.*;
>
> public class MapMaker
> {
>
>    public static void main(String[] args) throws Exception
>    {
>       MappingTool maptool = new MappingTool();
>       maptool.addClass("com.u2d.ide.Debugger");
>       File outfile = new File("outfile.xml");
>       FileWriter w = new FileWriter(outfile);
>       maptool.write(w);
>       w.close();
>    }
> }
> ===============================
>
>   here's a class for which this run failed:
>
> ===============================
> package com.u2d.ide;
>
> import java.util.*;
>
> public class Debugger
> {
>    private List classpaths;
>    private String jreVersion;
>
>    public Debugger()
>    {
>       classpaths = new ArrayList(10);
>    }
>
>    public List getClasspaths()
>    {
>       return classpaths;
>    }
>    public void addClasspath(String path)
>    {
>       classpaths.add(path);
>    }
>
>    public String getJreVersion()
>    {
>       return jreVersion;
>    }
>    public void setJreVersion(String ver)
>    {
>       jreVersion = ver;
>    }
>
>    public String toString()
>    {
>       String cp = "";
>       for (int i=0; i<classpaths.size(); i++)
>       {
>          cp += classpaths.get(i) + ":" ;
>       }
>       return "\n\t\tclasspath: "+cp+"; "+
>        "\n\t\tjre version: "+jreVersion;
>    }
> }
> ===============================
>
> i verified that if i were to remove the "classpaths"
> property from "Debugger", my MapMaker class's run would
> complete successfully.
>
> finally, here's the exception i got:
>
> ===============================
> Exception in thread "main" ValidationException: "" is not a valid NCName.;
>    - location of error: XPATH: mapping/class/field/@name
>         at
>
org.exolab.castor.xml.validators.NameValidator.validate(NameValidator.java:1
> 18)
>         at
>
org.exolab.castor.xml.validators.NameValidator.validate(NameValidator.java:1
> 33)
>         at
> org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:249)
>         at org.exolab.castor.xml.Validator.validate(Validator.java:133)
>         at
> org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:217)
>         at org.exolab.castor.xml.Validator.validate(Validator.java:133)
>         at
> org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:217)
>         at org.exolab.castor.xml.Validator.validate(Validator.java:133)
>         at org.exolab.castor.xml.Marshaller.validate(Marshaller.java:1152)
>         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:534)
>         at org.exolab.castor.tools.MappingTool.write(MappingTool.java:387)
>         at com.u2d.tests.MapMaker.main(MapMaker.java:17)
> ===============================
>
> on a related note, i would be more than happy to add some mappingtool
> documentation
> to the documentation set.  if anyone would like to reply to this thread
and
> volunteer
> extra information they've learned from using the mappingtool, i will make
> sure to
> include that information in the documentation.
>
> Thanks, Eitan
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

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

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

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

Reply via email to