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



Related Tutorials

Java program to get location meta data from an image

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

Archived Comments

1. As a beggnar, i find it varry varry usefuull.... P
View Tutorial          By: Rameeza at 2011-05-17 03:14:50

2. it provides manna in the studies of java to me
View Tutorial          By: aravinden at 2011-12-27 08:18:18

3. how to connect jdbc in java on mysql
View Tutorial          By: naseem at 2011-10-26 19:26:45

4. When the Value Is Returned To The Method Then How
View Tutorial          By: nitin deep singh at 2011-08-09 11:43:07

5. Awesome article...
View Tutorial          By: Jiten TAluja at 2010-06-03 06:33:10

6. Thanks...Really nice...
View Tutorial          By: Raj at 2013-02-07 08:58:28

7. really helpfull and gets all the stuff what u want
View Tutorial          By: yash at 2009-10-25 12:28:57

8. Hi,

I think this is not a correct d

View Tutorial          By: Dinesh Chopra dc at 2013-03-19 04:30:48

9. I have my application running on server that is th
View Tutorial          By: vitamin b12 at 2009-12-04 10:51:56

10. hi,
thier is an error coming with me when i

View Tutorial          By: Tarun at 2013-02-17 03:13:21