/api/path/content{property}/{store_type}/{store_id}/{path}?a={attach?}
/api/path/content/workspace/SpacesStore/Company Home/Data Dictionary/Presentation Templates/readme.ftl
Using the Web Script inclusion mechanism for Web Forms, we can use this Web Script to include or import any XSD file stored in the DM repository. For example, if we have a file called 'my-include.xsd' in the 'Company Home' space that contains the following content:
<?xml version='1.0'?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
xmlns:alf='http://www.alfresco.org/'
targetNamespace='http://www.alfresco.org/'
elementFormDefault='qualified'>
<xs:complexType abstract='true' name='IncludedComplexType'>
<xs:sequence>
<xs:element name='Title'
type='xs:normalizedString'
minOccurs='1'
maxOccurs='1' />
<xs:element name='Summary'
type='xs:string'
minOccurs='0'
maxOccurs='1' />
<xs:element name='Keyword'
type='xs:normalizedString'
minOccurs='0'
maxOccurs='unbounded' />
</xs:sequence>
</xs:complexType>
</xs:schema>
We could include it into a Web Form XSD using an include statement such as the following:
<?xml version='1.0'?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
xmlns:alf='http://www.alfresco.org/'
targetNamespace='http://www.alfresco.org/'
elementFormDefault='qualified'>
<xs:include schemaLocation='webscript://api/path/content/workspace/SpacesStore/Company Home/my-include.xsd?ticket={ticket}' />
<xs:complexType name='MyWebFormType'>
<xs:complexContent>
<xs:extension base='alf:IncludedComplexType'>
<xs:sequence>
<xs:element name='Body'
type='xs:string'
minOccurs='1'
maxOccurs='1' />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name='MyWebForm' type='alf:MyWebFormType' />
</xs:schema>
This is clearly faster and easier than developing a custom Web Script to either emit the XML Schema shown above, or to return the contents of a specific XSD file from the repository!
This approach also provides a solution to another question: how does one neatly package up a Web Form, along with all of its dependencies, ready for deployment to another Alfresco environment?
By storing included XSD files in Company Home > Data Dictionary > Web Forms, we give ourselves the option to package up the entire Web Forms space as an ACP file and deploy that ACP file to any other Alfresco environment, knowing that we've captured not only all of the Web Forms in the source environment, but all dependent XSD files as well.