RE: [xml-dev] 'is-a' Relationships in XML?

From
[email protected] <>
To
'xml-dev' <>, Michael Kay <>
Date
2010-05-03T19:13:37Z
ID
<>
Thread
RE: [xml-dev] 'is-a' Relationships in XML?
Thanks for these answers.

Can we then say that XSD is the primary way we add semantics to XML? I'm taking it that the classic relationships 'has-a' and 'is-a' are key semantics we typically add along with the choices of the element and attribute names so that our XML makes sense.

-----Original Message-----
From: Michael Kay
Sent:  03/05/2010 8:01:45 pm
To: ; 'xml-dev'
Subject:  RE: [xml-dev] 'is-a' Relationships in XML?

> 
> There seems to be no shortage of ways, thankfully, to express 
> 'has-a' relationships with XML (even without using a schema, 
> it seems there is an implicit 'has' relationship between 
> parent element and a child element or atttibute). There could 
> be said to be an implicit semantic 'has' relationship 
> declared between 'document' an 'date' when we write 
> <document><date>...</date>...</document>. Is there any way to 
> express the other key relationship of 'is-a' in XML? Is this 
> something a schema language can express? Can we say that 
> element (or even type) A 'is-an' element (or type) B? Any 
> plans to add this 'feature' to the XML technologies if it 
> isn't one already? It might be a key gap to fill. I might 
> want to somehow imply that my <invoice/> is a <document/>. 
> Are substitution groups (with, apparently, some inadequacies) 
> the only way to express such a relationship in XML?
> 

is-a can be a relationship between types, or a relationship between an
instance and a type.

As a relationship between types (every invoice is a document), it can be
represented in XSD using the concepts of derivation by restriction or by
extension; substitution groups also play into this.

As a relationship between an instance and a type, it is represented in the
PSVI by instance properties including [element declaration] and [type
definition].

Regards,

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