Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XML schema round-trip loosing min-exclusive... tags?
XML schema round-trip loosing min-exclusive... tags? [message #422726] Mon, 15 September 2008 13:12 Go to next message
Morten MacFly is currently offline Morten MacFlyFriend
Messages: 69
Registered: July 2009
Member
Dear NG,

I have created a model out of a XML schema in the first place. I was
under the assumption that modifying the Ecore model also updates the XML
schema via round-trip ("Generate Schema" is set to "true"). There is
also a nice video showing that on the Eclipse webpage.

I didn't touch the schema for a while. But today I realised that certain
elements got "lost". Especially all attributes based on this type
definition:

<xs:simpleType name="INT0_512_TYPE">
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="512"/>
</xs:restriction>
</xs:simpleType>

Which were:
<xs:element name="myAttr" default="0" type="INT0_512_TYPE"></xs:element>

....became now:
<xsd:attribute default="1" name="myAttr" type="xsd:string"></xsd:attribute>

Why did this happen? And can I somehow get the "right" XML schema again,
including the "minInclusive" (...) parts?

Notice that the ECore model includes the type definition "INT0512TYPE"
(the result of the conversion) with the required limitations as:

<eClassifiers xsi:type="ecore:EDataType" name="INT0512TYPE"
instanceClassName="java.math.BigInteger">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="INT0_512_TYPE"/>
<details key="baseType"
value="http://www.eclipse.org/emf/2003/XMLType#integer"/>
<details key="minInclusive" value="0"/>
<details key="maxInclusive" value="512"/>
</eAnnotations>
</eClassifiers>

....and the EStructuralFeature "myAttr" is of that type
<eStructuralFeatures xsi:type="ecore:EAttribute" name="myAttr"
unique="false"
lowerBound="1" eType="ecore:EDataType
common.ecore#//INT0512TYPE" defaultValueLiteral="1"
unsettable="true">
(...)

Notice that this only applies to specialised XML schema types. The worst
thing is that the type became now a xsd:string from an xs:integer in the
first place...?!

With regards, Morten.
Re: XML schema round-trip loosing min-exclusive... tags? [message #422727 is a reply to message #422726] Mon, 15 September 2008 13:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30806
Registered: July 2009
Senior Member
Morten,

Comments below.


Morten MacFly wrote:
> Dear NG,
>
> I have created a model out of a XML schema in the first place. I was
> under the assumption that modifying the Ecore model also updates the XML
> schema via round-trip ("Generate Schema" is set to "true"). There is
> also a nice video showing that on the Eclipse webpage.
>
That schema sucks. It's an XMI schema. It's not the same nice schema
as you get when you use Generator->Export...->XML Schema.
> I didn't touch the schema for a while. But today I realised that certain
> elements got "lost". Especially all attributes based on this type
> definition:
>
> <xs:simpleType name="INT0_512_TYPE">
> <xs:restriction base="xs:integer">
> <xs:minInclusive value="0"/>
> <xs:maxInclusive value="512"/>
> </xs:restriction>
> </xs:simpleType>
>
> Which were:
> <xs:element name="myAttr" default="0" type="INT0_512_TYPE"></xs:element>
>
> ...became now:
> <xsd:attribute default="1" name="myAttr" type="xsd:string"></xsd:attribute>
>
XMI schema clearly suck!
> Why did this happen? And can I somehow get the "right" XML schema again,
> including the "minInclusive" (...) parts?
>
Yes, but you have to export it...
> Notice that the ECore model includes the type definition "INT0512TYPE"
> (the result of the conversion) with the required limitations as:
>
> <eClassifiers xsi:type="ecore:EDataType" name="INT0512TYPE"
> instanceClassName="java.math.BigInteger">
> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="INT0_512_TYPE"/>
> <details key="baseType"
> value="http://www.eclipse.org/emf/2003/XMLType#integer"/>
> <details key="minInclusive" value="0"/>
> <details key="maxInclusive" value="512"/>
> </eAnnotations>
> </eClassifiers>
>
> ...and the EStructuralFeature "myAttr" is of that type
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="myAttr"
> unique="false"
> lowerBound="1" eType="ecore:EDataType
> common.ecore#//INT0512TYPE" defaultValueLiteral="1"
> unsettable="true">
> (...)
>
> Notice that this only applies to specialised XML schema types. The worst
> thing is that the type became now a xsd:string from an xs:integer in the
> first place...?!
>
It's quite incredible that XMI schemas aren't consider garbage by
everyone. I've describe them as the most complex way to turn off XML
validation that I'd ever seen...
> With regards, Morten.
>
Re: XML schema round-trip loosing min-exclusive... tags? [message #422729 is a reply to message #422727] Mon, 15 September 2008 13:40 Go to previous messageGo to next message
Morten MacFly is currently offline Morten MacFlyFriend
Messages: 69
Registered: July 2009
Member
Ed Merks wrote:
> That schema sucks. It's an XMI schema. It's not the same nice schema
> as you get when you use Generator->Export...->XML Schema.
YES!!! That did the trick. I simply didn't know that this export differs
from the one you get by the conversation... so I didn't try. (Yes:
RTFM...) All is fine again.

Thanks Ed!!! :-)
Re: XML schema round-trip loosing min-exclusive... tags? [message #422730 is a reply to message #422729] Mon, 15 September 2008 13:52 Go to previous messageGo to next message
Morten MacFly is currently offline Morten MacFlyFriend
Messages: 69
Registered: July 2009
Member
Morten MacFly wrote:
> YES!!! That did the trick.
Ooops - seems it got a step better but not completely. I also have types
like this:

<xs:simpleType name="STRING54_TYPE">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="54"/>
</xs:restriction>
</xs:simpleType>

They get exported (using the right way ;-)) like that:

<xsd:simpleType ecore:name="STRING54TYPE" name="STRING54_TYPE">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>

The Ecore element is like:

<eClassifiers xsi:type="ecore:EDataType" name="STRING54TYPE"
instanceClassName="java.lang.String">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="name" value="STRING54_TYPE"/>
<details key="baseType"
value="http://www.eclipse.org/emf/2003/XMLType#string"/>
<details key="minLength" value="1"/>
<details key="maxLength" value="54"/>
</eAnnotations>
</eClassifiers>

....any idea?!
Re: XML schema round-trip loosing min-exclusive... tags? [message #422731 is a reply to message #422730] Mon, 15 September 2008 14:00 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30806
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000609020807070004090008
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Morten,

Comments below.

Morten MacFly wrote:
> Morten MacFly wrote:
>
>> YES!!! That did the trick.
>>
> Ooops - seems it got a step better but not completely. I also have types
> like this:
>
> <xs:simpleType name="STRING54_TYPE">
> <xs:restriction base="xs:string">
> <xs:minLength value="1"/>
> <xs:maxLength value="54"/>
> </xs:restriction>
> </xs:simpleType>
>
> They get exported (using the right way ;-)) like that:
>
> <xsd:simpleType ecore:name="STRING54TYPE" name="STRING54_TYPE">
> <xsd:restriction base="xsd:string"/>
> </xsd:simpleType>
>
> The Ecore element is like:
>
> <eClassifiers xsi:type="ecore:EDataType" name="STRING54TYPE"
> instanceClassName="java.lang.String">
> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="STRING54_TYPE"/>
> <details key="baseType"
> value="http://www.eclipse.org/emf/2003/XMLType#string"/>
> <details key="minLength" value="1"/>
> <details key="maxLength" value="54"/>
> </eAnnotations>
> </eClassifiers>
>
> ...any idea?!
>
I see I missed the use of length facets for features that aren't
isMany. Please open a bugzilla with a small test case and I'll look
into it fixing that.


--------------000609020807070004090008
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Morten,<br>
<br>
Comments below.<br>
<br>
Morten MacFly wrote:
<blockquote cite="mid:galpbi$269$1@build.eclipse.org" type="cite">
<pre wrap="">Morten MacFly wrote:
</pre>
<blockquote type="cite">
<pre wrap="">YES!!! That did the trick.
</pre>
</blockquote>
<pre wrap=""><!---->Ooops - seems it got a step better but not completely. I also have types
like this:

&lt;xs:simpleType name="STRING54_TYPE"&gt;
&lt;xs:restriction base="xs:string"&gt;
&lt;xs:minLength value="1"/&gt;
&lt;xs:maxLength value="54"/&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;

They get exported (using the right way ;-)) like that:

