Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Problems with generating list types
Problems with generating list types [message #60495] Tue, 03 May 2005 13:50 Go to next message
Klaas Dellschaft is currently offline Klaas DellschaftFriend
Messages: 58
Registered: July 2009
Member
Hi,

I want to create the following list type programatically:

<xs:simpleType name="myType">
<xs:restriction>
<xs:simpleType>
<xs:list itemType="xs:integer"/>
</xs:simpleType>
<xs:length value="4"/>
</xs:restriction>
</xs:simpleType>


I create the list type with the following code:

XSDSimpleTypeDefinition simpleType = XSDFactory.eINSTANCE
.createXSDSimpleTypeDefinition();
simpleType.setItemTypeDefinition(itemType);
xsdSchema.getContents().add(simpleType);


If I query simpleType.getValidFacets() I get length, maxLength, minLength,
whiteSpace, enumeration and pattern as valid facets of this type so I
presumed that I can add the length-facet directly to the new list type. But
when I serialize it to a file I get

<xs:simpleType>
<xs:list itemType="xs:integer">
<xs:length value="4"/>
</xs:list>
</xs:simpleType>


What have I done wrong? Or am I mislead by the list of valid facets and I
have to create an anonymous list type which is added as the base type of
"myType" and there it is possible to set the facets?

Cheers
Klaas
Re: Problems with generating list types [message #60519 is a reply to message #60495] Tue, 03 May 2005 14:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Klaas,

Your sample is a simpler version of initializeFancyListTypeDefinition
from XSDPrototypical schema. (Yes, you need to set the anonymous base
type by adding it to simpleType.getContents() in addition to setting it
as the base type.)


Klaas Dellschaft wrote:

>Hi,
>
>I want to create the following list type programatically:
>
><xs:simpleType name="myType">
> <xs:restriction>
> <xs:simpleType>
> <xs:list itemType="xs:integer"/>
> </xs:simpleType>
> <xs:length value="4"/>
> </xs:restriction>
></xs:simpleType>
>
>
>I create the list type with the following code:
>
>XSDSimpleTypeDefinition simpleType = XSDFactory.eINSTANCE
> .createXSDSimpleTypeDefinition();
>simpleType.setItemTypeDefinition(itemType);
>xsdSchema.getContents().add(simpleType);
>
>
>If I query simpleType.getValidFacets() I get length, maxLength, minLength,
>whiteSpace, enumeration and pattern as valid facets of this type so I
>presumed that I can add the length-facet directly to the new list type. But
>when I serialize it to a file I get
>
><xs:simpleType>
> <xs:list itemType="xs:integer">
> <xs:length value="4"/>
> </xs:list>
></xs:simpleType>
>
>
>What have I done wrong? Or am I mislead by the list of valid facets and I
>have to create an anonymous list type which is added as the base type of
>"myType" and there it is possible to set the facets?
>
>Cheers
>Klaas
>
>
>
>
Re: Problems with generating list types [message #60536 is a reply to message #60519] Wed, 04 May 2005 07:08 Go to previous messageGo to next message
Klaas Dellschaft is currently offline Klaas DellschaftFriend
Messages: 58
Registered: July 2009
Member
> Your sample is a simpler version of initializeFancyListTypeDefinition from
> XSDPrototypical schema. (Yes, you need to set the anonymous base type by
> adding it to simpleType.getContents() in addition to setting it as the
> base type.)

OK, I will do that. But why do I get a list of valid facets for the
simpleType if it isn't allowed to attach facets to it? This prevents me from
generically allowing editing the facets of types. Instead I have to ask
whether I edit a list-, union- or atomic-type and only then I know whether I
can trust the information given by getValidFacets().

This is also a problem in the Eclipse plugin: If you create a new list type
and the right click on it -> New Child. There you will see that it allows to
add facets directly to the type which will also result in a wrong serialized
type.

Klaas
Re: Problems with generating list types [message #60965 is a reply to message #60536] Thu, 05 May 2005 11:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------030802040009090005000101
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Klaas,

Asking the valid facets is really a question about what facets are
allowed in any derived class based on that type, it's not a question
about what syntactically I can do with the type definition itself. The
contents can really be one of three different things depending on the
nature of the simple type:

/**
* Returns the value of the '<em><b>Contents</b></em>' containment
reference list.
* The list contents are of type {@link
org.eclipse.xsd.XSDSimpleTypeDefinition}.
* <!-- begin-user-doc -->
* <p>
* This concrete reference list represents the anonymous simple
type definition content of a
* <a
href="http://www.w3.org/TR/xmlschema-2/#element-restriction">restriction</a>,
* <a
href="http://www.w3.org/TR/xmlschema-2/#element-list">list</a>, or
* <a
href="http://www.w3.org/TR/xmlschema-2/#element-union">union</a>
element.
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Contents</em>' containment
reference list.
* @see
org.eclipse.xsd.XSDPackage#getXSDSimpleTypeDefinition_Conten ts()
* @model type="org.eclipse.xsd.XSDSimpleTypeDefinition"
containment="true"
* @generated
*/
EList getContents();

I believe that a simple test to know if it's syntactically valid to add
facets to a given simple type is to test if the variety of the base type
is the same as the variety of the type itself.


Klaas Dellschaft wrote:

>>Your sample is a simpler version of initializeFancyListTypeDefinition from
>>XSDPrototypical schema. (Yes, you need to set the anonymous base type by
>>adding it to simpleType.getContents() in addition to setting it as the
>>base type.)
>>
>>
>
>OK, I will do that. But why do I get a list of valid facets for the
>simpleType if it isn't allowed to attach facets to it? This prevents me from
>generically allowing editing the facets of types. Instead I have to ask
>whether I edit a list-, union- or atomic-type and only then I know whether I
>can trust the information given by getValidFacets().
>
>This is also a problem in the Eclipse plugin: If you create a new list type
>and the right click on it -> New Child. There you will see that it allows to
>add facets directly to the type which will also result in a wrong serialized
>type.
>
>Klaas
>
>
>
>


--------------030802040009090005000101
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">
Klaas,<br>
<br>
Asking the valid facets is really a question about what facets are
allowed in any derived class based on that type, it's not a question
about what syntactically I can do with the type definition itself.&nbsp; The
contents can really be one of three different things depending on the
nature of the simple type:<br>
<blockquote><small>&nbsp; /**<br>
&nbsp;&nbsp; * Returns the value of the
'&lt;em&gt;&lt;b&gt;Contents&lt;/b&g t;&lt;/em&gt;' containment
reference list.<br>
&nbsp;&nbsp; * The list contents are of type {@link
org.eclipse.xsd.XSDSimpleTypeDefinition}.<br>
&nbsp;&nbsp; * &lt;!-- begin-user-doc --&gt;<br>
&nbsp;&nbsp; * &lt;p&gt;<br>
&nbsp;&nbsp; * This concrete reference list represents the anonymous simple type
definition content of a<br>
&nbsp;&nbsp; * &lt;a
href=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xmlschema-2/#element-restriction">"http://www.w3.org/TR/xmlschema-2/#element-restriction"</a>&gt;restriction&lt;/a&gt;,<br>
&nbsp;&nbsp; * &lt;a
href=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xmlschema-2/#element-list">"http://www.w3.org/TR/xmlschema-2/#element-list"</a>&gt;list&lt;/a&gt;,
or<br>
&nbsp;&nbsp; * &lt;a
href=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xmlschema-2/#element-union">"http://www.w3.org/TR/xmlschema-2/#element-union"</a>&gt;union&lt;/a&gt;
element.<br>
&nbsp;&nbsp; * &lt;/p&gt;<br>
&nbsp;&nbsp; * &lt;!-- end-user-doc --&gt;<br>
&nbsp;&nbsp; * @return the value of the '&lt;em&gt;Contents&lt;/em&gt;'
containment reference list.<br>
&nbsp;&nbsp; * @see
org.eclipse.xsd.XSDPackage#getXSDSimpleTypeDefinition_Conten ts() <br>
&nbsp;&nbsp; * @model type="org.eclipse.xsd.XSDSimpleTypeDefinition"
containment="true"<br>
&nbsp;&nbsp; * @generated<br>
&nbsp;&nbsp; */<br>
&nbsp; EList getContents();</small><br>
</blockquote>
I believe that a simple test to know if it's syntactically valid to add
facets to a given simple type is to test if the variety of the base
type is the same as the variety of the type itself. <br>
<br>
<br>
Klaas Dellschaft wrote:
<blockquote cite="midd59so6$909$1@news.eclipse.org" type="cite">
<blockquote type="cite">
<pre wrap="">Your sample is a simpler version of initializeFancyListTypeDefinition from
XSDPrototypical schema. (Yes, you need to set the anonymous base type by
adding it to simpleType.getContents() in addition to setting it as the
base type.)
</pre>
</blockquote>
<pre wrap=""><!---->
OK, I will do that. But why do I get a list of valid facets for the
simpleType if it isn't allowed to attach facets to it? This prevents me from
generically allowing editing the facets of types. Instead I have to ask
whether I edit a list-, union- or atomic-type and only then I know whether I
can trust the information given by getValidFacets().

This is also a problem in the Eclipse plugin: If you create a new list type
and the right click on it -&gt; New Child. There you will see that it allows to
add facets directly to the type which will also result in a wrong serialized
type.

Klaas


</pre>
</blockquote>
<br>
</body>
</html>

--------------030802040009090005000101--
Re: Problems with generating list types [message #61062 is a reply to message #60965] Mon, 09 May 2005 13:01 Go to previous messageGo to next message
Klaas Dellschaft is currently offline Klaas DellschaftFriend
Messages: 58
Registered: July 2009
Member
> I believe that a simple test to know if it's syntactically valid to add
> facets to a given simple type is to test if the variety of the base type
> is the same as the variety of the type itself.

I think a better test would be whether getBaseTypeDefinition() returns null
or not. Only if it returns a concrete reference the current type is a
restriction of another type. The base type might be an atomic, list or union
type.

Should the XSD plugin be comfortable enough that it is impossible to create
invalid schemas or does the user have to know what he's doing? If it should
be impossible to create invalid schema instances then you have to add the
test into the plugin, too.

Cheers
Klaas
Re: Problems with generating list types [message #61085 is a reply to message #61062] Mon, 09 May 2005 13:32 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------010009010700000307060604
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Klaas,

There's always a base type definition, even if it is just
anyType/anySimpleType.

Some of these scenarios are tricky to enforce because setting one thing
may invalidate something you've already set. For example, I could add a
simple type definition to the contents of a simple type definition and
then set it as the base type, item type, or member type after, so you
kind of need to know what you are doing. (The editor should do a better
job, but we don't have the resource to make the editor really nice.)
Validation should diagnose any errors in how things are set up.


Klaas Dellschaft wrote:

>>I believe that a simple test to know if it's syntactically valid to add
>>facets to a given simple type is to test if the variety of the base type
>>is the same as the variety of the type itself.
>>
>>
>
>I think a better test would be whether getBaseTypeDefinition() returns null
>or not. Only if it returns a concrete reference the current type is a
>restriction of another type. The base type might be an atomic, list or union
>type.
>
>Should the XSD plugin be comfortable enough that it is impossible to create
>invalid schemas or does the user have to know what he's doing? If it should
>be impossible to create invalid schema instances then you have to add the
>test into the plugin, too.
>
>Cheers
>Klaas
>
>
>
>


--------------010009010700000307060604
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">
</head>
<body bgcolor="#ffffff" text="#000000">
Klaas,<br>
<br>
There's always a base type definition, even if it is just
anyType/anySimpleType.<br>
<br>
Some of these scenarios are tricky to enforce because setting one thing
may invalidate something you've already set.&nbsp; For example, I could add
a simple type definition to the contents of a simple type definition
and then set it as the base type, item type, or member type after, so
you kind of need to know what you are doing.&nbsp; (The editor should do a
better job, but we don't have the resource to make the editor really
nice.)&nbsp; Validation should diagnose any errors in how things are set up.<br>
<br>
<br>
Klaas Dellschaft wrote:
<blockquote cite="midd5nndk$u4b$1@news.eclipse.org" type="cite">
<blockquote type="cite">
<pre wrap="">I believe that a simple test to know if it's syntactically valid to add
facets to a given simple type is to test if the variety of the base type
is the same as the variety of the type itself.
</pre>
</blockquote>
<pre wrap=""><!---->
I think a better test would be whether getBaseTypeDefinition() returns null
or not. Only if it returns a concrete reference the current type is a
restriction of another type. The base type might be an atomic, list or union
type.

Should the XSD plugin be comfortable enough that it is impossible to create
invalid schemas or does the user have to know what he's doing? If it should
be impossible to create invalid schema instances then you have to add the
test into the plugin, too.

Cheers
Klaas


</pre>
</blockquote>
<br>
</body>
</html>

--------------010009010700000307060604--
Re: Problems with generating list types [message #595355 is a reply to message #60495] Tue, 03 May 2005 14:30 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Klaas,

Your sample is a simpler version of initializeFancyListTypeDefinition
from XSDPrototypical schema. (Yes, you need to set the anonymous base
type by adding it to simpleType.getContents() in addition to setting it
as the base type.)


Klaas Dellschaft wrote:

>Hi,
>
>I want to create the following list type programatically:
>
><xs:simpleType name="myType">
> <xs:restriction>
> <xs:simpleType>
> <xs:list itemType="xs:integer"/>
> </xs:simpleType>
> <xs:length value="4"/>
> </xs:restriction>
></xs:simpleType>
>
>
>I create the list type with the following code:
>
>XSDSimpleTypeDefinition simpleType = XSDFactory.eINSTANCE
> .createXSDSimpleTypeDefinition();
>simpleType.setItemTypeDefinition(itemType);
>xsdSchema.getContents().add(simpleType);
>
>
>If I query simpleType.getValidFacets() I get length, maxLength, minLength,
>whiteSpace, enumeration and pattern as valid facets of this type so I
>presumed that I can add the length-facet directly to the new list type. But
>when I serialize it to a file I get
>
><xs:simpleType>
> <xs:list itemType="xs:integer">
> <xs:length value="4"/>
> </xs:list>
></xs:simpleType>
>
>
>What have I done wrong? Or am I mislead by the list of valid facets and I
>have to create an anonymous list type which is added as the base type of
>"myType" and there it is possible to set the facets?
>
>Cheers
>Klaas
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Problems with generating list types [message #595366 is a reply to message #60519] Wed, 04 May 2005 07:08 Go to previous message
Klaas Dellschaft is currently offline Klaas DellschaftFriend
Messages: 58
Registered: July 2009
Member
> Your sample is a simpler version of initializeFancyListTypeDefinition from
> XSDPrototypical schema. (Yes, you need to set the anonymous base type by
> adding it to simpleType.getContents() in addition to setting it as the
> base type.)

OK, I will do that. But why do I get a list of valid facets for the
simpleType if it isn't allowed to attach facets to it? This prevents me from
generically allowing editing the facets of types. Instead I have to ask
whether I edit a list-, union- or atomic-type and only then I know whether I
can trust the information given by getValidFacets().

This is also a problem in the Eclipse plugin: If you create a new list type
and the right click on it -> New Child. There you will see that it allows to
add facets directly to the type which will also result in a wrong serialized
type.

Klaas
Re: Problems with generating list types [message #595410 is a reply to message #60536] Thu, 05 May 2005 11:15 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030802040009090005000101
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Klaas,

Asking the valid facets is really a question about what facets are
allowed in any derived class based on that type, it's not a question
about what syntactically I can do with the type definition itself. The
contents can really be one of three different things depending on the
nature of the simple type:

/**
* Returns the value of the '<em><b>Contents</b></em>' containment
reference list.
* The list contents are of type {@link
org.eclipse.xsd.XSDSimpleTypeDefinition}.
* <!-- begin-user-doc -->
* <p>
* This concrete reference list represents the anonymous simple
type definition content of a
* <a
href="http://www.w3.org/TR/xmlschema-2/#element-restriction">restriction</a>,
* <a
href="http://www.w3.org/TR/xmlschema-2/#element-list">list</a>, or
* <a
href="http://www.w3.org/TR/xmlschema-2/#element-union">union</a>
element.
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Contents</em>' containment
reference list.
* @see
org.eclipse.xsd.XSDPackage#getXSDSimpleTypeDefinition_Conten ts()
* @model type="org.eclipse.xsd.XSDSimpleTypeDefinition"
containment="true"
* @generated
*/
EList getContents();

I believe that a simple test to know if it's syntactically valid to add
facets to a given simple type is to test if the variety of the base type
is the same as the variety of the type itself.


Klaas Dellschaft wrote:

>>Your sample is a simpler version of initializeFancyListTypeDefinition from
>>XSDPrototypical schema. (Yes, you need to set the anonymous base type by
>>adding it to simpleType.getContents() in addition to setting it as the
>>base type.)
>>
>>
>
>OK, I will do that. But why do I get a list of valid facets for the
>simpleType if it isn't allowed to attach facets to it? This prevents me from
>generically allowing editing the facets of types. Instead I have to ask
>whether I edit a list-, union- or atomic-type and only then I know whether I
>can trust the information given by getValidFacets().
>
>This is also a problem in the Eclipse plugin: If you create a new list type
>and the right click on it -> New Child. There you will see that it allows to
>add facets directly to the type which will also result in a wrong serialized
>type.
>
>Klaas
>
>
>
>


--------------030802040009090005000101
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">
Klaas,<br>
<br>
Asking the valid facets is really a question about what facets are
allowed in any derived class based on that type, it's not a question
about what syntactically I can do with the type definition itself.&nbsp; The
contents can really be one of three different things depending on the
nature of the simple type:<br>
<blockquote><small>&nbsp; /**<br>
&nbsp;&nbsp; * Returns the value of the
'&lt;em&gt;&lt;b&gt;Contents&lt;/b&g t;&lt;/em&gt;' containment
reference list.<br>
&nbsp;&nbsp; * The list contents are of type {@link
org.eclipse.xsd.XSDSimpleTypeDefinition}.<br>
&nbsp;&nbsp; * &lt;!-- begin-user-doc --&gt;<br>
&nbsp;&nbsp; * &lt;p&gt;<br>
&nbsp;&nbsp; * This concrete reference list represents the anonymous simple type
definition content of a<br>
&nbsp;&nbsp; * &lt;a
href=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xmlschema-2/#element-restriction">"http://www.w3.org/TR/xmlschema-2/#element-restriction"</a>&gt;restriction&lt;/a&gt;,<br>
&nbsp;&nbsp; * &lt;a
href=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xmlschema-2/#element-list">"http://www.w3.org/TR/xmlschema-2/#element-list"</a>&gt;list&lt;/a&gt;,
or<br>
&nbsp;&nbsp; * &lt;a
href=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xmlschema-2/#element-union">"http://www.w3.org/TR/xmlschema-2/#element-union"</a>&gt;union&lt;/a&gt;
element.<br>
&nbsp;&nbsp; * &lt;/p&gt;<br>
&nbsp;&nbsp; * &lt;!-- end-user-doc --&gt;<br>
&nbsp;&nbsp; * @return the value of the '&lt;em&gt;Contents&lt;/em&gt;'
containment reference list.<br>
&nbsp;&nbsp; * @see
org.eclipse.xsd.XSDPackage#getXSDSimpleTypeDefinition_Conten ts() <br>
&nbsp;&nbsp; * @model type="org.eclipse.xsd.XSDSimpleTypeDefinition"
containment="true"<br>
&nbsp;&nbsp; * @generated<br>
&nbsp;&nbsp; */<br>
&nbsp; EList getContents();</small><br>
</blockquote>
I believe that a simple test to know if it's syntactically valid to add
facets to a given simple type is to test if the variety of the base
type is the same as the variety of the type itself. <br>
<br>
<br>
Klaas Dellschaft wrote:
<blockquote cite="midd59so6$909$1@news.eclipse.org" type="cite">
<blockquote type="cite">
<pre wrap="">Your sample is a simpler version of initializeFancyListTypeDefinition from
XSDPrototypical schema. (Yes, you need to set the anonymous base type by
adding it to simpleType.getContents() in addition to setting it as the
base type.)
</pre>
</blockquote>
<pre wrap=""><!---->
OK, I will do that. But why do I get a list of valid facets for the
simpleType if it isn't allowed to attach facets to it? This prevents me from
generically allowing editing the facets of types. Instead I have to ask
whether I edit a list-, union- or atomic-type and only then I know whether I
can trust the information given by getValidFacets().

This is also a problem in the Eclipse plugin: If you create a new list type
and the right click on it -&gt; New Child. There you will see that it allows to
add facets directly to the type which will also result in a wrong serialized
type.

Klaas


</pre>
</blockquote>
<br>
</body>
</html>

--------------030802040009090005000101--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Problems with generating list types [message #595449 is a reply to message #60965] Mon, 09 May 2005 13:01 Go to previous message
Klaas Dellschaft is currently offline Klaas DellschaftFriend
Messages: 58
Registered: July 2009
Member
> I believe that a simple test to know if it's syntactically valid to add
> facets to a given simple type is to test if the variety of the base type
> is the same as the variety of the type itself.

I think a better test would be whether getBaseTypeDefinition() returns null
or not. Only if it returns a concrete reference the current type is a
restriction of another type. The base type might be an atomic, list or union
type.

Should the XSD plugin be comfortable enough that it is impossible to create
invalid schemas or does the user have to know what he's doing? If it should
be impossible to create invalid schema instances then you have to add the
test into the plugin, too.

Cheers
Klaas
Re: Problems with generating list types [message #595453 is a reply to message #61062] Mon, 09 May 2005 13:32 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010009010700000307060604
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Klaas,

There's always a base type definition, even if it is just
anyType/anySimpleType.

Some of these scenarios are tricky to enforce because setting one thing
may invalidate something you've already set. For example, I could add a
simple type definition to the contents of a simple type definition and
then set it as the base type, item type, or member type after, so you
kind of need to know what you are doing. (The editor should do a better
job, but we don't have the resource to make the editor really nice.)
Validation should diagnose any errors in how things are set up.


Klaas Dellschaft wrote:

>>I believe that a simple test to know if it's syntactically valid to add
>>facets to a given simple type is to test if the variety of the base type
>>is the same as the variety of the type itself.
>>
>>
>
>I think a better test would be whether getBaseTypeDefinition() returns null
>or not. Only if it returns a concrete reference the current type is a
>restriction of another type. The base type might be an atomic, list or union
>type.
>
>Should the XSD plugin be comfortable enough that it is impossible to create
>invalid schemas or does the user have to know what he's doing? If it should
>be impossible to create invalid schema instances then you have to add the
>test into the plugin, too.
>
>Cheers
>Klaas
>
>
>
>


--------------010009010700000307060604
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">
</head>
<body bgcolor="#ffffff" text="#000000">
Klaas,<br>
<br>
There's always a base type definition, even if it is just
anyType/anySimpleType.<br>
<br>
Some of these scenarios are tricky to enforce because setting one thing
may invalidate something you've already set.&nbsp; For example, I could add
a simple type definition to the contents of a simple type definition
and then set it as the base type, item type, or member type after, so
you kind of need to know what you are doing.&nbsp; (The editor should do a
better job, but we don't have the resource to make the editor really
nice.)&nbsp; Validation should diagnose any errors in how things are set up.<br>
<br>
<br>
Klaas Dellschaft wrote:
<blockquote cite="midd5nndk$u4b$1@news.eclipse.org" type="cite">
<blockquote type="cite">
<pre wrap="">I believe that a simple test to know if it's syntactically valid to add
facets to a given simple type is to test if the variety of the base type
is the same as the variety of the type itself.
</pre>
</blockquote>
<pre wrap=""><!---->
I think a better test would be whether getBaseTypeDefinition() returns null
or not. Only if it returns a concrete reference the current type is a
restriction of another type. The base type might be an atomic, list or union
type.

Should the XSD plugin be comfortable enough that it is impossible to create
invalid schemas or does the user have to know what he's doing? If it should
be impossible to create invalid schema instances then you have to add the
test into the plugin, too.

Cheers
Klaas


</pre>
</blockquote>
<br>
</body>
</html>

--------------010009010700000307060604--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:2 suggestions for XSD
Next Topic:2 suggestions for XSD
Goto Forum:
  


Current Time: Thu Apr 25 01:05:50 GMT 2024

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

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

Back to the top