Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] MOXy: Marshalling with no namespace prefix?

Hi Polly,

I entered an Eclipse Bug to track that work item. You can monitor the bug here:


amphoras wrote:
Hi Matt,

That's great news!  Can you point me to the bug so I can watch for it?

Thanks for your quick response.


Matt MacIvor wrote:
Hi Polly,

EclipseLink doesn't currently support the default namespace for 
marshalling. We require a prefix for any namespace that's used. However, 
there is already a work item to add support for this, so it will be 
coming in the near future.



I have read the documentation about namespace resolution many times now
but I am still unsure of how to do what I want to do.  Please bear with me
if this is a stupid question.

My schema is defined like this:

<xsd:schema xmlns:xsd=""

My document is like this:
<Address xmlns=''
xsi:schemaLocation='...' >
   <LineOne>101 Main Street</LineOne>
   <LineTwo>Apt 514</LineTwo>


It appears that when unmarshalling the document, EclipseLink searches for
entry in the XMLContext that contains both the namespace and the element
name.  So to tell EclipseLink the association between the namespace URL
the element, I found through trial and error to configure EclipseLink
these options:

Namespace URL 	                   Prefix 	 Declare 	ns1 	      true

Then my document unmarshalls correctly and everything's great!

Unfortunately, I found that when I marshall the object back out, all the
elements have the namespace prefix, like "ns1:Address".   The
regarding the Prefix field says:

"When the EclipseLink runtime marshalls (writes) an object to an XML
document, it uses the namespace prefixes you specify here."

But what if I don't want to use the prefix?  We defined the target
so that our documents do not have to use the prefix and can be cleaner. 
there a way to configure things so that marshalling does not use the


eclipselink-users mailing list


Back to the top