jaxb

What's `{}` in JAXB Moxy errors?


I have the following error while parsing a file with JAXB

[severity=ERROR,message=unexpected element (uri:"Schema", local:"Subtitle"). Expected elements are <{}null>,<{}Subtitle>

What's the meaning of {} in {}Subtitle


Solution

  • From jabx-ri code, it's the namespaceURI of the local element.

    See com.sun.xml.bind.v2.runtime.unmarshaller.Loader#computeExpectedElements function in jaxb-ri which is used in the reportUnexepectedChildElement function :

    r.append("<{").append(n.getNamespaceURI()).append('}').append(n.getLocalPart()).append('>');