netbeans JAXB“未指定语法”

xqkwcwgp  于 2022-12-13  发布在  其他
关注(0)|答案(2)|浏览(122)

我尝试通过Netbeans从xsd生成JAXB类,但是我得到了

C:\datos\NetBeansProjects\RegistradoresWSSERCON\nbproject\xml_binding_build.xml:15: grammar is not specified

相对于码道:

<xjc destdir="build/generated/jaxbCache/ACK" catalog="catalog.xml">

这是IM尝试使用的xsd:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wmh="http://www.wmhelp.com/2003/eGenerator" elementFormDefault="qualified">
    <xs:element name="registroResponse">    
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" minOccurs="0" name="codigosError" nillable="true" type="tns:registroError"/>
                <xs:element minOccurs="0" name="idTramite" type="xs:string"/>
                <xs:element minOccurs="0" name="xml" type="xs:base64Binary"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="registroError">   
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" name="codigo" type="xs:string"/>
                <xs:element minOccurs="0" name="descripcion" type="xs:string"/>
                <xs:element minOccurs="0" name="detalles" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

有人知道发生了什么事吗?
编辑:xml_绑定_构建. xml

<?xml version="1.0" encoding="UTF-8"?><!--
        *** GENERATED FROM xml_binding_cfg.xml - DO NOT EDIT  ***
        *** Configure thru JAXB Wizard.                       ***
    --><project name="RegistradoresWSSERCON_jaxb" default="default" basedir=".">
<target name="xjc-typedef-target" depends="-init-project">
    <typedef classname="com.sun.tools.xjc.XJCTask" name="xjc" xmlns:s="http://xml.netbeans.org/schema/JAXBWizConfig">
        <classpath path="${jaxbwiz.xjcdef.classpath}"/>
    </typedef>
</target>
<target name="jaxb-clean-code-generation" depends="clean,jaxb-code-generation"/>
<target name="jaxb-code-generation" depends="xjc-typedef-target,-do-init,-init-macrodef-javac">
    <mkdir dir="${build.generated.sources.dir}/jaxb" xmlns:s="http://xml.netbeans.org/schema/JAXBWizConfig"/>
    <mkdir dir="build/generated/jaxbCache" xmlns:s="http://xml.netbeans.org/schema/JAXBWizConfig"/>
    <mkdir dir="build/generated/jaxbCache/ACK"/>
    <xjc destdir="build/generated/jaxbCache/ACK" catalog="catalog.xml">
        <classpath>
            <pathelement location="${src.dir}"/>
            <pathelement path="${jaxbwiz.xjcrun.classpath}"/>
        </classpath>
        <arg value="-xmlschema"/>
        <schema file=""/>
        <depends file=""/>
        <produces dir="build/generated/jaxbCache/ACK"/>
    </xjc>
    <copy todir="${build.generated.sources.dir}/jaxb">
        <fileset dir="build/generated/jaxbCache/ACK"/>
    </copy>
    <!--*** Web project javac macro does not support sourcepath attribute, so do not pass "sourcepath=${src.dir}"-->
</target>
mpgws1up

mpgws1up1#

<schema file=""/>提供了一个空路径,jaxb没有要处理内容。
xjc任务文档here

Attribute   Description
------------------------------------------
schema      A schema file to be compiled. A file name (can be relative to the build script base directory), or an URL. This or nested <schema> elements are required.
destdir     Generated code will be written under this directory. If you specify target="abc/def" and package="org.acme", then files are generated to abc/def/org/acme.
catalog     Specify the catalog file to resolve external entity references. Support TR9401, XCatalog, and OASIS XML Catalog format. See the catalog-resolver sample for details.

Netbeans JAXB向导常见问题解答位于此处。
This article shows a dialog box of the wizard with a path and a browse button.

dldeef67

dldeef672#

确保提供xmlschema参数:

xjc -d src -p com.schema -xmlschema schema-file.xsd

相关问题