I have code that uses the SAX parser provided with J2SE 1.4 and 1.5. We
have a
DTD we wish to validate against. When I run this code against JRE
1.4.2_07, everything works as expected. When I try to run it against
JRE 1.5.0_02, parser does not appear to be doing any validation against
our DTD. If I make the XML badly formed, we get an error in 1.4 but not
1.5. I know there are significant changes from 1.4 to 1.5. Is there
something special we need to do to enable validation? Here is the code
we use to create and configure the parser:
SAXParser parser;
XMLReader reader;
try
{
Properties props = System.getProperties();
props.list(System.out);
if (null == mFactory)
{
mFactory = SAXParserFactory.newInstance();
mFactory.setValidating(true);
}
parser = mFactory.newSAXParser();
reader = parser.getXMLReader();
}
catch (SAXException e)
{
// ...
}
catch (ParserConfigurationException e)
{
// ...
}
Thanks for any assistance you can give me on this.
-rich
|