First I used Castor to generate classes from the xsd file. Then I found that all attributes specified in the xsd file were given a class type as their data type, but I need them to be of String type, so I MANUALLY (though I was advised to turn on the "type" switch, I haven't figure out how to do it) change that. Then I set the values of the generated classes using those setter methods. When I called "marshal" method of the top element to the standard output, I found that all attributes (at least I want them to be) have been turned into sub-elements in the generated xml stream.
Hi,
Make sure the descriptors generated by Castor are compiled and in your classpath.
Hope that helps,
Arnaud
sub-element-----Original Message----- From: Liheng Qiao [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 4:19 PM To: [EMAIL PROTECTED] Subject: [castor-dev] an attribute in xsd, but marshaled to anthat they
Hi! all,
I'm having a problem using Castor to marshal/unmarshal objects. In my xsd file, I have some elements with attributes. I used Castor to generate the corresponding Java objects. All seemed going well. But when I set the value of those objects to marshal them to xml file. All attributes originally in the xsd file were turned into sub-elements. Could anyone please help me with that?
>Szabo Peter wrote: >> >> Hi Naresh, >> >> It seems you follow me on my learning curve with Castor... >> >> In the archive you can find a statement from a Castor developer>> have to improve logging in Castor XML. If you search the sourceyou will>> find that there is only one (1) line logged in the whole code(using thisthan>> Logger) - the line you got. >> >> Well, this is certainly a field to improve. > >+1 > >We definately need to add logging support and improve the error >messages. I know this is an area both Bruce and Arnaud have been >discussed in the past, but time constraints have pushed onto the >back-burner (so-to-speak). > >The Logger is pretty obsolete. We need to improve this API so that we >can support the features of Log4j and the Sun JDK 1.4 Logging API. > >This is definately something that needs to get done sooner rathersimple>later. > >Any takers in helping out in this area? > >--Keith > >> >> rgds, >> Peter >> >> > ---------- >> > Von: Naresh Bhatia[SMTP:[EMAIL PROTECTED] >> > Antwort an: [EMAIL PROTECTED] >> > Gesendet: Sonntag, 23. Februar 2003 06:19 >> > An: [EMAIL PROTECTED] >> > Betreff: Re: [castor-dev] How to turn on logging? >> > >> > Well, I did finally get the logging to work. For some reason aorg.exolab.castor.util.Logger:>> > PrintWriter was not printing anything to the log: >> > >> > PrintWriter logWriter = new PrintWriter(new >> > FileOutputStream("castor.log")); >> > >> > I had to create the PrintWriter using>> > >> > PrintWriter logWriter = new org.exolab.castor.util.Logger(new> >> > FileOutputStream("castor.log")); > >> > > >> > Anyway, even after I got the logging to work, it was not of much help! I > >> > got only one line in the log file:> >> >>> > >> > Loading mapping descriptors from file:/C:/project/mapping.xml >> > >> > I was expecting to see a lot more :-(. >> > >> > Naresh >> > >> > -----Original Message----- >> > From: tek1 [mailto:[EMAIL PROTECTED] >> > Sent: Saturday, February 22, 2003 11:28 PM >> > To: [EMAIL PROTECTED] >> > Subject: Re: [castor-dev] How to turn on logging? >> > >> > >> > actually, i was working on the same thing today. >> > >> > did you try: >> > >> > http://www.mail-archive.com/[EMAIL PROTECTED]/msg02715.html) for my>> > ? it solved my problem, but just have to update it from using >> > "Category" >> > to "Logger" since "Category" is now deprecated... >> > >> > >> > >> > At 20:21 03/02/22 -0500, you wrote: >> > >> > >How do I turn on logging in Castor? I am calling setLogWriter(>> > >mapping and unmarshaller objects, but the generated log filesare zeroXML> > > >length - no log messages! > > > > > > > >PS. Does this have to do anything with JDO vs XML mapping? All > > > >references > > > >I found to logging were in the context of JDO and I am using>> > mapping. >> > > >> > >Thanks. >> > >Naresh >> > >> > ----------------------------------------------------------- >> > 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
-- cheers,
Qiao Liheng Software Engineer One World Distribution 605-845-7172
----------------------------------------------------------- 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
-- cheers,
Qiao Liheng Software Engineer One World Distribution 605-845-7172
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
