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. Excellent example !!!
View Tutorial          By: mah at 2010-11-27 04:06:22

2. good
View Tutorial          By: osman at 2011-11-21 22:23:02

3. Best Example for Inheritance. Thank lot!

View Tutorial          By: Periyasamy C Chennai at 2010-07-09 01:35:30

4. Nice explanation.But please explain left shift an
View Tutorial          By: Ramesh Kanagaraj at 2013-03-28 14:27:30

5. Good example. However as someone said, it would be
View Tutorial          By: Neo Cambell at 2010-03-10 11:02:06

6. i'am having an error in main.xml in line RelativeL
View Tutorial          By: Nova at 2013-04-18 11:21:06

7. u hav done Nice job..
View Tutorial          By: Rakesh at 2012-10-01 16:00:14

8. Hi,
I need to put in a picturebox on VB .NE

View Tutorial          By: Marcio Rodrigues at 2009-11-27 05:07:09

9. Awesome article. It's very useful. Despite it didn
View Tutorial          By: Matheus at 2015-02-24 12:06:05

10. unzip jquery-ui-1.10.3.custom

and c

View Tutorial          By: ajmal at 2013-06-06 10:44:55