Hi Keith, > Thanks a bunch!
you're very welcome! here are other areas i will try to write some documentation on in the near future: MappingTool i am fairly new to the mappingtool so i will experiment a little more before i attempt to write some half-decent documentation on it. <container> element in the mapping: i know little about the <container> tag so far, just that it can really help with making wrapper classes more transparent in a marshaling framework. but i hope that once i figure this out that i will be able to write a small section with an example on how to effectively use this tag in a mapping. classdescriptors: a third area i thought might be a good place to contribute is on the topic of writing custom classdescriptors or possibly an example on how to supplement a mapping with a classdescriptor or two. this is also an area i'm weak on (i.e. i don't yet know how to do this; been spoiled by the mapping support). / 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
