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



Ask a Question

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. Good explanation
View Tutorial          By: Siddesh at 2012-07-12 03:53:07

2. How do u edit the text ? this is always replacing
View Tutorial          By: anurag at 2012-08-23 07:24:47

3. i m very glad to know and use this site. this is w
View Tutorial          By: Rupinder at 2009-09-08 08:49:23

4. int n = 0;
for (int m = 0; m < 5; m++) {

View Tutorial          By: max at 2011-05-26 09:41:26

5. PROGRAM TO FIND OUT SMALLER NU:-

cl

View Tutorial          By: ishaan gogna at 2012-05-09 19:00:49

6. GC.Collect is for .net not for java don't get conf
View Tutorial          By: asin at 2013-06-27 15:47:35

7. This came out of a book
View Tutorial          By: Kyle Bradley at 2010-04-12 19:48:12

8. This is a simple app and its working good.......
View Tutorial          By: sathish at 2012-04-23 12:16:07

9. its good,,,can it be done more simpler without usi
View Tutorial          By: gahanaatherya at 2013-10-14 11:50:02

10. hi can you send me the complete working code for
View Tutorial          By: avanti at 2007-10-04 02:30:04