Home » Modeling » EMF » XML Schema and upper/lower bounds
| |
Re: XML Schema and upper/lower bounds [message #900296 is a reply to message #900058] |
Mon, 06 August 2012 11:55 |
Jesper Eskilson Messages: 134 Registered: July 2009 |
Senior Member |
|
|
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 08/03/2012 07:49 PM, Ed Merks wrote:
<blockquote cite="mid:jvh2uk$duk$1@xxxxxxxxe.org" type="cite">Jesper,
<br>
<br>
Comments below.
<br>
<br>
On 03/08/2012 4:10 PM, Jesper Eskilson wrote:
<br>
<blockquote type="cite">Hi,
<br>
<br>
I'm trying to write an XML schema for an existing XML file
format, so that I can load these XML files as EMF models, but
I'm having problem in getting the upper/lower bounds correct.
For example:
<br>
<br>
<blockquote type="cite"> <xs:element name="project">
<br>
<xs:complexType>
<br>
<xs:choice maxOccurs="unbounded">
<br>
<xs:element name="fileVersion"
type="xs:string"
<br>
minOccurs="1" maxOccurs="1" />
<br>
<xs:element name="configuration"
type="configuration"
<br>
maxOccurs="unbounded" />
<br>
<xs:element name="group" type="group"
maxOccurs="unbounded" />
<br>
<xs:element name="file" type="file"
maxOccurs="unbounded" />
<br>
</xs:choice>
<br>
</xs:complexType>
<br>
</xs:element>
<br>
</blockquote>
<br>
This results in a EClass "ProjectType" with a multivalued
"fileVersion" reference of type "EList<String>", but I
would like "fileVersion" to be an *attribute* of type String.
<br>
</blockquote>
Your schema allows an unbounded number of choices and hence there
can be an unbounded number of file version elements.
<br>
<blockquote type="cite">Why isn't "maxOccurs" honored by EMF?
<br>
</blockquote>
Why do you have an unbounded choice? Any bounds within its nested
elements are kind of meaningless from a schema point of view.
<br>
<br>
</blockquote>
<br>
Maybe I'm hitting a limit of how XML schemas work. I want to be able
to specify child elements in any order *and* any multiplicity, but
maybe that is impossible. For example, I would like to allow a set
of child elements A, B, C in any order, such that A and B occurs
exactly once, but C occurs any number of times, but at least once.
If I fix the order of A and B I can use a sequence, but I would like
to avoid that.<br>
<br>
<div class="moz-signature">-- <br>
<p>
<span style="color: #a6a6a6; font-family:
arial,helvetica,sans-serif; font-size: 10pt;"><strong>Jesper
Eskilson</strong></span>
<span style="color: #fdb913; font-family:
arial,helvetica,sans-serif; font-size: 10pt;"><em>Development
Engineer</em></span><br>
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">IAR Systems AB<br>
Box 23051, Strandbodgatan 1<br>
SE-750 23 Uppsala, SWEDEN<br>
Phone: +46 18 16 78 00<br>
E-mail: <a href="mailto:jesper.eskilson@xxxxxxxx">
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">jesper.eskilson@xxxxxxxx</span></a>
Website: <a href="http://www.iar.com">
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">www.iar.com<br>
</span></a>
Twitter: <a href="http://www.twitter.com/iarsystems">
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">www.twitter.com/iarsystems</span></a>
</span>
</p>
</div>
</body>
</html>
|
|
|
Re: XML Schema and upper/lower bounds [message #900313 is a reply to message #900296] |
Mon, 06 August 2012 13:01 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Jesper,<br>
<br>
XML Schema has <any> but its use is quite limited and EMF
treats it like a <sequence>. EMF's deserializer doesn't check
that element are actually in the correct order anyway, and will
write them out in the model's feature order (except where feature
maps are used).<br>
<br>
<br>
<div class="moz-cite-prefix">On 06/08/2012 1:55 PM, Jesper Eskilson
wrote:<br>
</div>
<blockquote cite="mid:jvobas$l1o$1@xxxxxxxxe.org" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
On 08/03/2012 07:49 PM, Ed Merks wrote:
<blockquote cite="mid:jvh2uk$duk$1@xxxxxxxxe.org" type="cite">Jesper,
<br>
<br>
Comments below. <br>
<br>
On 03/08/2012 4:10 PM, Jesper Eskilson wrote: <br>
<blockquote type="cite">Hi, <br>
<br>
I'm trying to write an XML schema for an existing XML file
format, so that I can load these XML files as EMF models, but
I'm having problem in getting the upper/lower bounds correct.
For example: <br>
<br>
<blockquote type="cite"> <xs:element name="project">
<br>
<xs:complexType> <br>
<xs:choice maxOccurs="unbounded"> <br>
<xs:element name="fileVersion"
type="xs:string" <br>
minOccurs="1" maxOccurs="1" /> <br>
<xs:element name="configuration"
type="configuration" <br>
maxOccurs="unbounded" /> <br>
<xs:element name="group" type="group"
maxOccurs="unbounded" /> <br>
<xs:element name="file" type="file"
maxOccurs="unbounded" /> <br>
</xs:choice> <br>
</xs:complexType> <br>
</xs:element> <br>
</blockquote>
<br>
This results in a EClass "ProjectType" with a multivalued
"fileVersion" reference of type "EList<String>", but I
would like "fileVersion" to be an *attribute* of type String.
<br>
</blockquote>
Your schema allows an unbounded number of choices and hence
there can be an unbounded number of file version elements. <br>
<blockquote type="cite">Why isn't "maxOccurs" honored by EMF? <br>
</blockquote>
Why do you have an unbounded choice? Any bounds within its
nested elements are kind of meaningless from a schema point of
view. <br>
<br>
</blockquote>
<br>
Maybe I'm hitting a limit of how XML schemas work. I want to be
able to specify child elements in any order *and* any
multiplicity, but maybe that is impossible. For example, I would
like to allow a set of child elements A, B, C in any order, such
that A and B occurs exactly once, but C occurs any number of
times, but at least once. If I fix the order of A and B I can use
a sequence, but I would like to avoid that.<br>
<br>
<div class="moz-signature">-- <br>
<p> <span style="color: #a6a6a6; font-family:
arial,helvetica,sans-serif; font-size: 10pt;"><strong>Jesper
Eskilson</strong></span> <span style="color: #fdb913;
font-family: arial,helvetica,sans-serif; font-size: 10pt;"><em>Development
Engineer</em></span><br>
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">IAR Systems AB<br>
Box 23051, Strandbodgatan 1<br>
SE-750 23 Uppsala, SWEDEN<br>
Phone: +46 18 16 78 00<br>
E-mail: <a moz-do-not-send="true"
href="mailto:jesper.eskilson@xxxxxxxx"> <span
style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">jesper.eskilson@xxxxxxxx</span></a>
Website: <a moz-do-not-send="true"
href="http://www.iar.com"> <span style="color: #808080;
font-family: arial,helvetica,sans-serif; font-size:
10pt;">www.iar.com<br>
</span></a> Twitter: <a moz-do-not-send="true"
href="http://www.twitter.com/iarsystems"> <span
style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">www.twitter.com/iarsystems</span></a>
</span> </p>
</div>
</blockquote>
<br>
</body>
</html>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: XML Schema and upper/lower bounds [message #900323 is a reply to message #900313] |
Mon, 06 August 2012 13:36 |
Jesper Eskilson Messages: 134 Registered: July 2009 |
Senior Member |
|
|
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 08/06/2012 03:01 PM, Ed Merks wrote:
<blockquote cite="mid:jvof7s$sj0$1@xxxxxxxxe.org" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
Jesper,<br>
<br>
XML Schema has <any> but its use is quite limited and EMF
treats it like a <sequence>. EMF's deserializer doesn't
check that element are actually in the correct order anyway, and
will write them out in the model's feature order (except where
feature maps are used).<br>
</blockquote>
<br>
Does this mean that even if I specify <sequence>, EMF will not
complain when parsing an XML file where the child element order does
not match? There is a lot of XML code out in the wild, and I want to
avoid getting validation and/or parse errors on them.<br>
<br>
<div class="moz-signature">-- <br>
<p>
<span style="color: #a6a6a6; font-family:
arial,helvetica,sans-serif; font-size: 10pt;"><strong>Jesper
Eskilson</strong></span>
<span style="color: #fdb913; font-family:
arial,helvetica,sans-serif; font-size: 10pt;"><em>Development
Engineer</em></span><br>
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">IAR Systems AB<br>
Box 23051, Strandbodgatan 1<br>
SE-750 23 Uppsala, SWEDEN<br>
Phone: +46 18 16 78 00<br>
E-mail: <a href="mailto:jesper.eskilson@xxxxxxxx">
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">jesper.eskilson@xxxxxxxx</span></a>
Website: <a href="http://www.iar.com">
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">www.iar.com<br>
</span></a>
Twitter: <a href="http://www.twitter.com/iarsystems">
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">www.twitter.com/iarsystems</span></a>
</span>
</p>
</div>
</body>
</html>
|
|
|
Re: XML Schema and upper/lower bounds [message #900339 is a reply to message #900323] |
Mon, 06 August 2012 14:41 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Jesper,<br>
<br>
Yes, it will not complain.<br>
<br>
<div class="moz-cite-prefix">On 06/08/2012 3:36 PM, Jesper Eskilson
wrote:<br>
</div>
<blockquote cite="mid:jvoh86$oa$1@xxxxxxxxe.org" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
On 08/06/2012 03:01 PM, Ed Merks wrote:
<blockquote cite="mid:jvof7s$sj0$1@xxxxxxxxe.org" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
Jesper,<br>
<br>
XML Schema has <any> but its use is quite limited and EMF
treats it like a <sequence>. EMF's deserializer doesn't
check that element are actually in the correct order anyway, and
will write them out in the model's feature order (except where
feature maps are used).<br>
</blockquote>
<br>
Does this mean that even if I specify <sequence>, EMF will
not complain when parsing an XML file where the child element
order does not match? There is a lot of XML code out in the wild,
and I want to avoid getting validation and/or parse errors on
them.<br>
<br>
<div class="moz-signature">-- <br>
<p> <span style="color: #a6a6a6; font-family:
arial,helvetica,sans-serif; font-size: 10pt;"><strong>Jesper
Eskilson</strong></span> <span style="color: #fdb913;
font-family: arial,helvetica,sans-serif; font-size: 10pt;"><em>Development
Engineer</em></span><br>
<span style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">IAR Systems AB<br>
Box 23051, Strandbodgatan 1<br>
SE-750 23 Uppsala, SWEDEN<br>
Phone: +46 18 16 78 00<br>
E-mail: <a moz-do-not-send="true"
href="mailto:jesper.eskilson@xxxxxxxx"> <span
style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">jesper.eskilson@xxxxxxxx</span></a>
Website: <a moz-do-not-send="true"
href="http://www.iar.com"> <span style="color: #808080;
font-family: arial,helvetica,sans-serif; font-size:
10pt;">www.iar.com<br>
</span></a> Twitter: <a moz-do-not-send="true"
href="http://www.twitter.com/iarsystems"> <span
style="color: #808080; font-family:
arial,helvetica,sans-serif; font-size: 10pt;">www.twitter.com/iarsystems</span></a>
</span> </p>
</div>
</blockquote>
<br>
</body>
</html>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Thu Apr 25 09:57:25 GMT 2024
Powered by FUDForum. Page generated in 0.03404 seconds
|