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. Please guys i need sms.zip. I tried SMS.RAR but al
View Tutorial          By: Waseem at 2010-03-06 15:48:40

2. Helpful..
View Tutorial          By: syam at 2009-12-29 07:14:05

3. I wanna to name ,subject and marks of every subjec
View Tutorial          By: raveesh yadav at 2012-10-13 19:56:47

4. Simple and to the point. Thanks for this tutorial.
View Tutorial          By: Balvinder at 2008-08-03 04:40:05

5. Nice one.your example proves that if you are apply
View Tutorial          By: Nisarg pathak at 2015-09-30 17:23:37

6. This is the coding that I wanted...
This is

View Tutorial          By: Damith at 2012-05-16 17:26:10

7. Good one.. great for beginners..
View Tutorial          By: varun at 2009-09-29 14:18:04

8. This is by far the easiest way I have yet seem, ma
View Tutorial          By: doahh at 2010-03-08 11:23:48

9. good example tnq...........
View Tutorial          By: SaidiReddy at 2012-06-09 12:03:09

10. Hi people,
for those getting the Time out

View Tutorial          By: Ramlak at 2008-05-08 08:28:29