gpt4 book ai didi

java - 尝试从 .xsd 文件创建 Java 类时出错

转载 作者:行者123 更新时间:2023-12-01 18:34:06 25 4
gpt4 key购买 nike

我有两个 XML,我想将它们转换为 java 类,所以我转到 this我可以在其中生成 .xsd 文件的页面。我试图在 Eclipse 中创建两个 Java 类,但遇到了相同的错误:

parsing a schema...
[ERROR] Content is not allowed in prolog.
line 1 of file:/(...)/queryClass.xsd

Failed to parse a schema.

这些是我的 .xsd 文件:

第一:

<?xml version="1.0" encoding="utf-16"?>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="dao" type="daoType" />
<xsd:complexType name="daoType">
<xsd:sequence>
<xsd:element name="query" type="queryType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="queryType">
<xsd:sequence>
<xsd:element name="arguments" type="argumentsType" />
<xsd:element name="statement" type="xsd:string" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="argumentsType">
<xsd:sequence>
<xsd:element name="argument" type="argumentType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="argumentType">
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:schema>

第二:

<?xml version="1.0" encoding="utf-16"?>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="properties" type="propertiesType" />
<xsd:complexType name="propertiesType">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="entry" type="entryType" />
</xsd:sequence>
<xsd:attribute name="version" type="xsd:decimal" />
</xsd:complexType>
<xsd:complexType name="entryType">
<xsd:attribute name="key" type="xsd:string" />
</xsd:complexType>
</xsd:schema>

最佳答案

事实证明,XSD 文件是错误的。我用过another XML-XSD converter而且效果非常好。

关于java - 尝试从 .xsd 文件创建 Java 类时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60097757/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com