0
votes

Jaxb / xjc won't create java classes from xsd schema file (Eclipse and command line)

Using jre1.8.0_191 and JAXB both Eclipse and xjc command line (and switches) give errors when trying to convert imsqti_v2p1.xsd (learning object quizzes) to POJOs (plain old java objects). Most errors said "Property X is already defined. Use to resolve this conflict" and I was able to annotate imsqti_v2p1.xsd until (in both Eclipse and command line xjc) only one error remains:

parsing a schema... [ERROR] Property "MiOrMoOrMn" is already defined. Use to resolve this conflict. line 132 of http://www.w3.org/Math/XMLSchema/mathml2/presentation/scripts.xsd

Now, imsqti_v2p1.xsd has many xmlns' - the one responsible for the error is

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

This xsd is SHORT and has many local references, one of which causes the error

I did find this scripts.xsd - the compiler complained about line 132 and Property "MiOrMoOrMn" but scripts.xsd ends at line 130! Plus, when I load scripts.xsd into Eclipse editor it has a dozen errors - if they are caused by missing "neighbor" xsd's referenced by mathml2.xsd I'd probably have to find and download and run locally 27 local xsd's! So I'd hoped I could fix scripts.xsd and refer to it locally in a xmlns in the mathml2.xsd header, but now I'm not sure how to resolve this. Also, If you know of a better way to create these POJO's I'd be hearing about it - someone must know about this mathml xsd issue?!?

====================  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.
1

1 Answers

0
votes

XMLSPY let's you download and try the full edition - I loaded up my .xsd and the product was able to chew through all the reference .xsd's and produce (many, many) java class files successfully ... so FYI ... In the meantime, I have been able to get JAXB to work using much smaller input .xds's. I got these (different part of project) by producing output XML from a tool, then using one of the online XML to XSD web sites to produce the .xsd which JAXB was able to process. I guess this is the only way 'round the MiOrMoOrMn problem.