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. hi sr.
do u have any idea have any idea how

View Tutorial          By: mirna at 2012-03-27 05:47:34

2. Right, so were is the tutorial files.zip?
O

View Tutorial          By: jeremy at 2011-10-24 15:58:40

3. Different from the others,Good One
View Tutorial          By: Amiiiii java slayer at 2009-10-14 08:10:26

4. excellent code.....
View Tutorial          By: Anonymous at 2009-05-07 03:09:01

5. how to pass user input string (like a user entered
View Tutorial          By: saif at 2012-12-04 19:51:26

6. Hi,Please send me running code for sending sms fro
View Tutorial          By: rahul at 2008-11-14 05:15:02

7. Good Article. Small and Sweet...
View Tutorial          By: Anupam Pawar at 2009-05-27 03:04:08

8. God bless u man! :)
View Tutorial          By: me at 2015-07-29 13:25:00

9. fantastic
make something like this

View Tutorial          By: jyoti maheshwari at 2009-03-27 22:15:36

10. Hi sir just send me the code sir .... i am interes
View Tutorial          By: maruthi at 2013-10-30 05:14:15