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 / June 2006

Tip: Looking for answers? Try searching our database.

error in loading xml

Thread view: 
Nishant - 08 Jun 2006 07:57 GMT
Hi all,

I am trying to write a servlet that receives XML document as Http
response.
Now the problem is that the response xml document has doctype defined
as
<!DOCTYPE myDoc SYSTEM "myDTD.dtd">

and when i try to load the response inputStream in xml Document.
i get an parsing error saying myDTD.dtd could not be found

Can someone pls advice me
-where to keep these DTDs so that the tomcat will be able to find it.
-Is it OK to keep all the DTDs in the TOMCAT_ROOT/bin folder.

Looking for some quick help.

Regards,
Nishant
Dag Sunde - 08 Jun 2006 09:51 GMT
> Hi all,
>
[quoted text clipped - 6 lines]
> and when i try to load the response inputStream in xml Document.
> i get an parsing error saying myDTD.dtd could not be found

Written like that, "myDTD.dtd" is relative to the xml-document.
When the document is just in a stream, where to find it?

Replace "myDTD.dtd" with an absolute URL to the DTD should help.

Signature

Dag.

Nishant - 08 Jun 2006 10:28 GMT
Hi Dag,

Thanks for your response.
This xml document is returned by the server only. I can't change it.
Is there any other way I can solve this issue.

Regards,
Nishant

> > Hi all,
> >
[quoted text clipped - 11 lines]
>
> Replace "myDTD.dtd" with an absolute URL to the DTD should help.
asaguden - 08 Jun 2006 14:35 GMT
Yes,
Include the DTD in the output XML.
We have done this, merging the generated XML and DTD into
a new XML with XSL.

/ Peter
> > Hi all,
> >
[quoted text clipped - 11 lines]
>
> Replace "myDTD.dtd" with an absolute URL to the DTD should help.
William Brogden - 09 Jun 2006 16:06 GMT
> Hi all,
>
[quoted text clipped - 10 lines]
> -where to keep these DTDs so that the tomcat will be able to find it.
> -Is it OK to keep all the DTDs in the TOMCAT_ROOT/bin folder.

You can't rely on that directory being the "current" directory.

How about grabbing the entire document to a buffer and snipping
out the offending <!DOCTYPE ..> line?

Bill
Nishant - 16 Jun 2006 10:35 GMT
Hi Peter and Bill,

Thanks for ur response.
I solved the problem by moving the DTDs in a folder with web-access and
now I am passing the url as System Id while parsing the document.

doc =
docBuilderObj.parse(resp.getInputStream(),"http://myServer/myApp/DTD/");

Think this would be easy an approach bcos I wud need these DTDs
again while forming the XML data for Http POST.

let me know ur opinion on this.

Regards,
Nishant Purohit

> > Hi all,
> >
[quoted text clipped - 17 lines]
>
> Bill


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.