Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Keeping generated XSD free from ecore
Keeping generated XSD free from ecore [message #403420] Thu, 07 September 2006 14:21 Go to next message
Tas Frangoullides is currently offline Tas FrangoullidesFriend
Messages: 195
Registered: July 2009
Senior Member
Hi,

I am trying to programatically generate an ecore model from a uml model
which I can then use to generate XML Schema and EMF code for manipulating
it. I want the generated schema to be free from references to ecore. I've
managed to map primitive types to types in XMLTypePackage but I still have
unwanted references.

The XSD being produced when I use the Export Model...->XML Schema tool is
as follows

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:MyPackage="http:///MyPackage.ecore"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" ecore:nsPrefix="MyPackage"
ecore:package="MyPackage" targetNamespace="http:///MyPackage.ecore">
<xsd:element ecore:ignore="true" name="MyClass"
type="MyPackage:MyClass"/>
<xsd:complexType name="MyClass">
<xsd:attribute name="myInteger" type="xsd:string"/>
<xsd:attribute name="myUnlimitedNatural" type="xsd:unsignedInt"/>
</xsd:complexType>
</xsd:schema>

What I'd like to do is remove the ecore namespace and the "ecore:ignore"
attribute.

Thanks,
Tas.
Re: Keeping generated XSD free from ecore [message #403422 is a reply to message #403420] Thu, 07 September 2006 14:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29392
Registered: July 2009
Senior Member
Tas,

We always generate all the annotations necessary to round trip the
result, so if you don't want those, you'll need to write a XSLT script
to remove them. (Of course we could provide an option not to generate
them too, but that's yet another feature request; one that's quite
simple to implement but we might not have time for.) All these things
are purely annotations so their presence should cause no problems nor
create dependencies that other tools can't handle (i.e., ignore).


Tas Frangoullides wrote:
> Hi,
>
> I am trying to programatically generate an ecore model from a uml
> model which I can then use to generate XML Schema and EMF code for
> manipulating it. I want the generated schema to be free from
> references to ecore. I've managed to map primitive types to types in
> XMLTypePackage but I still have unwanted references.
>
> The XSD being produced when I use the Export Model...->XML Schema tool
> is as follows
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:MyPackage="http:///MyPackage.ecore"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> ecore:nsPrefix="MyPackage" ecore:package="MyPackage"
> targetNamespace="http:///MyPackage.ecore">
> <xsd:element ecore:ignore="true" name="MyClass"
> type="MyPackage:MyClass"/>
> <xsd:complexType name="MyClass">
> <xsd:attribute name="myInteger" type="xsd:string"/>
> <xsd:attribute name="myUnlimitedNatural" type="xsd:unsignedInt"/>
> </xsd:complexType>
> </xsd:schema>
>
> What I'd like to do is remove the ecore namespace and the
> "ecore:ignore" attribute.
> Thanks,
> Tas.
>
Re: Keeping generated XSD free from ecore [message #403427 is a reply to message #403422] Thu, 07 September 2006 17:24 Go to previous messageGo to next message
Tas Frangoullides is currently offline Tas FrangoullidesFriend
Messages: 195
Registered: July 2009
Senior Member
Ed,

Thanks for the help. I didn't realise this was the reason for them...
makes sense now!

Tas.

Ed Merks wrote:

> Tas,

> We always generate all the annotations necessary to round trip the
> result, so if you don't want those, you'll need to write a XSLT script
> to remove them. (Of course we could provide an option not to generate
> them too, but that's yet another feature request; one that's quite
> simple to implement but we might not have time for.) All these things
> are purely annotations so their presence should cause no problems nor
> create dependencies that other tools can't handle (i.e., ignore).


> Tas Frangoullides wrote:
>> Hi,
>>
>> I am trying to programatically generate an ecore model from a uml
>> model which I can then use to generate XML Schema and EMF code for
>> manipulating it. I want the generated schema to be free from
>> references to ecore. I've managed to map primitive types to types in
>> XMLTypePackage but I still have unwanted references.
>>
>> The XSD being produced when I use the Export Model...->XML Schema tool
>> is as follows
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xsd:schema xmlns:MyPackage="http:///MyPackage.ecore"
>> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> ecore:nsPrefix="MyPackage" ecore:package="MyPackage"
>> targetNamespace="http:///MyPackage.ecore">
>> <xsd:element ecore:ignore="true" name="MyClass"
>> type="MyPackage:MyClass"/>
>> <xsd:complexType name="MyClass">
>> <xsd:attribute name="myInteger" type="xsd:string"/>
>> <xsd:attribute name="myUnlimitedNatural" type="xsd:unsignedInt"/>
>> </xsd:complexType>
>> </xsd:schema>
>>
>> What I'd like to do is remove the ecore namespace and the
>> "ecore:ignore" attribute.
>> Thanks,
>> Tas.
>>
Re: Keeping generated XSD free from ecore [message #1782516 is a reply to message #403427] Sun, 25 February 2018 11:12 Go to previous messageGo to next message
Boris Bogumil is currently offline Boris BogumilFriend
Messages: 1
Registered: February 2018
Junior Member
I have followed this discussion with great interest as well as I seem to be facing the same issue. Given that the original post is rather old by now, I was wondering if there is any update to removing the ecorenamespace from the XSD programatically.

Alternatively, I would be greatly interested in help in creating an XSLT document to achieve the removal of the unwanted namespaces from the resulting XSD.
Re: Keeping generated XSD free from ecore [message #1782605 is a reply to message #1782516] Tue, 27 February 2018 05:35 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29392
Registered: July 2009
Senior Member
I'm certainly no expert in XSLT. I'd probably just load the *.xsd as DOM, walk the DOM to remove attributes I don't want, and then serialize it again, all just using Java DOM.
Previous Topic:Register EPackage in Xcore programatically in Standalone
Next Topic:XML2XML transformation
Goto Forum:
  


Current Time: Sat Jun 23 23:56:59 GMT 2018

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

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

Back to the top