Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Ecore to XSD
Ecore to XSD [message #602872] Tue, 04 March 2008 17:31
Vipul is currently offline VipulFriend
Messages: 6
Registered: July 2009
Junior Member
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
Previous Topic:Create new DOM document from XSD schema
Next Topic:Eclipse : Write XML using XSD
Goto Forum:
  


Current Time: Fri Apr 26 14:01:11 GMT 2024

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

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

Back to the top