Issue
im trying to generate JAXB classes from an xsd by Netbeans but im getting
C:\datos\NetBeansProjects\RegistradoresWSSERCON\nbproject\xml_binding_build.xml:15: grammar is not specified
Relative to the code lane:
<xjc destdir="build/generated/jaxbCache/ACK" catalog="catalog.xml">
This is the xsd im trying to use:
<?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>
Anyone knows what is happening ? Tyvm in advance
Edit: xml_binding_build.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>
Solution
<schema file=""/>
provide an empty path, jaxb has nothing to process.
xjc task documentation 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 Wizard FAQ is here.
This article shows a dialog box of the wizard with a path and a browse button.
Answered By - Aubin
Answer Checked By - Clifford M. (JavaFixing Volunteer)