change the code like the following

spf.setValidating(true);

Ganesh


-----Original Message-----
From: Torsten Curdt [mailto:[EMAIL PROTECTED]
Sent: Friday, October 08, 2004 4:30 PM
To: [EMAIL PROTECTED]
Subject: validating parser an documents without a dtd


I have a validating parser but no DTD
or DTD reference inside the document.
But I want to require validation! So..

1) how do I tell the parser to fail if
there is no DTD

2) how do I specify a *specific* DTD/Schema
the InputSource has to comply to?

Currently I use the following code...

         SAXParserFactory spf = SAXParserFactory.newInstance();
         spf.setNamespaceAware(true);
         spf.setValidating(validating);
         SAXParser saxParser = spf.newSAXParser();
         XMLReader xmlReader = saxParser.getXMLReader();
         xmlReader.setContentHandler(handler);
         xmlReader.setErrorHandler(handler);
         xmlReader.setDTDHandler(handler);
         xmlReader.setEntityResolver(myresolver);
         xmlReader.parse(new InputSource(is));

cheers
--
Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to