1

我正在使用 jaxb2.1

我正在将生成的 xml 文件对象解组回 XML。但是我在子元素中得到了额外的命名空间,我不知道如何摆脱它们:

<abc:buttons xmlns:abc="http://www.abc-sa.com/schema/abc1.x" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" interfaceVersion="1.0" partition="Distributor">
`<button xmlns:abc="http://www.abc-sa.com/schema/abc1.x" xmlns:ds="http://www.w3.org/2000/09/xmldsig#`"` identifier="UID-1d1ed99a-8ebe-4da3-88af-2917a6708470" name="doratis" type="Supplier" webAddress="" phone=""/>
<button xmlns:abc="http://www.abc-sa.com/schema/abc1.x" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" identifier="UID-ssssssss-b2bd-4346-b196-7b7b160e5840" name="doratis" type="Supplier" webAddress="" phone=""/>
</abc:buttons>

这就是我创建元素的方式:

private final static QName _Button_QNAME = new QName("http://www.abc-sa.com/schema/edx1.x", "Organization");

public JAXBElement<ButtonType> createButtonTypeElement(ButtonType buttonType) {
        return new JAXBElement<ButtonType>(_Button_QNAME, ButtonType.class, null, buttonType);
}

我正在使用 getEdxNamespacePrefixMapper 来设置前缀。但我在这里错过了什么?

谢谢,雷。

4

0 回答 0