我无法使用 JAXB(xjc)、使用命令提示符和 eclipse 从架构生成类。我不断收到错误,即 正在解析架构... [错误] 文档中根元素后面的标记必须格式正确。 文件第 16 行:/C:/Users/xyz/workspace/JaxBClasses/src/all.xsd
无法解析架构。
PFB 完整架构:
"<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>
"
请帮忙。
最佳答案
正确的 XSD 是
<?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>
关于java - 尝试使用 JAXB(xjc) 从架构生成类时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24860770/