0

I'm having trouble constructing my first XSD file. I'm trying to generate Java POJO's bases on my XSD with jaxb2-maven-plugin.

To start, I've followed the example that I've seen this tutorial

This is my xsd file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">

   <xs:element name = "Tshirt">
        <xs:complexType>
            <xs:sequence>
                <xs:element name = "Color" type = "clothesColorType" />
                <xs:element name = "Size" type = "clothesSizeType" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:simpleType name="clothesSizeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="S" />
            <xs:enumeration value="M" />
            <xs:enumeration value="L" />
            <xs:enumeration value="XL" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="clothesColorType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Black" />
            <xs:enumeration value="White" />
            <xs:enumeration value="Green" />
            <xs:enumeration value="Blue" />
        </xs:restriction>
    </xs:simpleType>
</xs:schema>

When my plugin try to parse the file, I get the error

org.xml.sax.SAXParseException; systemId: file:/ruta/src/main/resources/wsdl-definition/Assurance.xsd; lineNumber: 47; columnNumber: 72; src-resolve: No se puede resolver el nombre 'clothesColorType' para un componente 'type definition'.

I have been googling for hours but I have not found the response. Any Ideas?

Thank you in advance.

Jose A. Matarán
  • 1,044
  • 3
  • 13
  • 33
  • Could you also show the configuration of jaxb2-maven-plugin? And could you please check, that this schema file is the only one in folder src/main/resources/wsdl-definition ? – Daniil Feb 21 '20 at 09:53

1 Answers1

0

The schema is valid (Saxon accepts it, so it must be...)

The problem is therefore either with your schema processor, or with the way you are invoking it.

I note that your schema does not have 47 lines, therefore I suspect the file you are actually using differs from the one shown.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164