A
Adam dR.
I would like to create an XSD that will verify the xml below has one
<config> element with the name attribute equal to 'DBC' all other
<config> elements are optional and their values don't matter. I
cannot restrict other <config> elements from being there. Is this
possible with XSD? If so could someone help me with an example?
<-- This should be VALID be cause it has one and only one config
element with name 'DBC' --/>
<project>
<config name='DBC' output='myprogram.exe'>
<file>myfile.dbr</file>
</config>
<config name='Make' output='myprog.exe'>
<file>myfile2.dbr</file>
</config>
</project>
<-- This should be VALID be cause it has one and only one config
element with name 'DBC' --/>
<project>
<config name='DBC' output='myprogram.exe'>
<file>myfile.dbr</file>
</config>
</project>
<-- This should be INVALID be cause it does not have a config element
with name 'DBC' --/>
<project>
<config name='comp.bat' output='myprogram.exe'>
<file>myfile.dbr</file>
</config>
<config name='Make' output='myprog.exe'>
<file>myfile2.dbr</file>
</config>
</project>
<config> element with the name attribute equal to 'DBC' all other
<config> elements are optional and their values don't matter. I
cannot restrict other <config> elements from being there. Is this
possible with XSD? If so could someone help me with an example?
<-- This should be VALID be cause it has one and only one config
element with name 'DBC' --/>
<project>
<config name='DBC' output='myprogram.exe'>
<file>myfile.dbr</file>
</config>
<config name='Make' output='myprog.exe'>
<file>myfile2.dbr</file>
</config>
</project>
<-- This should be VALID be cause it has one and only one config
element with name 'DBC' --/>
<project>
<config name='DBC' output='myprogram.exe'>
<file>myfile.dbr</file>
</config>
</project>
<-- This should be INVALID be cause it does not have a config element
with name 'DBC' --/>
<project>
<config name='comp.bat' output='myprogram.exe'>
<file>myfile.dbr</file>
</config>
<config name='Make' output='myprog.exe'>
<file>myfile2.dbr</file>
</config>
</project>