users@jaxb.java.net

Re: Can't Generate Java Classes

From: Yuemin Wang <ywang_at_todo1.com>
Date: Thu, 05 Dec 2002 13:42:41 -0500

Khalid,

Make sure your are using jaxb-1.0-ea instead of using jaxb-1.0-beta, because
jaxb-1.0-beta does not support DTD, only XML Schema.

Regards

Yuemin

-----Original Message-----
From: Discussion list for the Java Architecture for XML Binding
[mailto:JAXB-INTEREST_at_JAVA.SUN.COM]On Behalf Of Khalid
Sent: Thursday, December 05, 2002 1:17 PM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Can't Generate Java Classes


Here is my Simple Book.dtd

<?xml version="1.0" encoding="UTF-8"?>
<!--DTD generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
<!ELEMENT book (title, preface)>
<!ELEMENT preface (#PCDATA)>
<!ELEMENT title (#PCDATA)>


Here is my Simple Book.xjs
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xml-java-binding-schema version="1.0-ea">
 <options package="example"/>
 <element name="Book" type="class" root="true">
  <content property="preface" />
  <content property="title" />
 </element>
</xml-java-binding-schema>

And here is the error message I get when I try to generate classes using xjc
/------------------- START ERROR Message--------------------------/
schema_reference.4: Failed to read schema document
'file:///C:/Projects/JAXB/xml
/Book.xjs', because 1) could not find the document; 2) the document could
not be
 read; 3) the root element of the document is not <xsd:schema>.
  line 3 of Book.xjs

Failed to parse a schema.
C:\Projects\JAXB\xml>xjc -p Book.dtd Book.xjs
parsing a schema...
s4s-elt-schema-ns: The namespace of element 'xml-java-binding-schema' must
be from the schema namespace.
  line 3 of Book.xjs

s4s-elt-invalid: Element 'xml-java-binding-schema' is not a valid element in
schema document.
  line 3 of Book.xjs

schema_reference.4: Failed to read schema document
'file:///C:/Projects/JAXB/xml
/Book.xjs', because 1) could not find the document; 2) the document could
not be read; 3) the root element of the document is not <xsd:schema>. line 3
of Book.xjs

Failed to parse a schema.
/------------------- END ERROR MESSAGE --------------------------/




Any suggestions???

Thanks

--Khalid