&lt;xsd:simpleType ecore:name="STRING54TYPE" name="STRING54_TYPE"&gt;
&lt;xsd:restriction base="xsd:string"/&gt;
&lt;/xsd:simpleType&gt;

The Ecore element is like:

&lt;eClassifiers xsi:type="ecore:EDataType" name="STRING54TYPE"
instanceClassName="java.lang.String"&gt;
&lt;eAnnotations source=<a class="moz-txt-link-rfc2396E" href="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">"http:///org/eclipse/emf/ecore/util/ExtendedMetaData"</a>&gt;
&lt;details key="name" value="STRING54_TYPE"/&gt;
&lt;details key="baseType"
value=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/emf/2003/XMLType#string">"http://www.eclipse.org/emf/2003/XMLType#string"</a>/&gt;
&lt;details key="minLength" value="1"/&gt;
&lt;details key="maxLength" value="54"/&gt;
&lt;/eAnnotations&gt;
&lt;/eClassifiers&gt;

....any idea?!
</pre>
</blockquote>
I see I missed the use of length facets for features that aren't
isMany.&nbsp; Please open a bugzilla with a small test case and I'll look
into it fixing that.<br>
<br>
</body>
</html>

--------------000609020807070004090008--
Re: XML schema round-trip loosing min-exclusive... tags? [message #423300 is a reply to message #422731] Fri, 26 September 2008 14:12 Go to previous message
Morten MacFly is currently offline Morten MacFlyFriend
Messages: 69
Registered: July 2009
Member
Ed Merks wrote:
> I see I missed the use of length facets for features that aren't
> isMany. Please open a bugzilla with a small test case and I'll look
> into it fixing that.
Ed, sorry for the *very* long delay in answering. Work ekpt me quite
busy. As suggested I created a bug accordingly with sample files:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=248724

With regards, Morten.
Previous Topic:NullPointerException in XMLSaveImpl.saveDataTypeMany
Next Topic:CellModifier and CellEditor
Goto Forum:
  


Current Time: Mon Jan 20 17:50:26 GMT 2020

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

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

Back to the top