Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes What's the simplest way to adding an attribute ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "What Watch "What New topic

What's the simplest way to adding an attribute ?

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

I currently have a String with this value:
String s = "<item xsi:type=\"xsd:string\">hello</item>";
Now I want to add an attribute like this:
<item soap-enc :position="[1]" xsi:type="xsd:string" >hello</item>
What's is the simplest way to do this ?
The element name "item" is variable. So trying to do a string
replace over "<item " with "soap-enc :position=\"[1]\"" will
not work all the time.
I do not specifically prefer a DOM/SAX solution; even
a simple string manipulation is fine with me.
Thanks for answering.
[This message has been edited by Ajith Kallambella (edited August 01, 2001).]


I agree. Here's the link:
subject: What's the simplest way to adding an attribute ?
Similar Threads
during saving a multipart message
Soap Envelope not version 1.1
problem with String [] in axis 1.3 and .net client
Conversion of Raw Soap Response Into HTML
[Code Review]