There are three different ways to declare your XSDs. It does not matter which way you choose, or how you combine them, as long as the XSD Adapter can find all needed schemas.
Within the Workflow:
org.eclipse.xtend.typesystem.xsd.XSDMetaModel
can have any
amount of schemaFile
elements.
<component class="org.eclipse.xtend.typesystem.xsd.XMLReader"> <modelSlot value="model" /> <uri value="${file}" /> <metaModel id="mm" class="org.eclipse.xtend.typesystem.xsd.XSDMetaModel"> <schemaFile value="model/loadcurve.xsd" /> <schemaFile value="model/device.xsd" /> </metaModel> </component>
Within the XML file: XML files can contain
schemaLocation
attributes which associate the
schema's namespace with the schema's filename. If the schema is
created using WTP like described in the section called “Step 3: Create a Model using XML” , the
schemaLocation
attribute is created
automatically.
<?xml version="1.0" encoding="UTF-8"?> <device:Device xmlns:device="http://www.eclipse.org/modeling/xpand/example/model/device" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eclipse.org/modeling/xpand/example/model/device device.xsd"> <device:Name>MyLaptop</device:Name> </device:Device>
Within an XSD: If one schema imports another, the
import
element can have a
schemaLocation
attribute, too.
<?xml version="1.0" encoding="UTF-8"?> <schema targetNamespace="http://www.eclipse.org/modeling/xpand/example/model/device" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.eclipse.org/modeling/xpand/example/model/device" xmlns:lc="http://www.eclipse.org/modeling/xpand/example/model/loadcurve" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"> <import namespace="http://www.eclipse.org/modeling/xpand/example/model/loadcurve" schemaLocation="loadcurve.xsd"> </import> <complexType name="Device"> <sequence> <element name="Name" type="string" /> <element name="LoadCurve" type="lc:LoadCurve" /> </sequence> </complexType> <element name="Device" type="tns:Device"></element> </schema>