SAXParseException在XSD中创建枚举

问题描述 投票:0回答:1

我在构建第一个XSD文件时遇到问题。我正在尝试使用jaxb2-maven-plugin在我的XSD上生成Java POJO的基础。

首先,我按照我看到的示例this tutorial

这是我的xsd文件:

<?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>

当我的插件尝试解析文件时,出现错误

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'.

我已经搜寻了几个小时,但没有找到答案。有任何想法吗?

先谢谢您。

我在构建第一个XSD文件时遇到问题。我正在尝试使用jaxb2-maven-plugin在我的XSD上生成Java POJO的基础。首先,我遵循了看过本教程的示例。...

xml xsd jaxb maven-jaxb2-plugin
1个回答
0
投票

该模式有效(Saxon接受它,因此它必须是...)

© www.soinside.com 2019 - 2024. All rights reserved.