JAXB with namespace unmarshalling (using Jersey from REST service)

后端 未结 2 1652
天涯浪人
天涯浪人 2021-01-13 22:26

I\'m trying to unmarshal a simple xml document from a public api from Convio. I\'m not getting any compiler errors with the following code, but it won\'t produce a result ei

2条回答
  •  不要未来只要你来
    2021-01-13 23:05

    You could add a package level annotation (this is done on a class called package-info) and specify elementFormDefault="qualified", then you wouldn't need to qualify each @XmlElement annotation.

    @javax.xml.bind.annotation.XmlSchema(
       namespace="http://convio.com/crm/v1.0".
       elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) 
    package com.convio.crm; 
    

    For more information on JAXB and namespaces see:

    • http://bdoughan.blogspot.com/2010/08/jaxb-namespaces.html

提交回复
热议问题