That would be populated with the Marshaller.setNameSpaceMapping(String
prefix, String namespace) method.

> -----Original Message-----
> From: David Nemeshazy [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, January 27, 2003 5:10 AM
> To:   [EMAIL PROTECTED]
> Subject:      [castor-dev] xmlns="" in root element always present using
> 0.9.4.2 (not presen t in 0.9.4)
> 
> Hi there! 
> 
> I have been using Castor XML for a while and it is really great!! 
> I am currently starting to use version 0.9.4.2 (from 0.9.4) and I have a
> strange behaviour when I marshall objects: Castor always add an empty
> namespace to the root element, ' xmlns="" '.
> 
> It does not cause any trouble, but I was wondering if this is a bug or a
> feature of version 0.9.4.2? 
> 
> Following are shown the exact objects, mapping, properties that I use for
> my tests. 
> 
> The mapping file : 
> 
> <mapping> 
> 
>     <!--  Mapping for MarshallerTest1  --> 
>     <class name="tests.otf.messaging.MarshallTest1"> 
>         <map-to xml="marshaller-test"/> 
> 
>         <field name="name" type="string"> 
>             <bind-xml name="name" node="attribute"/> 
>         </field> 
> 
>         <field name="value" type="string"> 
>             <bind-xml name="value" node="attribute"/> 
>         </field> 
>     </class> 
> 
> </mapping> 
> 
> The test class, MarshallTest1 : 
> 
> package tests.otf.messaging; 
> 
> /** 
>  * DOCUMENT ME! 
>  * 
>  * @version $revision$ 
>  * @author $author$ 
>  */ 
> public class MarshallTest1 implements java.io.Serializable { 
>     private String name; 
>     private String value; 
> 
>     /** 
>      * Creates a new MarshallTest1 object. 
>      */ 
>     public MarshallTest1() { 
>         name = null; 
>         value = null; 
>     } 
> 
>     /** 
>      * Creates a new MarshallTest1 object. 
>      * 
>      * @param name DOCUMENT ME! 
>      * @param value DOCUMENT ME! 
>      */ 
>     public MarshallTest1(String name, String value) { 
>         this.name = name; 
>         this.value = value; 
>     } 
> 
>     /** 
>      * Sets the name 
>      * 
>      * @param name The name to set 
>      */ 
>     public void setName(String name) { 
>         this.name = name; 
>     } 
> 
>     /** 
>      * Gets the name 
>      * 
>      * @return Returns a String 
>      */ 
>     public String getName() { 
>         return name; 
>     } 
> 
>     /** 
>      * Sets the value 
>      * 
>      * @param value The value to set 
>      */ 
>     public void setValue(String value) { 
>         this.value = value; 
>     } 
> 
>     /** 
>      * Gets the value 
>      * 
>      * @return Returns a String 
>      */ 
>     public String getValue() { 
>         return value; 
>     } 
> 
>     /** 
>      * @see java.lang.Object#equals(Object) 
>      */ 
>     public boolean equals(Object obj) { 
>         return toString().equals("" + obj); 
>     } 
> 
>     /** 
>      * @see java.lang.Object#toString() 
>      */ 
>     public String toString() { 
>         return "MarshallTest1(" + name + ", " + value + ")"; 
>     } 
> } 
> 
> And the test code that does the marshalling, followed by the resulting XML
> : 
> 
>                 
>                 ClassLoader cl = getClass().getClassLoader(); 
>                 Mapping mapping = new Mapping(cl); 
> 
>                 String mappingFile =
> "META-INF/mapping/MdfTest-mapping.xml"; 
>                 URL mapurl = cl.getResource(mappingFile); 
>                 mapping.loadMapping(mapurl); 
> 
>                 StringWriter writer = new StringWriter(); 
>                 Marshaller marshaller = new Marshaller(writer); 
>                 marshaller.setMapping(mapping); 
> 
>                 Log4jStringWriter log4jWriter = 
>                         new Log4jStringWriter(logger, Level.DEBUG); 
>  
> marshaller.setLogWriter(log4jWriter.getLogWriter("xml-test")); 
> 
>                 //Set the marshaller properties 
>                 marshaller.setValidation(false); 
>                 marshaller.setDebug(true); 
> 
>                 // create the data to marshal 
>                 MarshallTest1 data = new MarshallTest1("from",
> "[EMAIL PROTECTED]")); 
> 
>                 marshaller.marshal(data); 
>                 writer.close(); 
> 
>                 String xmlValue = writer.getBuffer().toString(); 
> 
> The output in xmlValue: 
> 
> <?xml version="1.0" encoding="UTF-8"?> 
> <marshaller-test name="from" value="[EMAIL PROTECTED]" xmlns=""/> 
> 
> And my castor.properties contains the following modifications: 
> 
> org.exolab.castor.parser.validation=false 
> org.exolab.castor.parser.namespaces=false 
> org.exolab.castor.marshalling.validation=false 
> 
> Thanks for the feedback, 
> 
> David 
> 
> 
> 
> __________________________________________________________________________
> 
> � This email and any files transmitted with it are CONFIDENTIAL and
> intended
> solely for the use of the individual or entity to which they are
> addressed. 
> � Any unauthorized copying, disclosure, or distribution of the material
> within
> this email is strictly forbidden. 
> � Any views or opinions presented within this e-mail are solely those of
> the
> author and do not necessarily represent those of Odyssey Asset Management
> Systems SA unless otherwise specifically stated. 
> � An electronic message is not binding on its sender.  Any message
> referring to
> a binding engagement must be confirmed in writing and duly signed. 
> � If you have received this email in error, please notify the sender
> immediately
> and delete the original. 
> 

------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: If you have received this e-mail in error, please immediately 
notify the sender by e-mail at the address shown.  This e-mail transmission may 
contain confidential information.  This information is intended only for the use of 
the individual(s) or entity to whom it is intended even if addressed incorrectly.  
Please delete it from your files if you are not the intended recipient.  Thank you for 
your compliance. Copyright (c) 2003 CIGNA

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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

Reply via email to