BUG - Nuxeo Studio generating syntactically invalid schema for nested complex types

Hello, I'm noticing that if you create a schema in Nuxeo Studio with the advanced config option “allow nested complex types”, then actually create nested complex types, the XSD that gets generated is syntactically incorrect. Here's a snippet of the XSD that gets generated:

<xs:complexType name="glanswer_answersType">
<xs:sequence>
  <xs:element name="answerContent" type="xs:string"/>
  <xs:element name="properties" type="nxs:glanswer_propertiesListType"/>
  <xs:complexType name="glanswer_propertiesListType">
    <xs:sequence>
      <xs:element name="item" type="nxs:glanswer_propertiesType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="glanswer_propertiesType">
    <xs:sequence>
      <xs:element name="name" type="xs:string"/>
      <xs:element name="value" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:sequence>

Notice the <xs:complexType> nested which XSD doesn't allow. As it stands now, i have to manually edit the schema as a workaround.

I'm observing this behavior on Nuxeo Studio 2.15 on my DM 5.8-HF01

thanks

0 votes

2 answers

2280 views

ANSWER

Hi,

Could you please provide detailed steps to reproduce the issue?

Thanks

11/22/2013

Ok, here's what I did (all within studio):

  • go to Content Model->Schemas
  • click +New schema
  • enter featureid "bugtest" and prefix "bugtest", check the "allow complex nested types"
  • add a field named "nest1" , type "Complex", check "Multivalued"
  • on "nest1" field, click Edit next to Complex
  • add a field named "nest2", type "Complex", check "Multivalued"
  • on "nest2" field, click Edit next to Complex
  • add a field named "foo" type String
  • click Save
  • click Save

Switch over to Nuxeo DM

  • go to Admin Center
  • click Update Center
  • click Update

In Nuxeo DM logs, i see this: 2013-11-22 07:22:19,720 ERROR [http-bio-0.0.0.0-8080-exec-5] [org.nuxeo.ecm.core.schema.XSDLoader] FatalError: Unexpected <xs:complexType> appears at line 44 column 52 2013-11-22 07:22:19,721 ERROR [http-bio-0.0.0.0-8080-exec-5] [org.nuxeo.ecm.core.schema.SchemaManagerImpl] org.xml.sax.SAXParseException; systemId: file:/Users/rtrotter/Downloads/nuxeo-cap-5.8-tomcat/nxserver//schemas/bugtest.xsd; lineNumber: 44; columnNumber: 52; Unexpected <xs:complexType> appears at line 44 column 52

For completeness, here are lines 35 through 55 of bugtest.xsd as it got generated from studio:

<xs:element name="nest1" type="nxs:bugtest_nest1ListType"/> <xs:complexType name="bugtest_nest1ListType">

&lt;xs:sequence&gt;
  &lt;xs:element name=&quot;item&quot; type=&quot;nxs:bugtest_nest1Type&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
&lt;/xs:sequence&gt;

</xs:complexType> <xs:complexType name="bugtest_nest1Type">

&lt;xs:sequence&gt;
  &lt;xs:element name=&quot;nest2&quot; type=&quot;nxs:bugtest_nest2ListType&quot;/&gt;
  &lt;xs:complexType name=&quot;bugtest_nest2ListType&quot;&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name=&quot;item&quot; type=&quot;nxs:bugtest_nest2Type&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  &lt;xs:complexType name=&quot;bugtest_nest2Type&quot;&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name=&quot;foo&quot; type=&quot;xs:string&quot;/&gt;
    &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
&lt;/xs:sequence&gt;

</xs:complexType>

11/22/2013

Thanks a lot for the report and the detailed steps to reproduce!

I've created https://jira.nuxeo.com/browse/NXS-1851 if you'd like to follow the resolution.

11/22/2013

Thanks for the update! My user creds don't have access to the NXS jira space, so i might just have to keep my fingers crossed :-) Is there any way to get read-only access to it?
11/22/2013

Ah ok, i thought it was public, i'll look into it
11/22/2013

Hi,

You should be able to see the issue now

11/26/2013



Hi,

The corresponding bug (https://jira.nuxeo.com/browse/NXS-1851) is now fixed, thanks again for the report and the steps to reproduce.

0 votes



This isn't really a full answer, but it's an acceptable workaround. I still think the underlying issue is a bug in studio.

After I “Update” from “Update Center” to pull down the latest studio stuff, I do the following:

  • edit offending schema that get unpacked from the studio bundle in nxserver/schemas directory, fix busted syntax
  • in studio, delete the GUI-created schemas
  • create new schemas with the same name/prefix as the originals, but use the Advanced option to “Import” an XSD
  • Upload the edited schema

When you next run the update, Nuxeo DM reinitializes correctly, and no errors processing the schema.

0 votes