[XML-SIG] Problem using schema instead of DTD

Mike Brown mike at skew.org
Fri Jan 14 18:19:38 CET 2005

Tim van Erven wrote:
> And the output of my program looks like this, which won't validate:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE ltp> 
> <ltp xmlns="http://www.example.org/info"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.example.org/info someschema.xsd">
> <text>This is some modified sample text.</text>
> </ltp>
> Does anyone know how to get rid of the !DOCTYPE line? Is that the right
> thing to do anyway?
> I'm rather new to xml, so any conceptual corrections would be much
> appreciated as well.

What are you parsing your generated XML with, and what is the error you are 
getting? It could be happening for a couple of reasons. Whatever you are using 
to do the parsing and validation of that XML may be assuming (incorrectly) 
that if it sees a DOCTYPE, it has to do DTD-based validation. Whether or not 
validation is being done, and what kind of validation, is up to the user of 
the tool doing the parsing. (Note: Pointing to or directly providing schematic info is just one of several 
capabilities of a the document type declaration; it is also a source of entity 
and default attribute declarations, and is normally checked for those 
regardless of whether validation is being done.)

Another possibility is that the tool you are using does not recognize the 
minimal DOCTYPE declaration that is being added to your document. Such a 
declaration serves no real purpose, but is permitted to exist by the XML spec. 
It is an often-overlooked 'feature' of XML though; some parsers may reject it 
out of ignorance.


More information about the XML-SIG mailing list