Parag
Parag

Reputation: 107

Getting error while trying to generate the Classes from an Schema using JAXB(xjc)

I am unable to generate the Classes from an Schema using JAXB(xjc), using both command prompt as well as eclipse. I keep on getting error, i.e parsing a schema... [ERROR] The markup in the document following the root element must be well-formed. line 16 of file:/C:/Users/xyz/workspace/JaxBClasses/src/all.xsd

Failed to parse a schema.

PFB the complete schema:

 "<xs:element name="Action" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:annotation>
 <xs:documentation>
    The audited action. One of INSERT, UPDATE, or DELETE: entity was created, changed
   or deleted.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
  <xs:enumeration value="INSERT"></xs:enumeration>
  <xs:enumeration value="UPDATE"></xs:enumeration>
  <xs:enumeration value="DELETE"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:element>
"

Please help.

Upvotes: 1

Views: 350

Answers (1)

Xstian
Xstian

Reputation: 8272

The correct XSD is

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified" targetNamespace="http://yourNamespace"
    xmlns="http://yourNamespace" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Action" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:annotation>
            <xs:documentation>
    The audited action. One of INSERT, UPDATE, or DELETE: entity was created, changed
   or deleted.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="INSERT"></xs:enumeration>
                <xs:enumeration value="UPDATE"></xs:enumeration>
                <xs:enumeration value="DELETE"></xs:enumeration>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
</xs:schema>

Upvotes: 1

Related Questions