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



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. hi this is very helpful........thank you very much
View Tutorial          By: sumalatha at 2010-06-07 02:16:37

2. What is the \ in several of the string building st
View Tutorial          By: rogerb at 2012-01-28 23:07:31

3. ya,i changed tht to GSM modem but stil there is a
View Tutorial          By: rajesh at 2008-12-15 01:56:35

4. hello sir , i just implement your code and modify
View Tutorial          By: tushar at 2012-01-31 05:21:37

5. simply super post
View Tutorial          By: vinodh at 2010-05-05 00:29:12

6. Nice Blog
View Tutorial          By: RAKESH KUMAR at 2015-08-04 10:07:50

7. thanks f0r this p0st... it heLped me much... keep
View Tutorial          By: martz at 2009-04-29 02:27:19

8. Thanks for the digital shell clock: very cool, and
View Tutorial          By: Lol loller at 2012-04-11 15:40:45

9. What is the difference between an Interface and an
View Tutorial          By: RAJA at 2015-06-26 17:28:31

10. Thanks Man , You are Genius i have been looking fo
View Tutorial          By: hamza Ouni at 2015-02-22 13:38:02