You can display data obtained from various formats and sources in your application. This recipe shows you how to display a sample set of Student Records obtained from an XML file.
Copy the full code of this recipe from the code/04/xml-content
sources folder. You can launch this code using the URL http://localhost:8080/04/xml-content/main.html
.
Create the
student.xml
file with the student node having attributesname
andage
. Eachstudent
node has multiplecourse
child elements. Eachcourse
element has aname
attribute and a childmarks
element as shown in the following code:<?xml version="1.0" encoding="utf-8" ?> <students> <student name="Alex" age="22"> <course name="HTML5"> <marks>89</marks> </course> <course name="CSS3"> <marks>88</marks> </course> <course name="JavaScript"> <marks>80</marks> </course...