I would like to create a XML that follows the XML schema http://www.oid-info.com/oid.xsd . This XSD should be somehow referenced in the XML file, so that a tool like the https://validator.w3.org/ can check it to find errors in the semantics of the data, e.g. when an email address is invalid.
First, I tried it this way:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<oid-database xmlns="http://www.oid-info.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oid-info.com/oid.xsd">
<submitter>
....
</submitter>
<oid>
....
</oid>
</oid-database>
The W3C Markup Validation Service says:
No DOCTYPE found! Checking XML syntax only. The DOCTYPE Declaration was not recognized or is missing. This probably means that the Formal Public Identifier contains a spelling error, or that the Declaration is not using correct syntax, or that your XML document is not using a DOCTYPE Declaration. Validation of the document has been skipped, and a simple check of the well-formedness of the XML syntax has been performed instead.
Ok, so I tried to use DOCTYPE
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE oid-database>
<oid-database xmlns="http://www.oid-info.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oid-info.com/oid.xsd">
<submitter>
....
</submitter>
<oid>
....
</oid>
</oid-database>
Now the W3C Validator says:
Line 2, Column 23: no internal or external document type declaration subset; will parse without validation
I do know what a DTD is, and I have worked with DTDs in the past. I know that a DTD is missing here. But I want to check against a XSD, and not against a DTD.
What do I have to do to make it work?