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. Thnx. Very Useful Code...
View Tutorial          By: Ankur Pandya at 2010-09-27 05:14:35

2. This code rocks!! any one having any trouble shoul
View Tutorial          By: Ankur at 2010-01-22 06:37:10

3. hello!!can anyone help me. can you send me the com
View Tutorial          By: denisse at 2008-01-07 05:40:25

4. super explanation
View Tutorial          By: pree at 2013-12-30 16:41:32

5. Thank you... :)
Simple and effective explan

View Tutorial          By: Mohammed Muzammil at 2012-08-08 05:07:32

6. i want to study c-programming language
View Tutorial          By: rajesh at 2008-07-27 07:43:09

7. can you help me do this? - write a program that wi
View Tutorial          By: rence at 2011-08-16 13:33:14

8. Thank you
View Tutorial          By: dara at 2009-12-19 02:46:52

9. sir needed help i am compiler dev c++ which shown
View Tutorial          By: shahab at 2010-05-05 13:17:53

10. Thank ... for idea But
i m confuse how run

View Tutorial          By: Tanaji at 2010-06-01 23:13:19