javax.xml.bind.UnmarshalException: unexpected element (uri:“”, local:“Group”)

前端 未结 14 1182
终归单人心
终归单人心 2020-12-02 10:13
unexpected element (uri:\"\", local:\"Group\"). Expected elements are <{}group>

Meet an exception when unmarshalling from xml



        
14条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 11:05

    After looking more, the root element has to be associated with a schema-namespace as Blaise is noting. Yet, I didnt have a package-info java. So without using the @XMLSchema annotation, I was able to correct this issue by using

    @XmlRootElement (name="RetrieveMultipleSetsResponse", namespace = XMLCodeTable.NS1)
    @XmlType(name = "ns0", namespace = XMLCodeTable.NS1)
    @XmlAccessorType(XmlAccessType.NONE)
    public class RetrieveMultipleSetsResponse {//...}
    

    Hope this helps!

提交回复
热议问题