Using my own InputStream to read XML data

  • Thread starter =?iso-8859-1?q?Andr=E9_Wagner?=
  • Start date
?

=?iso-8859-1?q?Andr=E9_Wagner?=

Hello,

I'm using my own personal InputStream (which I named CxInputStream) to
load XML data. This stream read data from a server using a specific
protocol. So this is what I do:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
CxInputStream input = new CxInputStream(path);
document = builder.parse(input);

It works perfectly, except when the XML has a DTD file. Then the
DocumentBuilder tries to load the DTD file from the local filesystem
(to which I don't have access, since I'm running this from a applet).

There's any way I can indicate the DocumentBuilder where to load to
DTD file from, the same way I did with the XML file?

Thanks in advance,

André
 
T

Tom Hawtin

André Wagner said:
There's any way I can indicate the DocumentBuilder where to load to
DTD file from, the same way I did with the XML file?

DocumentBuilder.setEntityResolver should do the job.

Tom Hawtin
 
?

=?iso-8859-1?q?Andr=E9_Wagner?=

DocumentBuilder.setEntityResolver should do the job.

It really worked! Thank you very much.

André
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,260
Messages
2,571,038
Members
48,768
Latest member
first4landlord

Latest Threads

Top