Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] MOXy JSON unmarshall where JSON includes a namespace prefix where the XSD does not require a namespace prefix

Hi Mark,

I agree with you that elementFormDefault=‘unqualified’ means that elements from the target namespace are not required to be qualified with the namespace prefix. And if they are qualified it shouldn’t be a problem.

So please raise a bug against MOXy component on https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink. Please attach some simple testCase there, so we’ll be able to test it and to be sure that problem is with 'elementFormDefault'.

Thank for reporting the problem.
—
Best regards.
Yaroslav


> On 21 Oct 2014, at 17:40, Mark Himsley <mark.himsley@xxxxxxxxx> wrote:
> 
> Hi,
> 
> We've been using MOXy 2.5 for a few months. We're using it to pass JSON between our application and a 3rd party RESTfull application.
> 
> There are published schemas for the JSON.
> 
> One of the published schemas includes elementFormDefault="qualified":
> 
> <schema xmlns="http://www.w3.org/2001/XMLSchema"; xmlns:bms="http://base.fims.tv";
>     xmlns:desc="http://description.fims.tv"; targetNamespace="http://base.fims.tv";
>     elementFormDefault="qualified">
> ...
> </schema>
> 
> And one of them does not:
> 
> <schema xmlns="http://www.w3.org/2001/XMLSchema"; xmlns:bms="http://base.fims.tv";
>     xmlns:tms="http://transfermedia.fims.tv"; targetNamespace="http://transfermedia.fims.tv";>
> ...
> </schema>
> 
> Our application is receiving JSON from the 3rd party. The problem is that the JSON from that 3rd party is including a namespace prefix for objects defined in the schema WITHOUT elementFormDefault="qualified":
> 
> {
>   "tms.transferJob":
>   {
>     "bms.resourceID":"e1956e3c-b947-4d71-b939-97dd1a03dc01",
>     "bms.status":"running",
>     "bms.serviceProviderJobID":"JUPITER_JOB_e1956e3c_b947_4d71_b939_97dd1a03dc01"
>   }
> }
> 
> That JSON is unmarshalled without an exception, but the 'transferJob' object is null.
> 
> One way I can fix this is to make package-info include elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED - by whatever means (adding to my jaxb:bindings file), but that means all the other objects from that schema which don't include a namespace prefix in the JSON (which is the majority of them) don't get unmarshalled.
> 
> Alternatively I can alter the JSON to remove the namespace prefix - that's ugly!
> 
> 
> My understanding of not including elementFormDefault="qualified" meant that the namespace prefix is OPTIONAL. It appears that MOXy 2.5 does not agree with me, or I have missed a configuration.
> 
> Is it possible for namespace prefixes in JSON with MOXy to be optional?
> 
> 
> Thanks in advance.
> 
> -- 
> Mark Himsley
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top