users@jaxb.java.net

Having Namespace for every attribute

From: Chandran R <ramu.chandran_at_gmail.com>
Date: Wed, 2 Dec 2009 10:02:26 -0800 (PST)

Hi All,

We would like to use annotations and take advantage of jaxb for marshalling
ang unmarshalling the Java Objects.
These Objects are legacy code and hence we would like to add annotations
only at class level i.e @XmlRootElement(name = "Title" ,
namespace="com.company.referencedata")

For ex

@XmlRootElement(name = "Title" , namespace="com.company.referencedata")
public class Title {
private int id;
 ...
}

What we have observed was the xml generated on marshalling had namespace
included only for rootNode

ex:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:Title xmlns:ns2="com.company.referencedata">
<description>description</description>
<id>1</id>
</ns2:Title>

We expected it to add even for elements

ex :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:Title xmlns:ns2="com.company.referencedata">
<ns2:description>description</ns2:description>
<ns2:id>1</ns2:id>
</ns2:Title>


One solution is add @XMLElement for all the attributes, but is there any
other way where we could include namespace ??

I am new to JAXB, Any help is highly appreciated.

Thanks In Advance





-- 
View this message in context: http://old.nabble.com/Having-Namespace-for-every-attribute-tp26613484p26613484.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.