Я не могу быть явным XML к Java, используя следующую библиотеку: < /p>
Код: Выделить всё
org.glassfish.jaxb
jaxb-runtime
2.3.1
< /code>
Код Unmarshalling выглядит так: < /p>
MyClass instance = JAXBContext.newInstance(MyClass.class)
.createUnmarshaller()
.unmarshal(new StreamSource(getClass().getClassLoader()
.getResourceAsStream("myfile.xml")), MyClass.class)
.getValue();
< /code>
он работает хорошо.
org.glassfish.jaxb
jaxb-runtime
4.0.2
< /code>
При запуске кода возникает ошибка: < /p>
Two classes have the same XML type name "someType". Use @XmlType.name and @XmlType.namespace to assign different names to them.
< /code>
Анализ < /h1>
В иерархии моего класса имеет два класса «когда -то» (в разных пространствах имен). Два класса аннотированы javax.xml.bind.annotation.xmltype
Код: Выделить всё
this.elementName = this.parseElementName(clazz);
XmlType t = (XmlType)this.reader().getClassAnnotation(XmlType.class, clazz, this);
this.typeName = this.parseTypeName(clazz, t);
Вопрос
Есть ли другое решение, чем обновление классов из моей библиотеки, изменяя Javax на Jakarta ?>
Подробнее здесь: https://stackoverflow.com/questions/773 ... annotation