Hi Ulf,

I just showed you how to do it. You can't use the generated marshal()
method as there is no way to configure the marshaller that way. The
generated Marshal method will simply create a default Marshaller and use
that for marshalling. If you want to do any sort of configuration, then
you need to create the Marshaller instance and configure it. Just use
the code I supplied, it'll work.

So instead of calling myObject.marshal(writer) use my suggestion from
below and it'll work fine. It's only one extra line of code.

--Keith


Ulf Heyder wrote:
> 
> Like I said I use the castor source generator to create java classes to my existing
> XSDs. The classes created do implement the marshal functionality for the
> corresponding xml objects. So I need to know how to tell the source generator to add
> the method setSchmaLocation to the generated classes.
> 
> Any suggestions?
> 
> Thanks, Ulf
> 
> ----- Original Message -----
> From: "Keith Visco" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 17, 2003 9:12 PM
> Subject: Re: [castor-dev] schemalocation entry in XML created by castor created
> sources?
> 
> |
> | import org.exolab.castor.xml.Marshaller;
> |
> | Marshaller m = new Marshaller(writer);
> | m.setSchemaLocation("...");
> | m.marshal(myObject);
> |
> | --Keith
> |
> |
> | Ulf Heyder wrote:
> | >
> | > I use castor-0.9.5 with xerces-2.4.0 to automatically generate classes
> | > from XSDs via source generator and un-/marshall JAVA objects to/from
> | > XML files.
> | >
> | > My question is how to tell the castor source generator to create the
> | > classes in a way that while marshalling they will create a
> | > schemaLocation entry in the opening root tag:
> | >
> | > <?xml version="1.0" encoding="UTF-8"?>
> | > <liste
> | >  xmlns="http://www.test.de/test";
> | >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> | >  xsi:schemaLocation="http://www.test.de/test liste.xsd">
> | >  .
> | >  .
> | >  .
> | > </liste>
> | >
> | > Thanks, Ulf
> 
> -----------------------------------------------------------
> 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