3

I was trying to implement automatic marshalling and unmarshalling for OPDS directories in Java. I've tried to use Trang to generate .xsd files and then generate Java classes using JAXB2 maven plugin, but the generated XML Schema files were completely unusable and JAXB2 produced lots of errors. Are there any other tools to generate Java classes from RELAX NG schema? Any other options? What am I doing wrong?

Partial Maven Output

$ mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< net.uo1:opds >----------------------------
[INFO] Building opds 1.2
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- jaxb2-maven-plugin:2.5.0:xjc (xjc) @ opds ---
[INFO] Created EpisodePath [/home/m/tmp/opds-java/target/generated-sources/jaxb/META-INF/JAXB]: true
[INFO] Ignored given or default xjbSources [/home/m/tmp/opds-java/src/main/xjb], since it is not an existent file or directory.
[ERROR] file:/home/m/tmp/opds-java/src/main/xsd/opds.xsd [106,63]
org.xml.sax.SAXParseException: derivation-ok-restriction.4.3: Error for type '#AnonType_price'.  The process contents of the wildcard in the derivation (skip) is weaker than that in the base (lax).
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException (ErrorHandlerWrapper.java:204)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error (ErrorHandlerWrapper.java:135)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (XMLErrorReporter.java:396)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr (XSDHandler.java:4254)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError (XSDHandler.java:4237)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractTraverser.reportSchemaError (XSDAbstractTraverser.java:866)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.handleComplexTypeError (XSDComplexTypeTraverser.java:1182)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl (XSDComplexTypeTraverser.java:341)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDComplexTypeTraverser.traverseLocal (XSDComplexTypeTraverser.java:164)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement (XSDElementTraverser.java:392)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseGlobal (XSDElementTraverser.java:242)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseSchemas (XSDHandler.java:1483)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema (XSDHandler.java:663)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema (XMLSchemaLoader.java:618)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar (XMLSchemaLoader.java:577)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar (XMLSchemaLoader.java:543)
    at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema (XMLSchemaFactory.java:281)
    at com.sun.tools.xjc.reader.xmlschema.parser.SchemaConstraintChecker.check (SchemaConstraintChecker.java:81)
    at com.sun.tools.xjc.ModelLoader.loadXMLSchema (ModelLoader.java:301)
    at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:121)
    at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:76)
    at com.sun.tools.xjc.Driver.run (Driver.java:324)
    at org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.performExecution (AbstractJavaGeneratorMojo.java:475)
    at org.codehaus.mojo.jaxb2.AbstractJaxbMojo.execute (AbstractJaxbMojo.java:337)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] file:/home/m/tmp/opds-java/src/main/xsd/atom.xsd [61,46]
org.xml.sax.SAXParseException: cos-nonambig: WC[##other:"http://www.w3.org/2005/Atom"] and WC[##other:"http://www.w3.org/2005/Atom"] (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException (ErrorHandlerWrapper.java:204)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error (ErrorHandlerWrapper.java:135)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (XMLErrorReporter.java:396)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (XMLErrorReporter.java:327)
    at com.sun.org.apache.xerces.internal.impl.xs.XSConstraints.reportSchemaError (XSConstraints.java:342)
    at com.sun.org.apache.xerces.internal.impl.xs.XSConstraints.fullSchemaChecking (XSConstraints.java:499)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar (XMLSchemaLoader.java:584)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar (XMLSchemaLoader.java:543)
    at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema (XMLSchemaFactory.java:281)
    at com.sun.tools.xjc.reader.xmlschema.parser.SchemaConstraintChecker.check (SchemaConstraintChecker.java:81)
    at com.sun.tools.xjc.ModelLoader.loadXMLSchema (ModelLoader.java:301)
    at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:121)
    at com.sun.tools.xjc.ModelLoader.load (ModelLoader.java:76)
    at com.sun.tools.xjc.Driver.run (Driver.java:324)
    at org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.performExecution (AbstractJavaGeneratorMojo.java:475)
    at org.codehaus.mojo.jaxb2.AbstractJaxbMojo.execute (AbstractJaxbMojo.java:337)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
...

xjc Output

~/projects/opds-java/src/main/xsd$ xjc opds.xsd
parsing a schema...
[ERROR] derivation-ok-restriction.4.3: Error for type '#AnonType_price'.  The process contents of the wildcard in the derivation (skip) is weaker than that in the base (lax).
  line 106 of file:/home/m/tmp/opds-java/src/main/xsd/opds.xsd

[ERROR] cos-nonambig: WC[##other:"http://www.w3.org/2005/Atom"] and WC[##other:"http://www.w3.org/2005/Atom"] (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
  line 61 of file:/home/m/tmp/opds-java/src/main/xsd/atom.xsd

[ERROR] cos-nonambig: WC[##other:"http://www.w3.org/2005/Atom"] and WC[##other:"http://www.w3.org/2005/Atom"] (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
  line 83 of file:/home/m/tmp/opds-java/src/main/xsd/atom.xsd

[ERROR] cos-element-consistent: Error for type '#AnonType_entry'. Multiple elements with name 'content', with different types, appear in the model group.
  line 107 of file:/home/m/tmp/opds-java/src/main/xsd/atom.xsd

[ERROR] cos-nonambig: "http://www.w3.org/2005/Atom":content and "http://www.w3.org/2005/Atom":content (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
  line 107 of file:/home/m/tmp/opds-java/src/main/xsd/atom.xsd

[ERROR] cos-nonambig: WC[##other:"http://www.w3.org/2005/Atom"] and WC[##other:"http://www.w3.org/2005/Atom"] (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
  line 255 of file:/home/m/tmp/opds-java/src/main/xsd/atom.xsd

[ERROR] cos-nonambig: "http://opds-spec.org/2010/catalog":price and "http://opds-spec.org/2010/catalog":price (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
  line 352 of file:/home/m/tmp/opds-java/src/main/xsd/atom.xsd

[ERROR] cos-nonambig: WC[##any] and "http://opds-spec.org/2010/catalog":indirectAcquisition (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.
  line 84 of file:/home/m/tmp/opds-java/src/main/xsd/opds.xsd

Failed to parse a schema.

opds.xsd

<?xml version="1.0" encoding="UTF-8"?>
<!--
  -*- rnc -*- 
  RELAX NG Compact Syntax Grammar for OPDS Catalog Feed & Entry Documents
  Version 2018-08-16
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://opds-spec.org/2010/catalog" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:opds="http://opds-spec.org/2010/catalog" xmlns:atom="http://www.w3.org/2005/Atom">
  <xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="xhtml.xsd"/>
  <xs:import namespace="http://www.w3.org/2005/Atom" schemaLocation="atom.xsd"/>
  <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
  <!--
    The OPDS Catalog spec extends Atom (RFC4287), and the additions require some
    patterns not used in the Atom schema. The first is atomUriExceptOPDS, which
    is used to describe an atomLink whose rel value is an atomNCName (no-colon
    name) or any URI other than these from OPDS Catalogs. In these cases, no
    opds:price element should appear.
  -->
  <xs:simpleType name="atomUriExceptOPDS">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>
  <!--
    Next is OPDSUrisExceptBuy, which is used to describe an atomLink whose
    rel value is from OPDS Catalogs but is not ".../acquisition/buy". In such
    cases, an opds:price element is optional.
  -->
  <xs:simpleType name="OPDSUrisExceptBuy">
    <xs:restriction base="xs:string">
      <xs:enumeration value="http://opds-spec.org/acquisition/borrow"/>
      <xs:enumeration value="http://opds-spec.org/acquisition/subscribe"/>
      <xs:enumeration value="http://opds-spec.org/acquisition/sample"/>
      <xs:enumeration value="preview"/>
    </xs:restriction>
  </xs:simpleType>
  <!--
    To simplify OPDS Catalog validation, we do not use Schematron to assert that
    any atom:link with a rel value of ".../acquisition/buy" must be accompanied
    by one or more opds:price elements.
    Instead we rely on Relax NG to describe one of three situations:
    - the rel value is ".../acquisition/buy" and at least one opds:price element
      is required
    - the rel value is ".../acquisition/borrow" or ".../acquisition/subscribe" or
      ".../acquisition/sample", in case opds:price elements may be
      included; or
    - the value of the rel attribute is any other URI or an Atom-defined no-colon
      name, and no opds:price element is permitted
  -->
  <!--
    Note that this OPDS Catalog schema includes atom.rnc, so that schema must be
    present for validation.
    
    Note also that atom.rnc defines atomUri as text and not as xsd:anyURI, and so
    wherever the Atom spec requires an IRI, the schema will not check the value
    against any URI pattern or logic. The OPDS Catalog schema overrides atom.rnc
    to provide a relatively accurate test. With the approval of XSD 1.1, the
    schema definition should change to xsd:anyURI to match what the spec text
    says.
  -->
  <xs:attributeGroup name="undefinedAttribute">
    <xs:anyAttribute namespace="##other" processContents="skip"/>
  </xs:attributeGroup>
  <!--
    Here is where OPDS Catalogs use John Cowan's pragmatic evaluation of an
    IRI. This modifies xsd:anyURI in XSD 1.0 to exclude ASCII characters not
    valid in 1.1 or IRI's without being escaped. This matches the OPDS and Atom
    specs, but not the non-normative atom.rnc.
  -->
  <xs:simpleType name="atomUri">
    <xs:restriction base="xs:anyURI"/>
  </xs:simpleType>
  <!--
    Here we override Atom to account for HTML abuse in the summary element,
    restricting it in OPDS Catalog to text:
  -->
  <xs:group name="anyOPDSForeignElement">
    <xs:sequence>
      <xs:any processContents="skip"/>
    </xs:sequence>
  </xs:group>
  <!--
    An opds:indirectAcquisition should use strictly MIME media type for
    its type attribute
  -->
  <xs:element name="indirectAcquisition">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:group ref="opds:anyOPDSForeignElement"/>
        <xs:element ref="opds:indirectAcquisition"/>
      </xs:choice>
      <xs:attributeGroup ref="atom:atomCommonAttributes"/>
      <xs:attribute name="type" use="required" type="atom:atomMediaType"/>
    </xs:complexType>
  </xs:element>
  <!--
    An opds:price element should not contain a currency symbol; it is
    restricted to non-negative decimal numbers.
  -->
  <xs:element name="price">
    <xs:complexType>
      <xs:simpleContent>
        <xs:restriction base="xs:anyType">
          <xs:simpleType>
            <xs:restriction base="xs:decimal">
              <xs:minInclusive value="0.0"/>
            </xs:restriction>
          </xs:simpleType>
          <xs:attributeGroup ref="atom:atomCommonAttributes"/>
          <xs:attribute name="currencycode" use="required" type="opds:opdsPriceCurrencyCode"/>
        </xs:restriction>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <!--
    Instead of allowing every possible 3-letter combination as a currency
    code, here the permissible codes (as identified in ISO4217 as of
    2018-08-16) are enumerated. Code for metals and 3-digit equivalents are
    excluded from this list. 
  -->
  <xs:simpleType name="opdsPriceCurrencyCode">
    <xs:restriction base="xs:token">
      <xs:enumeration value="AED"/>
      <xs:enumeration value="AFN"/>
      <xs:enumeration value="ALL"/>
      <xs:enumeration value="AMD"/>
      <xs:enumeration value="ANG"/>
      <xs:enumeration value="AOA"/>
      <xs:enumeration value="ARS"/>
      <xs:enumeration value="AUD"/>
      <xs:enumeration value="AWG"/>
      <xs:enumeration value="AZN"/>
      <xs:enumeration value="BAM"/>
      <xs:enumeration value="BBD"/>
      <xs:enumeration value="BDT"/>
      <xs:enumeration value="BGN"/>
      <xs:enumeration value="BHD"/>
      <xs:enumeration value="BIF"/>
      <xs:enumeration value="BMD"/>
      <xs:enumeration value="BND"/>
      <xs:enumeration value="BOB"/>
      <xs:enumeration value="BOV"/>
      <xs:enumeration value="BRL"/>
      <xs:enumeration value="BSD"/>
      <xs:enumeration value="BTN"/>
      <xs:enumeration value="BWP"/>
      <xs:enumeration value="BYN"/>
      <xs:enumeration value="BZD"/>
      <xs:enumeration value="CAD"/>
      <xs:enumeration value="CDF"/>
      <xs:enumeration value="CHE"/>
      <xs:enumeration value="CHF"/>
      <xs:enumeration value="CHW"/>
      <xs:enumeration value="CLF"/>
      <xs:enumeration value="CLP"/>
      <xs:enumeration value="CNY"/>
      <xs:enumeration value="COP"/>
      <xs:enumeration value="COU"/>
      <xs:enumeration value="CRC"/>
      <xs:enumeration value="CUC"/>
      <xs:enumeration value="CUP"/>
      <xs:enumeration value="CVE"/>
      <xs:enumeration value="CZK"/>
      <xs:enumeration value="DJF"/>
      <xs:enumeration value="DKK"/>
      <xs:enumeration value="DOP"/>
      <xs:enumeration value="DZD"/>
      <xs:enumeration value="EGP"/>
      <xs:enumeration value="ERN"/>
      <xs:enumeration value="ETB"/>
      <xs:enumeration value="EUR"/>
      <xs:enumeration value="FJD"/>
      <xs:enumeration value="FKP"/>
      <xs:enumeration value="GBP"/>
      <xs:enumeration value="GEL"/>
      <xs:enumeration value="GHS"/>
      <xs:enumeration value="GIP"/>
      <xs:enumeration value="GMD"/>
      <xs:enumeration value="GNF"/>
      <xs:enumeration value="GTQ"/>
      <xs:enumeration value="GYD"/>
      <xs:enumeration value="HKD"/>
      <xs:enumeration value="HNL"/>
      <xs:enumeration value="HRK"/>
      <xs:enumeration value="HTG"/>
      <xs:enumeration value="HUF"/>
      <xs:enumeration value="IDR"/>
      <xs:enumeration value="ILS"/>
      <xs:enumeration value="INR"/>
      <xs:enumeration value="IQD"/>
      <xs:enumeration value="IRR"/>
      <xs:enumeration value="ISK"/>
      <xs:enumeration value="JMD"/>
      <xs:enumeration value="JOD"/>
      <xs:enumeration value="JPY"/>
      <xs:enumeration value="KES"/>
      <xs:enumeration value="KGS"/>
      <xs:enumeration value="KHR"/>
      <xs:enumeration value="KMF"/>
      <xs:enumeration value="KPW"/>
      <xs:enumeration value="KRW"/>
      <xs:enumeration value="KWD"/>
      <xs:enumeration value="KYD"/>
      <xs:enumeration value="KZT"/>
      <xs:enumeration value="LAK"/>
      <xs:enumeration value="LBP"/>
      <xs:enumeration value="LKR"/>
      <xs:enumeration value="LRD"/>
      <xs:enumeration value="LSL"/>
      <xs:enumeration value="LYD"/>
      <xs:enumeration value="MAD"/>
      <xs:enumeration value="MDL"/>
      <xs:enumeration value="MGA"/>
      <xs:enumeration value="MKD"/>
      <xs:enumeration value="MMK"/>
      <xs:enumeration value="MNT"/>
      <xs:enumeration value="MOP"/>
      <xs:enumeration value="MRU"/>
      <xs:enumeration value="MUR"/>
      <xs:enumeration value="MVR"/>
      <xs:enumeration value="MWK"/>
      <xs:enumeration value="MXN"/>
      <xs:enumeration value="MXV"/>
      <xs:enumeration value="MYR"/>
      <xs:enumeration value="MZN"/>
      <xs:enumeration value="NAD"/>
      <xs:enumeration value="NGN"/>
      <xs:enumeration value="NIO"/>
      <xs:enumeration value="NOK"/>
      <xs:enumeration value="NPR"/>
      <xs:enumeration value="NZD"/>
      <xs:enumeration value="OMR"/>
      <xs:enumeration value="PAB"/>
      <xs:enumeration value="PEN"/>
      <xs:enumeration value="PGK"/>
      <xs:enumeration value="PHP"/>
      <xs:enumeration value="PKR"/>
      <xs:enumeration value="PLN"/>
      <xs:enumeration value="PYG"/>
      <xs:enumeration value="QAR"/>
      <xs:enumeration value="RON"/>
      <xs:enumeration value="RSD"/>
      <xs:enumeration value="RUB"/>
      <xs:enumeration value="RWF"/>
      <xs:enumeration value="SAR"/>
      <xs:enumeration value="SBD"/>
      <xs:enumeration value="SCR"/>
      <xs:enumeration value="SDG"/>
      <xs:enumeration value="SEK"/>
      <xs:enumeration value="SGD"/>
      <xs:enumeration value="SHP"/>
      <xs:enumeration value="SLL"/>
      <xs:enumeration value="SOS"/>
      <xs:enumeration value="SRD"/>
      <xs:enumeration value="SSP"/>
      <xs:enumeration value="STN"/>
      <xs:enumeration value="SVC"/>
      <xs:enumeration value="SYP"/>
      <xs:enumeration value="SZL"/>
      <xs:enumeration value="THB"/>
      <xs:enumeration value="TJS"/>
      <xs:enumeration value="TMT"/>
      <xs:enumeration value="TND"/>
      <xs:enumeration value="TOP"/>
      <xs:enumeration value="TRY"/>
      <xs:enumeration value="TTD"/>
      <xs:enumeration value="TWD"/>
      <xs:enumeration value="TZS"/>
      <xs:enumeration value="UAH"/>
      <xs:enumeration value="UGX"/>
      <xs:enumeration value="USD"/>
      <xs:enumeration value="USN"/>
      <xs:enumeration value="UYI"/>
      <xs:enumeration value="UYU"/>
      <xs:enumeration value="UZS"/>
      <xs:enumeration value="VEF"/>
      <xs:enumeration value="VES"/>
      <xs:enumeration value="VND"/>
      <xs:enumeration value="VUV"/>
      <xs:enumeration value="WST"/>
      <xs:enumeration value="XAF"/>
      <xs:enumeration value="XAG"/>
      <xs:enumeration value="XAU"/>
      <xs:enumeration value="XBA"/>
      <xs:enumeration value="XBB"/>
      <xs:enumeration value="XBC"/>
      <xs:enumeration value="XBD"/>
      <xs:enumeration value="XCD"/>
      <xs:enumeration value="XDR"/>
      <xs:enumeration value="XOF"/>
      <xs:enumeration value="XPD"/>
      <xs:enumeration value="XPF"/>
      <xs:enumeration value="XPT"/>
      <xs:enumeration value="XSU"/>
      <xs:enumeration value="XTS"/>
      <xs:enumeration value="XUA"/>
      <xs:enumeration value="XXX"/>
      <xs:enumeration value="YER"/>
      <xs:enumeration value="ZAR"/>
      <xs:enumeration value="ZMW"/>
      <xs:enumeration value="ZWL"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:attribute name="facetGroup"/>
  <xs:attribute name="activeFacet">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:enumeration value="true"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
</xs:schema>

Full XML schema is available here. Project source is available on GitHub.

  • I don't know how you generates your XSD's but they are crossed imported (circular references) and this sounds not a good design to me. – рüффп Feb 08 '22 at 15:21
  • The question is probably flagged for closing because it's better if you put directly the code in the question with a minimal and reproducible sample instead of mentioning an external GitHub project. – рüффп Feb 08 '22 at 15:24
  • The project doesn't contain any code besides RELAX NG schemas and Maven configuration. How am I supposed to provide that reproducible sample? – Mikhail Yevchenko Feb 09 '22 at 06:27
  • It's flagged because recommendations for tools are off-topic. – Olivier Feb 09 '22 at 08:34
  • 1
    I'm not asking only for tool recommendations. I just want to know if any solutions actually exist. – Mikhail Yevchenko Feb 09 '22 at 08:42
  • I think the issue is that TRANG is not able to cope with XSD inheritance. E.g the line `atomUri = text` in the atom.rnc is overridden by `atomUri = xsd:anyURI - xsd:string {pattern = '.*[ <>{}|^\`"\nrt].*'}` in the opds.rnc. However the atom.xsd contains `` which is in the opds namespace but this should be defined only in the opds.xsd in my opinion. – рüффп Feb 11 '22 at 23:22
  • For me it would be more logical that atom.xsd defines uri as text as defined in the atom.rnc and in opds.xsd only, the uri are in the overridden type. Perhaps you will need to rework the rnc files and create a common.rnc which define the atomUri uniquely (and being imported in the other two). – рüффп Feb 12 '22 at 00:02
  • Since OPDS is heavily based on ATOM, you could just use the ATOM schema as a starting point and forget about opds.rnc. – Olivier Feb 13 '22 at 09:07
  • I'll try, after I figure out how to do that – Mikhail Yevchenko Feb 16 '22 at 15:16

0 Answers0