Hi
I've got an xml-document (instance document) that contains configurationsettings for my system. Now - I would like to create an xsd-schema to validate this document before I use it in my system.
The strucure of the xmldoc is this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<securitySection>
<add key="customerLicenseFilePath" value="C:\myprojects\sys\TestLibraryCommon\testConfig\1.xml" />
<add key="cryptography" value="DES" />
</securitySection>
</configuration>
I would like to ensure that the keys are present with "key"-attributes having the values
(e.g. "customerLicenseFilePath" and "cryptography").
How do I specify using XSD that the keys should be present in the instance document based on this schema?
Thanks in advance.
Priya Lakshminarayanan [MSFT] - 23 May 2005 19:31 GMT
If all you want to ensure is that the key and value attributes should be
present, then you can mark them as required attributes in the schema:
Sample schema snippet:
<xs:element name="add">
<xs:complexType>
<xs:attribute name="key" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
Thanks,
Priya
Hi
I've got an xml-document (instance document) that contains
configurationsettings for my system. Now - I would like to create an
xsd-schema to validate this document before I use it in my system.
The strucure of the xmldoc is this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<securitySection>
<add key="customerLicenseFilePath"
value="C:\myprojects\sys\TestLibraryCommon\testConfig\1.xml" />
<add key="cryptography" value="DES" />
</securitySection>
</configuration>
I would like to ensure that the keys are present with "key"-attributes
having the values
(e.g. "customerLicenseFilePath" and "cryptography").
How do I specify using XSD that the keys should be present in the instance
document based on this schema?
Thanks in advance.