Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » enumeration-facet of union types
enumeration-facet of union types [message #592576] Tue, 23 November 2004 12:29
Klaas Dellschaft is currently offline Klaas DellschaftFriend
Messages: 58
Registered: July 2009
Member
Hi,

I have a question about enumeration facets of union types. I have the
following schema:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">

<xs:element name="test" type="st.unionType"/>


<xs:simpleType name="st.unionType">
<xs:restriction>
<xs:simpleType>
<xs:union memberTypes="xs:string xs:integer"/>
</xs:simpleType>
<xs:enumeration value="11"/>
</xs:restriction>
</xs:simpleType>

</xs:schema>


I had a look into the implementation of the type system in XSD. I've seen
that xs:string is represented by the Java String-type and xs:integer is
represented by BigDecimal.

So the value space of the anonymous sub union-type would contain String and
BigDecimal values. If I restrict this type with the enumeration facet I'm
not sure whether the value space of "st.unionType" would contain
String("11") and BigDecimal("11") or only String("11").

In the datatypes part of the W3C it is said that a lexical value is
validated against the memberTypes until a match is found but the evaluation
order can be overridden with the use of xsi:type.

So from my point of view it should be possible to validate the following
file against the schema from above:

<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xsi:noNamespaceSchemaLocation="test.xsd" xsi:type="xs:integer">
11
</test>

And Xerces-C also successfully validates this file. So I think the value
space of "st.unionType" should contain BigDecimal("11") and String("11).

But at the moment if I call the function XSDEnumerationFacet.getValue() on
the enumeration facet of "st.unionType" I only get one Object, the
String("11") and not also BigDecimal("11"). I would interpret this result
that XSD only puts String("11") into the value space of "st.unionType" and
not also BigDecimal("11"). Is this correct (my interpretation and/or the
behaviour of XSD)?

Regards
Klaas Dellschaft
Previous Topic:Analysing Complex Types derived by extension
Next Topic:Using XSD API with DOM
Goto Forum:
  


Current Time: Fri Apr 26 13:00:56 GMT 2024

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

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

Back to the top