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. Thanks a ton!!! It was really very useful :)
View Tutorial          By: Ankit at 2015-05-11 12:30:41

2. nice examlpe but u can make it more easy frnd
View Tutorial          By: meghendra at 2009-02-14 00:21:31

3. can u tell me mobile tracker code in j2me
w

View Tutorial          By: aiyaz at 2010-08-21 16:29:08

4. The code for CharArrayReader is not working. So, w
View Tutorial          By: Maya Joshi at 2012-06-23 14:30:26

5. thanks...helped a lot!!!!
View Tutorial          By: Sc21ac at 2013-05-03 03:44:06

6. Thank You,
Code is working well.
Is

View Tutorial          By: dinesh at 2012-06-23 04:33:16

7. explanation is good but i have one doubt what is t
View Tutorial          By: sulthan at 2012-10-09 06:13:14

8. The only thing that really was the solution to my
View Tutorial          By: nick marinho at 2010-07-24 17:45:59

9. i want to open pdf file from sd card and i dont wa
View Tutorial          By: Karan Mavadhiya at 2013-01-30 12:02:30

10. Hi,

I am using the code files for s

View Tutorial          By: Utsav at 2009-07-14 01:29:06