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. You should consider using different threads that a
View Tutorial          By: Jeremy at 2010-01-13 23:02:11

2. Windows XP
libmySQL.dll in package MySQL5.1

View Tutorial          By: Bingo at 2009-11-07 20:11:52

3. its realy gud which clears minor douts regarding t
View Tutorial          By: Shripad at 2010-01-19 05:40:41

4. hi can u send me the complete working code for sen
View Tutorial          By: Amit Adhikaree at 2011-03-22 17:47:49

5. Wow
View Tutorial          By: Ajmalnafi at 2012-06-30 01:48:04

6. can u access by a tutorial by using java script
View Tutorial          By: Benjtaz at 2011-07-11 06:22:16

7. I have mobile connecting to pc 3 options come com
View Tutorial          By: Sumit Sharma at 2012-04-13 16:32:15

8. Really helpful way of explanation..And the example
View Tutorial          By: pavan at 2010-04-17 03:10:58

9. Hi
I tried to use this class , I don't get

View Tutorial          By: Asela at 2012-01-26 19:05:14

10. great answer...
View Tutorial          By: nagi ponnagani at 2011-04-29 14:11:21