users@jaxb.java.net

Re: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://xmlns.escenic.com/2008/content-type", local:"content-types"). Expected elements are <{}content-types>

From: Neha <neha.srivastava8_at_gmail.com>
Date: Wed, 9 Jan 2013 05:56:56 -0800 (PST)

I had a reply from one of the members which solved my issue:

On Wed, Jan 9, 2013 at 1:05 PM, Wolfgang Laun-2 [via GlassFish] <[hidden
email]> wrote:
(1) You have to specify the namespace for the root element:
@XmlRootElement(name="content-types",
namespace="http://xmlns.escenic.com/2008/content-type")

(2) Never, ever add a namespace prefix to an element name in the
"name" part of an annotation. (The "ui" is absolutely local to the XML
file, and could be systematically replaced by anything.)

(3) Make sure to use exactly identical URIs (no trailing '/' here):

@XmlElement(name = "label",
                   
namespace="http://xmlns.escenic.com/2008/interface-hints")
        protected String label;

-W




--
View this message in context: http://glassfish.10926.n7.nabble.com/javax-xml-bind-UnmarshalException-unexpected-element-uri-http-xmlns-escenic-com-2008-content-type-lo-tp87475p87481.html
Sent from the JAXB users mailing list archive at Nabble.com.