Java Xpath example

In this tutorial, we will see how to read xml document using xpath. Step 1) Following XML document will show us the students enrolled into each department in college. <?xml version="1.0" encoding="UTF-8"?> <college> <department name="arts"> <student> <rollNum>1</rollNum> <firstName>John</firstName> <lastName>Smith</lastName> </student>