XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] XSD Schema type derived by restriction problem

> 
> I'm working with a schema that defines a type by restricting 
> the simple dateTime type. Our mapping rules (based on the 
> JAX-RPC spec) map this to the class of the parent type (in 
> this case, java.util.Calendar) rather than creating a new 
> class to represent the derived type. Consequently, when we 
> generate an XML message we specify that this element is of 
> xsi:type="xs:dateTime" (that is, the parent type).
> 
> However, when we do that, the schema validator flags the XML 
> as invalid: it cites an invalid QName at the 
> xsi:type="xs:dateTime" attribute.
> 
> It makes sense to me that if the derived type is valid, the 
> parent type should also be valid: after all, any instance of 
> the derived type will also be of the parent type by 
> polymorphism. Is that the case in the XML Schema spec? If so, 
> we should change our schema validator so that it accepts the 
> parent as well as the child in this situation. If not, I'm 
> not sure how we can implement JAX-RPC as specified.
> 

I don't know JAX-RPC: from this description it sounds as if it is using
xsi:type in a way that is not entirely consistent with the way it is defined
in the XSD specification. XSD says that you can use xsi:type to declare an
instance element to be of a more specific type than the schema would
allocate to it: but it must be a type that is substitutable for the type
declared in the schema. In your case, xs:dateTime is not substitutable for
your user-defined type.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS