AnsweredAssumed Answered

How to include XSD into other XSD?

Question asked by dhavalprajapati on Feb 20, 2011
Latest reply on Jun 3, 2011 by asheara
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.

Outcomes