If you are using JAXB in a maven/java project to unmarshal an XML document and you get:
javax.xml.bind.UnmarshalException: unexpected element (uri:”urn:iso:std:somestuff:xsd:somestuff”, local:”Document”). Expected elements are (none)
Or if you are using JAXB to marshal an XML document and you get:
com.sun.istack.internal.SAXException2: unable to marshal type “generated.somestuff.Document” as an element because it is missing an @XmlRootElement annotation
You have probably fallen victim of the fact that JAXB does not do “Simple Binding” by default. If your project is a maven project and you generated classes based on an xsd file, this is how you fix it (without changing the xsd file):