I found the following in an XML file provided for processing:
<!DOCTYPE exchange_rates SYSTEM "">
The empty string doesn't make any sense to me and I can not find any such discussion about it online. If I use online validators, they all don't produce even a warning for that, nor if I put any garbage between the quotes for that matter, so they don't help me in finding out if this declaration is invalid or not. If it is valid, how is this XML file supposed to be validated?
That DOCTYPE declaration is indeed valid. To know this for sure you can look in the spec...
In the Prolog section you will find the model for the DOCTYPE declaration (doctypedecl):
If you then look at ExternalID:
you'll see that SYSTEM
is followed by SystemLiteral:
which shows that the quotes can be empty.
If it is valid, how is this XML file supposed to be validated?
Since the DOCTYPE has an empty SYSTEM identifier and there's no PUBLIC identifier that would allow you to map to a SYSTEM identifier, there's no way to programmatically know what DTD to validate against.
The only way to validate this XML against a DTD is for you to know what DTD it should validate against in advance and whatever you're using to validate allows you to specify the DTD separate from the DOCTYPE declaration. (For example, by using the --dtdvalid
arg with xmllint.)