RE: Serialization (sometimes) needs to include type information

> Therefore, in order to retain the original type information 
> (which could well be something as simple as knowing whether 
> the C element content is a date or a string, when ns1:Type1 
> and ns1:Type2 are respectively xs:date and xs:string), I need 
> to annotate each occurrence of C in the output with the 
> original type information.

The current rule is that if you want xsi:type attributes, you generate
them yourself. Is that too difficult in your situation?

Asking the serializer to do this could get very complicated. For
example, as well as generating the xsi:type attribute it would have to
generate namespace declarations for it; there would need to be rules
about what happens if there is already an xsi:type attribute; there
would need to be some kind of rules about which elements require an
xsi:type attribute (no-one, surely, would want one on *every* element);
and there would need to be rules to handle the common case where the
most specific type is anonymous.

Also, xsi:type is only half a solution. It solves the problem for
elements but not for attributes. I'm not keen to make a lot of effort to
solve half the problem.

Michael Kay (speaking personally)

Received on Wednesday, 11 February 2004 08:00:54 UTC