We shall be generating Java classes from an XML Schema. In this section we create the XML Schema. To create an XML Schema select File | New | Other. In the New wizard select XML Schema File under XML. Click on Next, as shown in the following screenshot:
In the new XML Schema wizard select the JAXBEclipse/src
folder. Specify the XML Schema name as catalog.xsd in the File name field. Click on Finish. An XML Schema template gets added to the JAXBEclipse project. The example XML Schema represents a catalog and specifies some complexType
elements, an optional element of the xsd:int
type, and an attribute. The TargetNamespace field is set to http://www.example.org/catalog
. Copy the following XML Schema to catalog.xsd:
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/catalog" xmlns:catalog="http://www.example.org/catalog" elementFormDefault="qualified"> <xsd:element name...