A schema for interlacing elements from different schemas
Posted: Tue Feb 24, 2009 10:53 pm
Hi All,
Suppose we have a schema root-a-b.xsd that validates documents like:
Now I'd like to define a schema interlace.xsd that should validate documents such as the following:
Basically, I'd like interlace.xsd to validate documents that:
Any pointers?
Thanks!
Suppose we have a schema root-a-b.xsd that validates documents like:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="root-a-b.xsd">
<a>
<b/>
</a>
<a>
<b/>
<b/>
</a>
</root>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<in:interlace xmlns:in="myURI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="myURI interlace.xsd">
<root>
<!-- Loops on both levels -->
<in:loop>
<a>
<in:loop>
<b/>
</in:loop>
</a>
</in:loop>
<!-- Internal loop only -->
<a>
<in:loop>
<b/>
</in:loop>
</a>
<!-- External loop only -->
<in:loop>
<a>
<b/>
</a>
</in:loop>
</root>
</in:interlace>
- Have in:interlace as their document node
- Do not have any empty in:loop element
- Are valid root-a-b.xsd documents once all in: elements are skipped
Any pointers?
Thanks!