How to use ecore(metamodel) generated from xsd schema for m2m transformation ? [message #19775] |
Thu, 01 March 2007 08:17 |
Eclipse User |
|
|
|
Originally posted by: xxcs214.163.com
Attach my schema files : book.xsd and publication.xsd
book.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.m2matl.com/book"
xmlns:ns="http://www.m2matl.com/book"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<element name="book" type="ns:Book" />
<complexType name="Book">
<sequence>
<element name="name" type="xsd:string" />
<element name="author" type="xsd:string" />
</sequence>
</complexType>
</schema>
publication.xsd
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.m2matl.com/publication"
xmlns:ns="http://www.m2matl.com/publication"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<element name="publication" type="ns:Publication" />
<complexType name="Publication">
<attribute name="name" type="xsd:string" />
<attribute name="author" type="xsd:string" />
</complexType>
</schema>
I generate two ecore files using EMF from the schemas, write B2P.atl ,run
like samples in User_Manual, but it doesn't works.
B2P.atl:
module B2P; -- Module Template
create OUT : Publication from IN : Book;
rule Book2Publication {
from
b : Book!Book
to
out : Publication!Publication (
name <- b.name,
author <- b.author
)
}
The ecore files'size are too big so I don't list here, what special are
that both the files contain "DocumentRoot" node which contains "book" and
"publication" and nodes in the files have "ExtendMetaData".
I'm not very fimliar with ATL, so is the atl file correct or can't use
the ecore files gen from xsd or else?
Any help would be appreciated!
Best regards!
Shan
|
|
|
Powered by
FUDForum. Page generated in 0.02626 seconds