-
-
XML is the answer, but what is the problem...?
I am definitely no xml expert but this hack produced the name value
Code:
public String parseXML(Document doc, String tagname) {
StringBuffer sb = new StringBuffer();
NodeList nodes = doc.getElementsByTagName(tagname);
sb.append(tagname).append("=");
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
NodeList nList = node.getChildNodes();
for (int j = 0; j < nList.getLength(); j++) {
Node n = nList.item(j);
System.out.println("getNodeValue: " + n.getNodeValue());
if (j > 0) sb.append(",");
sb.append(n.getNodeValue());
}
}
return sb.toString();
}
eschew obfuscation
-
Hi Sjalle.
Thanks .
It seems to work great. Your a genius.
Keep well
___
_/\/ \/\_
(MC3)RaVeN
-
Parsing xml with attributes using java
Hi ,
I have a problem of parsing an xml with attributes.This is the xml i have.
<featureset>
<feature id="sessionbean" label="Session Bean Demo">
<executorClass></executorClass>
<Params>
<param id="drivername" label="Driver Name" value="org.jabo"></param>
<param id="drivername" label="Driver Name" value="org.jabo"></param>
<param id="drivername" label="Driver Name" value="org.jabo"></param>
</Params>
</feature>
</featureset>
Can you please help me to parse this and to store the values of id ,label of feature and param tags.Please help me.
Thanks,
laxmi
Similar Threads
-
By Mike Tsakiris in forum .NET
Replies: 11
Last Post: 10-04-2002, 05:32 PM
-
Replies: 1
Last Post: 05-02-2002, 07:57 AM
-
By Tim in forum xml.announcements
Replies: 0
Last Post: 10-11-2001, 04:00 PM
-
By Tim Frost in forum xml.announcements
Replies: 0
Last Post: 04-02-2001, 10:53 AM
-
Replies: 1
Last Post: 03-20-2001, 02:31 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks