views:

33

answers:

1

Given an XSD as follows:

<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"  xmlns:std="http://..." targetNamespace="...">
  <xs:element name="SomeRootNode" type="std:SomeRootNodeType" />
  ...
</xs:schema>

that defines some elements which allow any child from a different namespace.

I want to extend this schema with my own and insert child elements and attributes of specific elements in the base document. For example, myElementX or myAttributeY must have parent node std:SomeRootNode. The combined document should then be capable of allowing any third parties to continue to extend the document in any way already allowed by the base schema, but for elements and attributes from my namespace I want to validate that all elements and attributes have the correct parent nodes and appear only in the allowed places in the base document.

How can this be achieved?

I hope there is a clean solution that does not resort to redefining the base schema I am extending. I want to be able to easily adapt if new versions of the base schema are released. I do not want to have to change mine with new redefinitions each time a new version of the base document is released (unless it has breaking changes for my design).

A: 
Sprotty