Joining 2 xsd's in to one
I want to merge to xsd's, so validation can be done if there present one bundle or another. Not when some element is optional, but when one bundle or another. Both have same root element. For example like this
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"targetNamespace="http://www.example.org/test" xmlns:tns="http://www.example.org/test" elementFormDefault="qualified">
<element name="example"&开发者_开发百科gt;
<complexType>
<sequence>
<element name="field1" type="string" />
<element name="field2" type="string" />
<element name="field3" type="string" />
<element name="field4" type="string" />
</sequence>
</complexType>
</element>
And also it can be like this
<element name="example">
<complexType>
<sequence>
<element name="field2" type="string" />
<element name="field1" type="string" />
<element name="field5" type="string" />
<element name="field4" type="string" />
<element name="field3" type="string" />
</sequence>
</complexType>
</element>
Thanks if anyone can help.
One of those schemas imposes the sequence 1,2,3,4 and the other imposes the sequence 2,1,3,4,3. Are you saying the merged schema should allow either of these two sequences? In this particular case you could just define a choice between the two sequences. But in the general case the choice would be ambiguous, so the combined schema would not be valid. Solving that problem involves some seriously hard computer science.
精彩评论