Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How do I define a nillable element in XSD schema for ecore XML model plugin(How do I define a nillable element in XSD schema used for creating an Ecore M2M XML plugin in Eclipse 3.6.0)
How do I define a nillable element in XSD schema for ecore XML model plugin [message #1780829] Mon, 29 January 2018 04:01 Go to next message
Moses Chitima is currently offline Moses ChitimaFriend
Messages: 1
Registered: May 2017
Junior Member
I am using an qvt ecore m2m transformation to convert an data in xml format to a proprietary data format and have hit snag when handling null value data. i get the following error when an of the elements of integer type has a null value:

org.eclipse.emf.ecore.xmi.IllegalValueException: Value '' is not legal

An of example of the element values are " <ns1:xxxNumber nil="true"/>" , and "<ns1:xxxNumber/>" . The definition in the XSD schema used to create an XML to ecore plugin is as follows:

<xs:element name="xxxNumber" type="xs:integer" default ="-1" nillable="true"/>

One way i have had to do as a workaround is defining the element as type string then converting it to integer as part of the mapping process. I however think there must be a better way of doing out there.

Your help is greatly appreciated...
Re: How do I define a nillable element in XSD schema for ecore XML model plugin [message #1780891 is a reply to message #1780829] Mon, 29 January 2018 16:05 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5885
Registered: July 2009
Senior Member
Hi

IMHO using XSD is madness when you the much better Ecore to use. I recommend solving the problem with Ecore then use the Ecore to XSD to conversion to find out what you should have done in XSD.

My guess is that you should have omitted the default ="-1".

Regards

Ed Willink
Re: How do I define a nillable element in XSD schema for ecore XML model plugin [message #1780894 is a reply to message #1780891] Mon, 29 January 2018 17:01 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29349
Registered: July 2009
Senior Member
Is the "xsi:" missing from nil in <ns1:xxxNumber nil="true"/>. I.e., does this really have http://www.w3.org/2001/XMLSchema-instance as its namespace? The <ns1:xxxNumber/> definitely doesn't look valid. The value is empty and that isn't an integer value.
Previous Topic:Feaure request: Inerface not extending EObject
Next Topic:Disabling Notifications on ResourceSet.clear
Goto Forum:
  


Current Time: Mon May 21 15:21:03 GMT 2018

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

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

Back to the top