Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Using my own InputStream to read XML data

Thread view: 
André Wagner - 29 May 2007 19:44 GMT
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é
Tom Hawtin - 29 May 2007 19:56 GMT
> 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
André Wagner - 29 May 2007 20:22 GMT
> DocumentBuilder.setEntityResolver should do the job.

It really worked! Thank you very much.

André


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.