You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by abhishekhp <ab...@infy.com> on 2002/03/20 07:24:00 UTC

Error while using SAX Parser (Xerces 1.4.4) with XML files built against DTDs.

Hi,
I am using xerces parser 1.4.4 (SaxParser) for parsing XML messages. 
The following method is being called (amongst others):

parser.parse(new InputSource(new StringReader(XMLMessage) ) );

where 
XMLMessage - string holding the XML message.
Everything goes well when the XML being parsed is built against an XML schema file. However a 'File example.dtd not found' exception occurs when the XML message is built against a DTD file (say example.dtd), regardless of whether validation is enabled or disabled.

However, when i use the following method instead, the above problem does not arise.

parser.parse(FileName)

where 
FileName - String holding the name of the file which contains the XML message
i.e. any kind of XML file, irrespective of whether it is built against a schema or a DTD file,is successfully parsed. 

Can anyone suggest a way to get the first method to work properly with XML messages built against DTDs? (The problem must be due to the "<!DOCTYPE personnel SYSTEM "personal.dtd">" present in the xml file built against a DTD.)

TIA,
abhishek.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org