Using Servlets to Parse XML

B

bytes.bit

I would like to create a servlet, which when accessed, will retrieve an
XML file, remotely over the Internet, and parse it to the browser's
screen.

Can anyone point to example code that will help me along?

Thanks.
 
M

Manish Pandit

I would like to create a servlet, which when accessed, will retrieve an
XML file, remotely over the Internet, and parse it to the browser's
screen.

Can anyone point to example code that will help me along?

Thanks.

You can use XSLT to transform the XML in the servlet and post the
output to the response. Alternatively, you can push the XML as-is to
the browser, and have the browser transform it using an XSL hosted on
the server. You can use the xml directive to point to the xsl like
<?xml-stylesheet type="text/xml" href="your_stylesheet.xsl"?>. However,
I am not sure if all browsers support this - all the new ones do for
sure.

Hope this helps.

-cheers,
Manish
 

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

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top