W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2004

Serialization (sometimes) needs to include type information

From: Antoine Mensch <antoine.mensch@xquarkgroup.com>
Date: Wed, 11 Feb 2004 09:23:14 +0100
To: <public-qt-comments@w3.org>
Message-ID: <KBELJHFJHGPOHFENKHJCMEIFCCAA.antoine.mensch@xquarkgroup.com>

Consider the following schema fragment:

<xs:element name="A">
	<xs:complexType>
		<xs:sequence>
			<xs:element name="C" type="myns:Type1"/>
		</xs:sequence>
	</xs:complexType>
</xs:element>

<xs:element name="B">
	<xs:complexType>
		<xs:sequence>
			<xs:element name="C" type="myns:Type2"/>
		</xs:sequence>
	</xs:complexType>
</xs:element>

Now if we consider a document (or any other data source) containing both A
and B elements, the following query

<result>
{ 	for $x in doc("myDocument")//C
	return $x
}
</result>

returns a result that cannot be strongly typed without losing type
information by any valid schema, as the schema spec forbids elements with
the same name and a different type in the same content model.

It seems to me that the only way of retaining type information would be to
annotate produced C elements with xsi:type. This could be a serialization
parameter, similar to the cdata-section-elements. However, this would raise
another issue, as anonymous type names would then be exposed, and would thus
require to be handled in a consistent way by different XQuery and XML Schema
processors.

This issue is important, especially for tools that perform distributed
XQuery processing, and that need to retain consistent type information when
moving XML data from one processing node to another.
Received on Wednesday, 11 February 2004 03:17:31 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:57 UTC