Hi
everyone,
I'm new to xerces
and I'm trying to validate an Html file using w3c's dtds strict.dtd and
loose.dtd.
My very simple java
code is the following:
SAXParser parser = new SAXParser();
try {
parser.setFeature( "http://xml.org/sax/features/validation", true);
parser.parse("new.xml");
} catch (Exception e) {
System.out.println("error in setting up parser feature");
}
try {
parser.setFeature( "http://xml.org/sax/features/validation", true);
parser.parse("new.xml");
} catch (Exception e) {
System.out.println("error in setting up parser feature");
}
And the Xml file
is:
<?xml
version="1.0"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
Running my example
an error occurs:
org.xml.sax.SAXParseException: The declaration for the entity
"ContentType" must end with '>'.
How can I solve this
problem?
Best regards,
Dariush.
