Comment on Tutorial - XML and Java - Parsing XML using Java Tutorial By totheriver.com



Comment Added by : Suvarna

Comment Added at : 2012-01-12 06:56:55

Comment on Tutorial : XML and Java - Parsing XML using Java Tutorial By totheriver.com
Hi all

I am using getAttribute but its not returning the answer i expect. I have an XML string: <TestDoc><templateName>myReportName</templateName></TestDoc>

I have converted this into a DOM doc called inputDoc and now i want to get the value of the attribute templateName.

i have:

Element root = inputDoc.getDocumentElement();
String Template = root.getAttribute("templateName");

and it returns null as Template. Any ideas?

Thanks very much.


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Dude, you made my day.
View Tutorial          By: Sebasti├ín at 2011-08-29 14:01:10

2. Thanks for the solution. I must say however that t
View Tutorial          By: Pierre at 2009-11-19 20:16:35

3. thanks i learnt how to use isset in php
View Tutorial          By: free web directory at 2010-09-15 19:42:28

4. thnkss buddyy its very helpful for my assignmentss
View Tutorial          By: yamini at 2011-02-25 21:01:23

5. I have to ask; Where do we put the text boxes?
View Tutorial          By: Jeremy at 2010-10-07 14:37:07

6. gudeveniing!! plz gave me some project title gor j
View Tutorial          By: ivie at 2012-12-12 11:00:43

7. good example need some more explanation on notify
View Tutorial          By: prashant at 2009-09-08 19:29:54

8. Hi Friends,

I got a very interestin

View Tutorial          By: Rohit Kapur at 2011-07-27 20:56:57

9. Can you please send me complete sample code of cha
View Tutorial          By: Brajesh at 2011-04-21 05:48:17

10. this is good arraylist
View Tutorial          By: shaffy at 2010-07-31 04:25:17