Generates an XSD with annotations from an ECore model [message #64434] |
Mon, 10 October 2005 10:31  |
Eclipse User |
|
|
|
Originally posted by: jdebouil.bmc.com
I build an ECore model which uses EAnnotation. And when I generate an XSD
file from my ECore model, the Annotations are not added.
EPackage myPackage = EcoreFactory.eINSTANCE.createEPackage();
myPackage.setName(PACKAGE_NAME);
myPackage.setNsPrefix(PACKAGE_NS_PREFIX);
myPackage.setNsURI(PACKAGE_NS_URI);
// documentList is a list of EClassifier
myPackage.getEClassifiers().addAll(documentList);
EAnnotation myAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
myAnnotation.setSource(ANNOTATION_SOURCE);
myAnnotation.getDetails().put("ecore:isRootDocument", "true");
myPackage.getEAnnotations().add(myAnnotation);
// XMLSchema building
EcoreXMLSchemaBuilder xmlSchemaBuilder = new EcoreXMLSchemaBuilder();
Collection resultXmlSchemaBuilder = xmlSchemaBuilder.generate(myPackage);
// Register XML resource factory
org.eclipse.emf.ecore.resource.Resource resource = new
XSDResourceImpl(URI.createFileURI(MY_URI));
resource.getContents().addAll(resultXmlSchemaBuilder);
Map properties = new HashMap();
properties.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
try {
resource.save(properties);
} catch (IOException e) {
ExceptionHandler.processException(e, null);
}
|
|
|
Re: Generates an XSD with annotations from an ECore model [message #64481 is a reply to message #64434] |
Tue, 11 October 2005 11:45  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------030205040900040506090702
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Julien,
The existing schema generator doesn't take annotations into account.
We're working on a new one that would:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=93194
Julien wrote:
> I build an ECore model which uses EAnnotation. And when I generate an
> XSD file from my ECore model, the Annotations are not added.
>
>
> EPackage myPackage = EcoreFactory.eINSTANCE.createEPackage();
> myPackage.setName(PACKAGE_NAME);
> myPackage.setNsPrefix(PACKAGE_NS_PREFIX);
> myPackage.setNsURI(PACKAGE_NS_URI);
> // documentList is a list of EClassifier
> myPackage.getEClassifiers().addAll(documentList);
> EAnnotation myAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
> myAnnotation.setSource(ANNOTATION_SOURCE);
> myAnnotation.getDetails().put("ecore:isRootDocument", "true");
> myPackage.getEAnnotations().add(myAnnotation);
> // XMLSchema building
> EcoreXMLSchemaBuilder xmlSchemaBuilder = new EcoreXMLSchemaBuilder();
> Collection resultXmlSchemaBuilder = xmlSchemaBuilder.generate(myPackage);
> // Register XML resource factory
> org.eclipse.emf.ecore.resource.Resource resource = new
> XSDResourceImpl(URI.createFileURI(MY_URI));
> resource.getContents().addAll(resultXmlSchemaBuilder);
> Map properties = new HashMap();
> properties.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
> try {
> resource.save(properties);
> } catch (IOException e) {
> ExceptionHandler.processException(e, null); }
>
--------------030205040900040506090702
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Julien,<br>
<br>
The existing schema generator doesn't take annotations into account.
|
|
|
Re: Generates an XSD with annotations from an ECore model [message #596914 is a reply to message #64434] |
Tue, 11 October 2005 11:45  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------030205040900040506090702
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Julien,
The existing schema generator doesn't take annotations into account.
We're working on a new one that would:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=93194
Julien wrote:
> I build an ECore model which uses EAnnotation. And when I generate an
> XSD file from my ECore model, the Annotations are not added.
>
>
> EPackage myPackage = EcoreFactory.eINSTANCE.createEPackage();
> myPackage.setName(PACKAGE_NAME);
> myPackage.setNsPrefix(PACKAGE_NS_PREFIX);
> myPackage.setNsURI(PACKAGE_NS_URI);
> // documentList is a list of EClassifier
> myPackage.getEClassifiers().addAll(documentList);
> EAnnotation myAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
> myAnnotation.setSource(ANNOTATION_SOURCE);
> myAnnotation.getDetails().put("ecore:isRootDocument", "true");
> myPackage.getEAnnotations().add(myAnnotation);
> // XMLSchema building
> EcoreXMLSchemaBuilder xmlSchemaBuilder = new EcoreXMLSchemaBuilder();
> Collection resultXmlSchemaBuilder = xmlSchemaBuilder.generate(myPackage);
> // Register XML resource factory
> org.eclipse.emf.ecore.resource.Resource resource = new
> XSDResourceImpl(URI.createFileURI(MY_URI));
> resource.getContents().addAll(resultXmlSchemaBuilder);
> Map properties = new HashMap();
> properties.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
> try {
> resource.save(properties);
> } catch (IOException e) {
> ExceptionHandler.processException(e, null); }
>
--------------030205040900040506090702
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Julien,<br>
<br>
The existing schema generator doesn't take annotations into account.
|
|
|
Powered by
FUDForum. Page generated in 0.03465 seconds