Ecore to XSD [message #602872] |
Tue, 04 March 2008 17:31 |
Eclipse User |
|
|
|
Hi,
I want to generate the xsd from an Ecore file. I have written some code
which uses the EcoreSchemaBuilder to create the xsd file.
Here is the code snippet:
EPackage ePackage = getEPackage(ecoreFilePath);
EPackage.Registry.INSTANCE.put(XSDPackageImpl.eNS_URI,
XSDPackageImpl.eINSTANCE);
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(
XSDPackageImpl.eNS_URI, XSDPackageImpl.eINSTANCE);
resourceSet.getResourceFactoryRegistry()
.getExtensionToFactoryMap().put(XSD_EXTENSION,new
XSDResourceFactoryImpl());
ExtendedMetaData extendedMetaData = new BasicExtendedMetaData();
EcoreSchemaBuilder xsdBuilder = new EcoreSchemaBuilder(extendedMetaData);
XSDSchema xsd = xsdBuilder.getSchema(ePackage);
Resource xsdResource = resourceSet.createResource(URI
.createPlatformResourceURI(xsdFilePath.toString()));
xsdResource.getContents().add(xsd);
....code to save the xsd resource.......
My problem is that i donot need any ecore references in the xsd file. It
should be the plain xsd file without any ecore declaration in it.
Any pointers on this will really help.....
Thanks in advance,
Vipul
|
|
|
Powered by
FUDForum. Page generated in 0.02709 seconds