cancel
Showing results for 
Search instead for 
Did you mean: 

Including / importing an xsd into another xsd for Xforms

boneill
Star Contributor
Star Contributor
Hi guys,

I have a global xsd with common elements such as menu-item which I want to import into other xsds.  I know there are numerous posts on this but I cant seem to get it work. 

Here is the xsd I want to include:  This is placed at the Root of my webproject:


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:na="http://www.nissan.com.au/alfresco"
   xmlns:alf="http://www.alfresco.org"
   targetNamespace="http://www.nissan.com.au/alfresco"
   elementFormDefault="qualified">

   <xs:complexType name="link">
       <xs:sequence>
         <xs:element name="label" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
         <xs:element name="path" type="xs:anyURI" />
         <xs:element name="open_in_new_window" type="xs:boolean" default="false"/>
       </xs:sequence>
   </xs:complexType>
   
   <xs:complexType name="vertical_navigation">
         <xs:sequence>
            <xs:element name="heading" type="xs:normalizedString" />
            <xs:element name="menu_item" type="na:link" minOccurs="1" maxOccurs="8" />         
         </xs:sequence>
   </xs:complexType>
</xs:schema>

Here is the xsd that includes the above xsd.  Note it tries to include the vertical_navigation complex type from the above xsd:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:alf="http://www.alfresco.org"
   xmlns:na="http://www.nissan.com.au/alfresco"
   elementFormDefault="qualified">
   
   <xs:import namespace="http://www.nissan.com.au/alfresco" schemaLocation="nissanmarketing_global.xsd"/>
   
   <xs:element name="model_series">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="navigation" type="na:vertical_navigation" />
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>

Has anyone got an example of this.  Would like to view the included xsd and the xsd it is included in. 

Note: I have read all the following:

http://wiki.alfresco.com/wiki/Forms_Developer_Guide#Overview_of_supported_XML_Schema_structures_and_...
http://forums.alfresco.com/en/viewtopic.php?t=12395
http://forums.alfresco.com/en/viewtopic.php?f=29&t=11196&hilit=xs%3Aimport+xsd
and anything else I can find on the subject I could find on the forums. 

Many thanks,
3 REPLIES 3

dotcombubble
Champ in-the-making
Champ in-the-making
I too would like to be able to do this, helps to reuse code Smiley Wink

I've tried what boneill tried and had no luck too.

I also tried:
  <xs:include schemaLocation="/common-xsd.xsd"/>
and uploaded common-xsd.xsd to the root of my web project. But no joy.

How would I include a common XSD file? Can I store my common files in a seperate space? How do I get a reference to them for inclusion.

Any help would be appreciated.

dvc
Champ in-the-making
Champ in-the-making
I have the same situation.

Any guru with the solution????

Thanks!!!

kramoutar
Champ in-the-making
Champ in-the-making
You can do this by including a line of code to this effect in your XSDs:
<xs:include schemaLocation="webscript://api/path/content/workspace/SpacesStore/Company Home/Data Dictionary/Web Forms/common_definitions/common_definitions.xsd?ticket={ticket}"/>
  The portion after "Company Home" should be the specific path to and name of the main XSD with your schema type definitions.