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. it is good to unstand and easy to remember forever
View Tutorial          By: Abdul at 2011-11-10 21:03:41

2. Very good article on string , please also mentions
View Tutorial          By: Subham at 2014-04-29 18:01:04

3. awesome example
View Tutorial          By: jagjyot singh at 2010-01-12 20:39:04

4. Detect OS of iphone using Java Code
View Tutorial          By: Naina at 2012-07-31 11:07:09

5. dear i have different files of ms access 2010 like
View Tutorial          By: neeo at 2012-01-16 07:02:20

6. what is the data type of the variable direction di
View Tutorial          By: [email protected] at 2009-12-25 03:07:46

7. It may be good ,when you stressed on the point why
View Tutorial          By: Kishore Mylavarapu at 2011-05-25 01:28:50

8. very good tutorial..
View Tutorial          By: shobhit at 2010-05-04 12:17:41

9. thats is really too gud... very easy example to un
View Tutorial          By: radhika at 2011-11-27 16:32:25

10. The above example for abstract class is very good.
View Tutorial          By: saafia at 2013-08-19 14:33:54