如何使用java创建xml模式

如何使用java创建xml模式,java,xml,xsd,hyperjaxb,Java,Xml,Xsd,Hyperjaxb,为了在以后自动创建一个xml文件以转换为jpa类别,我尝试使用de hyperjaxb3包中的类创建Estrestructure。 这就是我创建对象的方式: Annotation an = new Annotation(); Appinfo ap= new Appinfo(); en.setName("Entidad"); ap.setContent(en); an.setContents(ap); schema1.setAnnotation(an); 然后在控制台中或导出为xml文件时,

为了在以后自动创建一个xml文件以转换为jpa类别,我尝试使用de hyperjaxb3包中的类创建Estrestructure。 这就是我创建对象的方式:

Annotation an = new Annotation();
Appinfo ap= new Appinfo();
en.setName("Entidad");

ap.setContent(en);

an.setContents(ap);
schema1.setAnnotation(an);
然后在控制台中或导出为xml文件时,生成以下行:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:extensionBindingPrefixes="hj orm" xmlns:hj="http://hyperjaxb3.jvnet.org/ejb/schemas/customizations" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:tns="http://java.sun.com/xml/ns/jaxb" targetNamespace="http://java.sun.com/xml/ns/jaxb" attributeFormDefault="qualified" elementFormDefault="qualified">
<xsd:annotation>

<xsd:appinfo>
    //The Entity object should be generated here, but it does not.
</xsd:appinfo>

</xsd:annotation>
</xsd:schema>
我需要在xsd:appinfo元素m中生成一个实体XML元素,如下所示

<xsd:appinfo>
    <hj:entity></hj:entity>
</xsd:appinfo>

提前谢谢。

你和Maven的关系在哪里?对不起。你说得对。。虽然结果将使用maven在jpa类别中转换,但无论如何它都没有关系。