[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.m2m] [QVT XSD EMF] How to get a xsd complexType from a model
|
Hi,
I tried to get a xsd complex type from a model, but failed.
The .qvto is as following:
modeltype INTEROP uses "http://www.test.com/interop";
modeltype XSD uses "http://www.eclipse.org/xsd/2002/XSD";
transformation interop2xsd(in interop: INTEROP , out XSD);
main(in interopModel: INTEROP::InteropSchema, out xsd: XSD::XSDSchema) {
xsd:= interopModel.map interop2Xsd();
}
mapping INTEROP::InteropSchema::interop2Xsd() : XSD::XSDSchema {
targetNamespace := 'http://www.test.com/schedule';
typeDefinitions := self.views2Types();
}
query INTEROP::InteropSchema::views2Types() :
OrderedSet(XSD::XSDTypeDefinition) {
self.views->collect(view | view.view2Type())->asOrderedSet();
}
mapping INTEROP::InteropViewComplexType::view2Type() :
XSD::XSDComplexTypeDefinition
{ -- only set name, no others since I even can not get a complex type
name := self.name;
}
--
The IN parameter:
<?xml version="1.0" encoding="ISO-8859-1"?>
<interop:InteropSchema xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:interop="http://ms.com/interop"
domainName="interoptest" schemaMetaMajorVersion="1"
schemaMetaMinorVersion="4">
<views name="Schedule" version="1">
<elements name="scheduleId" maxOccurs="1" minOccurs="1"
type="xsd:string"/>
<elements name="price" maxOccurs="1" minOccurs="0" type="xsd:double"/>
</views>
</interop:InteropSchema>
----
However, the OUT is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace='http://www.test.com/schedule'/>
----
The problems are:
1) There is no xmlns:xsd="http://www.w3.org/2001/XMLSchema", how can I
get this generated?
2) Why I can not get a complex type with 'Schedule' named? Do I have to
set more attributes? Since XSD.ecore is quit complex, I am not sure how to
do mapping exactly? Is there any good example?
Thanks for any suggestions.
David