cancel
Showing results for 
Search instead for 
Did you mean: 

How to include XSD into other XSD?

dhavalprajapati
Champ in-the-making
Champ in-the-making
Hello,

I am trying to include Common XSD into other XSDs. but i am getting below exception every time :

org.alfresco.web.forms.FormProcessor$ProcessingException: org.alfresco.web.forms.xforms.FormBuilderException: error parsing schema: at line 19 column 64: src-resolve: Cannot resolve the name 'otherroottype' to a(n) 'type definition' component.

please find my XSD as per below :

DEMO Included XSD :

<xs:schema xmlns="http://www.demo.com"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.demo.com"
    elementFormDefault="qualified" version="1.0"
    id="demo_include">
    <xs:element name="otherroot" type="otherroottype"/>
   
    <xs:complexType name="otherroottype">
        <xs:sequence maxOccurs="unbounded">
            <xs:element name="otherrecord"
                type="otherrecordtype"/>
        </xs:sequence>
    </xs:complexType>
   
    <xs:complexType name="otherrecordtype">
        <xs:annotation>         
        </xs:annotation>
        <xs:sequence>
            <xs:element name="id"
                type="xs:integer" nillable="false"/>
            <xs:element name="name" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

DEMO XSD :

<xs:schema xmlns="http://www.demo.com"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.demo.com"
    elementFormDefault="qualified" version="1.0" id="demo">
    <xs:include schemaLocation="demo_include.xsd"/>
    <xs:element name="root" type="roottype"/>
   
    <xs:complexType name="roottype">
        <xs:sequence maxOccurs="unbounded">
            <xs:element name="record" type="recordtype"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="recordtype">
        <xs:annotation>
            <xs:documentation>this is the main element.
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="id" type="xs:integer" nillable="false"/>
            <xs:element name="name" type="xs:string"/>
            <xs:element name="otherroot" type="otherroottype"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>


Kindly help me to correct my XSD.
2 REPLIES 2

sujaypillai
Confirmed Champ
Confirmed Champ
Check for the path of included xsd. As per your xsd defintion the currently included xsd (demo_include.xsd) should be placed under the same folder where demo.xsd resides.

asheara
Champ in-the-making
Champ in-the-making
Hi,

Have you tried like this?
<xs:include schemaLocation="webscript://api/path/content/workspace/SpacesStore/Data Dictionary/Web Forms/comun/comun.xsd?ticket=${ticket}"/> (alfresco 3.3 version)