My requirements are that i need to create dynamic pages from an XML file. The XML file is a simple file that is not nested. However i have no idea how to access the values of the XML file in a JSP page. Could someone direct me as to how i could access the XML values without too much of code Eg. My XML File is as
<FILE> <A> a </A> <B> b </B> <C> c </C> <D> d </D> <E> e </E> </FILE>
i would like to use the values a,b,c.. in my JSP page. I came across XSLT but it seems to have browser support issues (IE6 and above, Opera 8). I would like to have maximum browser support and little processing to access my XML file. Remember that the same XML contents may be used in the next jsp page.
Money for nothing and Java for Free
Author and all-around good cowpoke
posted 9 years ago
You have lots of choices - these are off the top of my head: 1. In a separate Java class, read the XML file into a Document object and provide for "bean"like access methods that will use either XPath or org.w3c.dom package methods to extract the values as needed. 2. Use in-process XSLT - see the javax.xml.transform package 3. Use the standard tag library - do a search for "JSTL XML" to get plenty of references. Bill