OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] XQuery/XPath 2.0 Data Model - values of union types

[ Lists Home | Date Index | Thread Index ]

Hi Jeni,

> > A union type may ambiguously match more than one string. In section
> > 5, "The values of nodes whose type is derived by union from an XML
> > Schema primitive type are represented by a sequence of atomic values
> > each of whose type is one of the individual types from the union.
> > The union type information is lost and only the specific types of
> > each individual item is retained.
> >
> > 1. (Nit) Shouldn't this be "...derived by union from XML Schema
> > primitive types..."?
>
> It should probably be only "derived by union". There shouldn't be any
> requirement for a union type to be derived from a primitive type, or
> from a built-in type.

Makes sense, but...

> What the paragraph means is that if you
> have:
>
> <element name="ambig">
>   <simpleType>
>     <list>
>       <simpleType>
>         <union memberTypes="xs:integer xs:string"/>
>       </simpleType>
>     </list>
>   </simpleType>
> </element>
>
> and an instance:
>
> <ambig>5 foo 7.3</ambig>
>
> then the value of the <ambig> element node is (5, "foo", "7.3").

I understand that is how list types are handled, but the introductory
sentence enumerates three cases: 1) primitive, 2) derived by restriction,
list or 3) union. I have added the numbers because this list of four cases
is followed by only three paragraphs, and the second paragraph specifically
says it is applicable to both the restriction and list cases. Therefore, the
third paragraph must describe union. Why is what it says restricted to a
list of union types? At best, this is pretty muddled.

But thanks for telling me what it is intended to mean!

> > 4. Whether the answer is (5) or (5, "5") I would guess the dm:type
> > accessor would return xs:integer and this would be the value of type
> > in the data model, as this is the value consistent with validation?
>
> No; dm:type() gives the QName of the type of the *node*, not the type
> of the *value* of the node. So in both the above cases, since the
> simple type of the <ambig> element is an anonymous type, it would
> return an implementation-dependent unique QName. If the schema looked
> like:
>
> <element name="ambig" type="my:integer-or-string">
>
> <simpleType name="integer-or-string">
>   <union memberTypes="xs:integer xs:string"/>
> </simpleType>
>
> then dm:type() would give the QName my:integer-or-string.

Ok, that's consistent. So one could interrogate the type of the value from
the value, and that would be the member type that first matched.

Thanks again.

Bob

> Cheers,
>
> Jeni





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS