Thứ Năm, 31 tháng 7, 2014

Use DOM to work with XML

Use DOM to work with XML


Do practice assignment of module 1 & 4

Module 1
Create a student list student.xml. Write a program for a teacher to count the
number of students in a class. Create a DOM treefor parsing the student.xml.
Declare countStudents() function recursively count the number of Student
nodes till reaching the last node in theXML document.

 XML filie including student List


 Main class having main() method and countStudent() method.


Number of student displayed:



Module 4
Create an XML document parser application 
The application should use a Dom Parser to parse an XML document containing the names of employees of an organiaztion, ABC Apparels Ltd , and then print the names of all the employees.
Xml file including employeeList


Main class


Result printed


 Create DocumberBuilder object => use it to parsed xml  file into Documnet object.(Dom document) => After having dom object , use your defined method to uss this dom

 


 

Không có nhận xét nào:

Đăng nhận xét