File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
XML and Related Technologies
Joined: Nov 15, 2004
Apr 08, 2005 01:25:00
Take a look at this xml file.
<name firstname="abc" lastname="xyz" />
Is there any possibility to retrive both the attribute name and attribute value?
I my project I am retriving the element "name" and from that I want retrive both the attribute name and and attribute value
using Element's getAttribute() method we can retrive attribute value in our case "abc" and "xyz"
Element e =new Element();
s1 = e.getAttribute("firstname");
I want to retrive "firstname" and "lastname" also.
Since everything is dynamic, attribute names may be different from time to time. So I wanted to retrive attribute name and from that retrive attribute value.
So one please help me
Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1
JSTL Tag Documentation
Author and all-around good cowpoke
Joined: Mar 22, 2000
Apr 08, 2005 07:59:00
Look at the getAttributes method of org.w3c.dom.Node
It returns a NamedNodeMap with all of the attributes names and values.
I agree. Here's the link:
subject: Attribute Name
Replace value of XML element using API
JSTL: Help needed in retrieving data from xml, setting it and printing
Structure of SOAP response
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015