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. the 2 not required lines
1) #include

View Tutorial          By: saurabh at 2012-02-20 06:33:57

2. wow !!! worked well
View Tutorial          By: Rajesh at 2012-08-30 10:54:53

3. How to run this Program?
View Tutorial          By: arwa at 2008-10-14 04:45:06

4. it is working....great
View Tutorial          By: mahesh maduranga at 2011-03-27 23:01:57

5. This is pretty straightforward and got me to under
View Tutorial          By: Renoir Boulanger at 2009-09-01 09:49:24

6. it is unfair to leave this portal without thanking
View Tutorial          By: anil kumar at 2009-12-30 23:40:25

7. HI there, thanks for taking time to write this dow
View Tutorial          By: nick at 2012-07-31 10:41:47

8. haiiiiiiiii sir , i have error in this program, er
View Tutorial          By: Vinod at 2012-07-31 12:23:19

9. Thanks, cleared the situation!!
View Tutorial          By: alex at 2010-03-23 16:16:49

10. Awesome post....
View Tutorial          By: Zeeshan Ali Ansari at 2012-11-24 06:35:20