Mauricio,

Can I assume that you are *not* using a mapping file ? 

Werner

wg> -----Original Message-----
wg> From: Mauricio De Diana [mailto:[EMAIL PROTECTED] 
wg> Sent: Wednesday, December 21, 2005 12:10 AM
wg> To: [email protected]
wg> Subject: [castor-user] Problem setting default namespace
wg> 
wg> Hello.
wg> 
wg> I am new to Castor and I am having some trouble setting the 
wg> default namespace when marshalling an object.
wg> 
wg> Code and output follows. I am using Castor-0.9.9.1.
wg> 
wg> Can anyone shed some light on it?
wg> 
wg> Mauricio De Diana
wg> 
wg> Output:
wg> <?xml version="1.0" encoding="UTF-8"?>
wg> <person xmlns=""><name>NAME</name></person>
wg> 
wg> ------------------------------------
wg> CastorTest.java
wg> public class CastorTest {
wg> 
wg>   public void test() {
wg>     StringWriter sw = new StringWriter();
wg>     try {
wg>       Person p = new Person();
wg>       p.setName("NAME");
wg>       Marshaller marshaller = new Marshaller(sw);
wg>         marshaller.setNamespaceMapping("",
wg> "http://www.test.com.br/X";);
wg>         marshaller.marshal(p);
wg>       } catch (IOException e) {
wg>       } catch (MarshalException e) {
wg>       } catch (ValidationException e) {
wg>       }
wg>       System.out.println(sw.toString());
wg>   }
wg> 
wg>   public static void main(String[] args) {
wg>     new CastorTest().test();
wg>   }
wg> }
wg> 
wg> ------------------------------------------
wg> Person.java
wg> public class Person {
wg>   private String name;
wg>   public String getName() { return name; }
wg>   public void setName(String name) { this.name = name; } }
wg> 
wg> 
wg>     
wg> 
wg> 
wg> 
wg>     
wg>             
wg> _______________________________________________________
wg> Yahoo! doce lar. Faça do Yahoo! sua homepage. 
wg> http://br.yahoo.com/homepageset.html 
wg> 
wg> 
wg> -------------------------------------------------
wg> If you wish to unsubscribe from this list, please 
wg> send an empty message to the following address:
wg> 
wg> [EMAIL PROTECTED]
wg> -------------------------------------------------
wg> 
wg> 

-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to