Jaxb MOXy编组错误的对象

Jaxb MOXy编组错误的对象,jaxb,moxy,docx4j,wordprocessingml,Jaxb,Moxy,Docx4j,Wordprocessingml,我试图让docx4j支持MOXy作为其JAXB实现 我们几乎就在那里;看 我的问题是我有一个: MOXy将其编组到w:delinstrext,而不是w:t,这是我所期望/希望的,也是Java6/reference实现所做的 从: 更新: 下面是一个测试用例: import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.Marshaller; import org.docx

我试图让docx4j支持MOXy作为其JAXB实现

我们几乎就在那里;看

我的问题是我有一个:

MOXy将其编组到w:delinstrext,而不是w:t,这是我所期望/希望的,也是Java6/reference实现所做的

从:

更新:

下面是一个测试用例:

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;

import org.docx4j.wml.R;
import org.docx4j.wml.Text;


public class MOXyTest {

    public static void main(String[] args) throws Exception {


        JAXBContext jc = JAXBContext.newInstance("org.docx4j.wml");
//        System.out.println(Version.getVersion());
//        System.out.println(jc.getClass());

        R run = new R();
        Text text = new Text();
        run.getContent().add(text);

        Marshaller marshaller = jc.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        marshaller.marshal(run, System.out);

    }
}

注意:我是专家组的负责人和成员


更新

我们已经能够重现您在EclipseLink 2.4.1中看到的错误。我们无法在EclipseLink 2.4.2或2.5.0流中重现该问题。我建议下载最新的2.4.2夜间版本并试用:

我们仍在调查这一问题,以确保它真正得到解决


原始答案

到目前为止,当MOXy被用作JAXB提供者时,我无法重现您的问题的结果。你能提供一些额外的信息来帮助我复制你的用例吗。以下是我迄今为止所做的尝试:

Java模型

我从GitHub上的以下位置获取Java模型:

jaxb.properties

我在
org.docx4j.wml
包中添加了一个名为
jaxb.properties
的文件,以启用MOXy作为jaxb提供程序

javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
演示

下面是我用来尝试和再现该问题的演示代码:

package org.docx4j.wml;
导入javax.xml.bind.*;
导入org.eclipse.persistence.Version;
公开课演示{
公共静态void main(字符串[]args)引发异常{
JAXBContext jc=JAXBContext.newInstance(“org.docx4j.wml”);
System.out.println(Version.getVersion());
System.out.println(jc.getClass());
Text Text=新文本();
Marshaller=jc.createMarshaller();
setProperty(marshaller.JAXB_格式化的_输出,true);
marshaller.marshall(text,System.out);
}
}
输出

下面是运行演示代码的输出。我看到的是正确的根元素
t
而不是问题中描述的
delinstrext

2.4.1
class org.eclipse.persistence.jaxb.JAXBContext
<?xml version="1.0" encoding="UTF-8"?>
<ns0:t xmlns:ns2="http://schemas.openxmlformats.org/schemaLibrary/2006/main" xmlns:ns1="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:ns4="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:ns3="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:ns0="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:ns5="http://schemas.openxmlformats.org/officeDocument/2006/relationships"/>
2.4.1
类org.eclipse.persistence.jaxb.JAXBContext

注意:我是专家组的负责人和成员


更新

我们已经能够重现您在EclipseLink 2.4.1中看到的错误。我们无法在EclipseLink 2.4.2或2.5.0流中重现该问题。我建议下载最新的2.4.2夜间版本并试用:

我们仍在调查这一问题,以确保它真正得到解决


原始答案

到目前为止,当MOXy被用作JAXB提供者时,我无法重现您的问题的结果。你能提供一些额外的信息来帮助我复制你的用例吗。以下是我迄今为止所做的尝试:

Java模型

我从GitHub上的以下位置获取Java模型:

jaxb.properties

我在
org.docx4j.wml
包中添加了一个名为
jaxb.properties
的文件,以启用MOXy作为jaxb提供程序

javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
演示

下面是我用来尝试和再现该问题的演示代码:

package org.docx4j.wml;
导入javax.xml.bind.*;
导入org.eclipse.persistence.Version;
公开课演示{
公共静态void main(字符串[]args)引发异常{
JAXBContext jc=JAXBContext.newInstance(“org.docx4j.wml”);
System.out.println(Version.getVersion());
System.out.println(jc.getClass());
Text Text=新文本();
Marshaller=jc.createMarshaller();
setProperty(marshaller.JAXB_格式化的_输出,true);
marshaller.marshall(text,System.out);
}
}
输出

下面是运行演示代码的输出。我看到的是正确的根元素
t
而不是问题中描述的
delinstrext

2.4.1
class org.eclipse.persistence.jaxb.JAXBContext
<?xml version="1.0" encoding="UTF-8"?>
<ns0:t xmlns:ns2="http://schemas.openxmlformats.org/schemaLibrary/2006/main" xmlns:ns1="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:ns4="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:ns3="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:ns0="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:ns5="http://schemas.openxmlformats.org/officeDocument/2006/relationships"/>
2.4.1
类org.eclipse.persistence.jaxb.JAXBContext

我已在您的演示代码中添加了一个变体,以更新问题,该变体再现了问题。谢谢@谢谢你更新你的问题。我已经用我们的发现更新了我的答案。通过eclipselink-2.4.2.v20121107验证了这个问题似乎已经消失了。谢谢你的关注。我已经用你的演示代码的一个变体更新了这个问题,它再现了这个问题。谢谢@谢谢你更新你的问题。我已经用我们的发现更新了我的答案。通过eclipselink-2.4.2.v20121107验证了这个问题似乎已经消失了。谢谢你调查这件事。
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
2.4.1
class org.eclipse.persistence.jaxb.JAXBContext
<?xml version="1.0" encoding="UTF-8"?>
<ns0:t xmlns:ns2="http://schemas.openxmlformats.org/schemaLibrary/2006/main" xmlns:ns1="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:ns4="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:ns3="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:ns0="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:ns5="http://schemas.openxmlformats.org/officeDocument/2006/relationships"/>