W3C (World Wide Web Consortium) started the DOM (Document Object Model) parser, that is the platform independent and language-neutral interface. Programs can dynamically manipulate the content, structure and style of documents. The document is processed and the results after the processing are displayed on to the present page. DOM parser is not an ideal technology for JSP because JSTL (Java Server Pages Standard Tag Library) also provides actions for parsing an XML document.
This example helps you to parsing the xml page in jsp. 'parsingxml.jsp' uses 'roseindia.xml' file and display its content to the jsp page.
roseindia.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
|
parsingxml.jsp
<%@page import="org.w3c.dom.*, javax.xml.parsers.*" %>
|
Running The program on this url: http://localhost:8080/ServletExample/jsp/parsingxml.jsp the following output will be generated.

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Parsing The XML File using DOM parser in JSP
Post your Comment