I am trying to figure out if I am declaring my DTD elements correctly in an xml document. From everything I can tell, neither xsltproc or xmllint detect the validity errors in the following document:
<!DOCTYPE basic-dtd [
<!ENTITY title "The Book of Love">
<!ENTITY author "Jeffrey Halcomb">
<!ELEMENT basic-dtd (title,author,subject,checked-out)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT checked-out EMPTY>
]>
<basic-dtd>
<author>&author;</author>
<title>&title;</title>
<subject>A treatise on love as a driving elemental force in nature</subject>
<checked-out>Yes</checked-out>
</basic-dtd>
In my doctype instruction, I (believe) I have specified:
- the correct order of elements in the basic-dtd element is title, author, subject, and checked-out.
- the element 'checked-out' should not contain any data (PCDATA,CDATA, or child elements)
And yet, when I run the following stylesheet against this xml (xsltproc basic-dtd.xsl basic-dtd.xml) , it reports no errors/warnings.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output omit-xml-declaration="no" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/basic-dtd">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
Likewise, when I run xmllint (xmllint --noent basic-dtd.xml) - it reports no errors.
xsltproc and xmllint (with --noent) do process the entities, and will error out if an unknown entity is used.
Am I using an apple-processor to transform/print orange-xml (wrong tool for the job), or is this a known feature?
Thanks,
Tom
--valid
command line arg with xmllint?