Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading from XML

 
suresh sai
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.,
Could you please tell me,How can I read values from an XML?.Supppose,I have my own xml file (student.xml) that contains the tag as follows,
<student>
<name>kathy</name>
<subject>java</subject>
</student>
And I need to read name,subject values from the servlet or jsp.
thanks in advance
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are quite a few ways to parse XML in your app and each has it's pros and cons. Take a look here:http://www.cafeconleche.org/books/xmljava/. It's the complete book online, I'm sure you'll find something that suits your requirements.
[ September 24, 2007: Message edited by: Tarun Yadav ]
 
Arvind Mahendra
Ranch Hand
Posts: 1162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well one way is to make them like init parameters or something. There si also a class that allows you to read XMl values and a method something like parseWebXML(). look up the method and class. I wish I could help more But Im busy so I can help you out later
[ September 24, 2007: Message edited by: Chunnard Singh ]
 
suresh sai
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks tarun and chunnard.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic