在编组时从子元素中删除命名空间

时间:2013-08-01 13:18:41

标签: java jaxb marshalling

我正在使用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来设置前缀。但我在这里错过了什么?

谢谢, 射线。

0 个答案:

没有答案