← Prev in month
← Prev in thread
I am going crazy!!
Hi All,
I have written a Java application which simply parses the given XML file.
But now I want to turn the validation ON, so that it will validate the XML
document against the specified DTD within the DOCTYPE declaration. Here is
my code:
DOMParser parser = new DOMParser();
try
{
parser.setFeature("http://xml.org/sax/features/validation", true);
if(debugSwitch)
{
String[] temp = parser.getFeaturesRecognized();
for(int i=0; i<temp.length; i++)
System.out.println(temp[i]);
}
parser.parse(xmlFile);
doc = parser.getDocument();
But even when I define an element which is not specified in the DTD it is
parsing the XML file without any errors. I am going crazy. Please help me
out.
← Prev in month
← Prev in thread