This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
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.
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