我一直试图解析xsd文件,以便能够在本地生成jaxb文件。为此,我在linux上使用了xjc命令,没有来自命令本身的任何选项。
但就连我都把它用作:
xjc SpaceSystem.xsd
它给出了如下错误:
ogurdogan@ogurdogan:~/Documents/XTCE/XJC Test$ xjc SpaceSystem.xsd parsing a schema... [ERROR] The value of attribute "value" associated with an element type "enumeration" must not contain the '<' character. line 4399 of file:/home/ogurdogan/Documents/XTCE/XJC%20Test/SpaceSystem.xsd错误发生的定义可以在下面的第11行看到。
<simpleType name="ComparisonOperatorsType">
<annotation>
<documentation xml:lang="en">Operators to use when testing a boolean condition for a validity check</documentation>
</annotation>
<restriction base="string">
<enumeration value="=="/>
<enumeration value="!="/>
<enumeration value="<"/>
<enumeration value="<="/>
<enumeration value=">"/>
<enumeration value=">="/>
</restriction>
</simpleType>即使是我一直使用的xsd模式也是来自这里的非常通用和正式的模式,它会产生错误,如上面所示。由于它是默认模式,不应该更改,所以我不知道需要做什么。
在使用了一些类型之后,我还尝试使用来自xjc的选项,如:
但结果是一样的。
有什么问题吗?
发布于 2021-09-20 19:17:13
当我在第4397行查看链接模式的来源(例如查看源:Chrome中的https://www.omg.org/spec/XTCE/20180204/SpaceSystem.xsd)时,我发现
<simpleType name="ComparisonOperatorsType">
<annotation>
<documentation xml:lang="en">Operators to use when testing a boolean condition for a validity check</documentation>
</annotation>
<restriction base="string">
<enumeration value="=="/>
<enumeration value="!="/>
<enumeration value="<"/>
<enumeration value="<="/>
<enumeration value=">"/>
<enumeration value=">="/>
</restriction>
</simpleType>这与您所显示的完全不同,实际上,任何XML文档都不能在属性值中有一个未转义的<符号。
我不知道xjc,但我想它不会抱怨您链接到的真正模式,它的原始形式,有人可能会错误地保存浏览器的“漂亮打印”呈现与选择所有->复制->粘贴,这是已知的不保存原始标记。
https://stackoverflow.com/questions/69259427
复制相似问题