|Re: Ecore validation [message #1219503 is a reply to message #1219478]
||Wed, 04 December 2013 10:20
| Ed Merks
Registered: July 2009
On 04/12/2013 7:05 AM, Tyler Lee wrote:
> Dear Ed,
> Thank you for the clarification. In terms of the introductory
> tutorials first of all I need to generate Java code from .uml or its
> .ecore representation.
It's not clear what you're doing. UML2 is already generated so perhaps
you just need to use that.
> Once it is done using EMF I can validate my XMI model resource against
> the event-based SAX parser along with these marshaled Java objects.
EMF can parse any XMI given you have an Ecore model for it, e.g.,
UML2.ecore is used to parse UML2...
> In other words validation errors are produced as the resource is
> loaded (trying to build the object hierarchy).
Yes, if the instance is wrong, errors will be diagnosed.
> That is why if I have a nested UML class error
> for example, it will only come to see if I browse the nesting class in
> the UML/EMF/GMF editor (the active elements of the resource are checked).
The resource throws exceptions if the syntax is invalid. Many editors
catch this exception and show what's possible to parse. Many models also
add constraints on top of just the XMI parsing, e.g., in Ecore it's
invalid for more than one classifier in a package to have the same name...
> Is it the general approach what Eclipse uses for validating XML
> resources then?
You've switched from XMI to XML now. Validating XML in general can be
done with an XML schema. EMF can be used as an XML binding framework,
similar to JAXB.
> Please correct me if I am mistaken in any regards.
Powered by FUDForum
. Page generated in 0.02135 seconds