OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: XML Schemas: Best Practices



Abstract type and type substitution does seem to work well as long as you only have one level of abstraction and only want to work on the top-level.  In this case, it has some of the advantages of the
aggregation pattern that would have expressed the instance as:

<Publication>
	<Magazine>Mag Specific Stuff</Magazine>
	Generic Publication Content
</Publication>

Both give you some artifact in the instance that you can identify and query an element as both a Publication and a Magazine with current technologies.

Unfortunately, the type substitution approach doesn't give you a clean way of expressing in the instance a deeper hierarchy in a way that existing processors like XSLT can make meaningful queries.
Also, since the xsi:type value is a QName, unless you are restricting your document to use a fixed prefix, it would be difficult to write an XPath that would give you only the  Magazine nodes.

I don't think the superclass as tag name, subclass as xsi:type pattern is generic enough to be a best practice.  The aggregation pattern offers the same advantages but is more capable.