Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Generates an XSD with annotations from an ECore model
Generates an XSD with annotations from an ECore model [message #64434] Mon, 10 October 2005 14:31 Go to next message
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 15:45 Go to previous message
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 15:45 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
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.
Previous Topic:How to print logical view of schema?
Next Topic:How to print logical view of schema?
Goto Forum:
  


Current Time: Sat Sep 20 08:18:16 GMT 2014

Powered by FUDForum. Page generated in 0.02552 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software