[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: RE : Text or tags choice with XSD


xml xs time
Hi Dare,

> I disagree that the distinction isn't significant. For instance in
> XQuery this means
>
>       fn:data(/time); 
>
> could return xdt:anyAtomicType

The data() function returns the typed value of the element. I can't
see how you get to a xdt:anyAtomicType from any of the type
definitions for the <time> element that we've been throwing around...

Based on the Data Model WD, if you have:

  <time xsi:type="complexTime"><hour>14</hour><min>59</min></time>

where complexTime is a complex type with complex content, then the
typed value of the <time> element is undefined, and doing data(/time)
will give you a type error.

If you have:

  <time xsi:type="simpleTime">14:59:00</time>

where simpleTime is a complex type with simple content (of type
xs:time), then the typed value of the <time> element is "derived from
its string value and type in a way that is consistent with XML Schema
validation". I've always interpreted this as meaning that the typed
value of such a <time> element would be xs:time('14:59:00'), since I
don't see anything else that would be consistent with XML Schema
validation.

If you have:

  <time xsi:type="mixedTime">14:59:00</time>

where mixedTime is a complex type with mixed content (as in your
definition), then the typed value of the <time> element is
xdt:untypedAtomic('14:59:00').

> , thus 
>
>      fn:get-hours-from-time(/time)
>
> cannot be checked statically but instead must resort to dynamic
> failures. This is just one of many places where W3C XML Schema's
> inconsistent rules cause problems for type checking in XQuery.

I'm afraid that I'm not that hot on the whole static type checking
thing. Aren't things difficult in terms of static analysis anyway,
since one of the possible types of the <time> element is such that you
get a type error if you try to do data(/time)? If you get round that
problem, isn't it better (in terms of avoiding dynamic failures) for
data(/time) to return an atomic value of type xs:time rather than an
atomic value of type xdt:untypedAtomic, and isn't it therefore better
to have a complex type with simple content rather than a complex type
with mixed content?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.