Do XML Schema imports in .xsd files have significance to Nuxeo?

I have a doctype in a Nuxeo extension like this:

<doctype name="CreativeWork" extends="File">
  <schema name="common" />
  <schema name="dublincore"/>
  <schema name="CreativeWork"/>

And an XML schema like this:

<?xml version="1.0" ?>
<xs:schema targetNamespace=""
    <xs:import namespace="" schemaLocation="Thing.xsd"/>

where the xs:import refers to another schema in the package.

My schemas and doctypes are available in Nuxeo—I checked by using nuxeo-doctypes-io—but I do not see any indication that the fields in Thing.xsd are available to documents with the CreativeWork doctype.

My guess is that Nuxeo does nothing with xs:import, and that if I wish to structure my custom document types like this, it should be done by adding the parent schemas to the doctype declaration. Is this guess correct?

0 votes

1 answers




Yes you can proceed like this, support of xs:import was added quite recently, it may not be supported depending on your version (added in 5.7.1, see NXP-10984).

If you're using Nuxeo 5.8, maybe it's configuration problem and the tests at the end of this commit could help?

1 votes

Thanks again for your quick answer. I'm working on 5.8 and 5.9, so I'll check my work again to see if I made a mistake or misinterpreted what I was seeing.

You can actually see this work at <>, but it is not yet ready for general consumption.


@anahide-tchertchian: I checked again and it is still somewhat of a mismatch between XSD imports and availability of schema elements from within Nuxeo. For example, with the doctype

    &lt;doctype extends=&quot;File&quot; name=&quot;CreativeWork&quot;&gt;
        &lt;schema name=&quot;common&quot;/&gt;
        &lt;schema name=&quot;dublincore&quot;/&gt;
        &lt;schema name=&quot;Thing&quot;/&gt;
        &lt;schema name=&quot;CreativeWork&quot;/&gt;

Elements from the Thing schema are available, but with

    &lt;doctype extends=&quot;File&quot; name=&quot;CreativeWork&quot;&gt;
        &lt;schema name=&quot;common&quot;/&gt;
        &lt;schema name=&quot;dublincore&quot;/&gt;
        &lt;schema name=&quot;CreativeWork&quot;/&gt;

I receive errors like [org.nuxeo.ecm.platform.el.DocumentModelResolver] Property not found: thing:url even though the XSD files have the imports defined and the contributions to org.nuxeo.ecm.core.schema.TypeService have the prefixes defined.



It seems the xs:import only allows you to declare types, not to declare fields (xs:element) that will be present in the schema… I'm not sure about the spec about this (and i haven't tested on my side)