使用xjc MiOrMoOrMn的java类的xsd架构x [错误

问题描述 投票:0回答:1
Jaxb / xjc不会从xsd模式文件(Eclipse和命令行)创建Java类

同时尝试将imsqti_v2p1.xsd(学习对象测验)转换为POJO(普通的Java对象)时,Eclipse和xjc命令行(和开关)都使用jre1.8.0_191和JAXB会出错。大多数错误说“已经定义了属性X。可用于解决此冲突”,我能够对imsqti_v2p1.xsd进行注释,直到(在Eclipse和命令行xjc中)仅剩下一个错误为止:

解析模式...[错误]属性“ MiOrMoOrMn”已定义。用于解决此冲突。的132行http://www.w3.org/Math/XMLSchema/mathml2/presentation/scripts.xsd

现在,imsqti_v2p1.xsd具有许多xmlns'-导致错误的原因是

<xs:import namespace="http://www.w3.org/1998/Math/MathML" schemaLocation="http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd"/>

此xsd为SHORT,具有许多本地引用,其中之一导致错误

我确实找到了这个scripts.xsd-编译器抱怨第132行和属性“ MiOrMoOrMn”,但scripts.xsd在第130行结束!另外,当我将scripts.xsd加载到Eclipse编辑器中时,它会出现很多错误-如果是由于缺少mathml2.xsd引用的“邻居” xsd引起的,那么我可能必须在本地找到并下载并运行27个本地xsd!因此,我希望可以修复scripts.xsd并在mathml2.xsd标头中的xmlns中本地引用它,但是现在我不确定如何解决此问题。另外,如果您知道创建这些POJO的更好方法,我会听说-有人必须知道此mathml xsd问题吗?!?>

==================== imsqti_v2p1.xsd ============================= <xs:schema xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.1" xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:apip="http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sch="http://purl.oclc.org/dsdl/schematron" targetNamespace="http://www.imsglobal.org/xsd/imsqti_v2p1" version="IMS QTI 2.1" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.imsglobal.org/xsd/w3/2001/xml.xsd"/> <xs:import namespace="http://www.w3.org/2001/XInclude" schemaLocation="http://www.imsglobal.org/xsd/w3/2001/XInclude.xsd"/> <xs:import namespace="http://www.w3.org/1998/Math/MathML" schemaLocation="http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd"/> <xs:import namespace="http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0" schemaLocation="http://www.imsglobal.org/profile/apip/apipv1p0/ apipv1p0_qtiextv2p1_v1p0.xsd"/> ==================== mathml2.xsd ================== <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1998/Math/MathML" targetNamespace="http://www.w3.org/1998/Math/MathML" elementFormDefault="qualified"> <xs:include schemaLocation="common/math.xsd"/> <xs:include schemaLocation="common/common-attribs.xsd"/> <!-- Presentation --> <xs:include schemaLocation="presentation/common-types.xsd"/> <xs:include schemaLocation="presentation/common-attribs.xsd"/> <xs:include schemaLocation="presentation/characters.xsd"/> <xs:include schemaLocation="presentation/tokens.xsd"/> <xs:include schemaLocation="presentation/scripts.xsd"/> ============= scripts.xsd ======================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1998/Math/MathML" targetNamespace="http://www.w3.org/1998/Math/MathML" elementFormDefault="qualified"> ================ compiler error message ================== parsing a schema... [ERROR] Property "MiOrMoOrMn" is already defined. Use &lt;jaxb:property> to resolve this conflict. line 132 of http://www.w3.org/Math/XMLSchema/mathml2/presentation/scripts.xsd [ERROR] The following location is relevant to the above error line 138 of http://www.w3.org/Math/XMLSchema/mathml2/presentation/scripts.xsd Failed to parse a schema.

Jaxb / xjc不会从xsd模式文件(Eclipse和命令行)创建Java类,而使用jre1.8.0_191和JAXB时,Eclipse和xjc命令行(和开关)在尝试转换时都会出错...
eclipse jaxb xjc
1个回答
0
投票
XMLSPY,让您下载并尝试完整版-我加载了.xsd,并且该产品能够检查所有参考.xsd并成功生成(许多)java类文件...所以仅供参考...同时,我已经能够使用小得多的输入.xds来使JAXB正常工作。我通过从工具生成输出XML来获得这些(项目的不同部分),然后使用在线XML到XSD网站之一来生成JAXB能够处理的.xsd。我想这是解决MiOrMoOrMn问题的唯一方法。
© www.soinside.com 2019 - 2024. All rights reserved.