Jak uczynić JAXB unmarshaller, aby ignorował przedrostki?

Mam następujący XML:

<ns2:Person name="John" age="20" />

I chcę unieważnić go do obiektu JAXB Osoba, która została wygenerowana z XSD.

to jest kod, który używam:

JAXBContext context = JAXBContext.newInstance(PersoEntity.class);
Unmarshaller um = context.createUnmarshaller();
StringReader sr = new StringReader(xml);
Person p = (Person)um.unmarshal(sr);

Zaskakująco otrzymuję następujący wyjątek:

javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException: The prefix "ns2" for element "ns2:Person" is not bound.]

Jak go rozwiązać? Dzięki

questionAnswers(2)

yourAnswerToTheQuestion