*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "What Watch "What New topic
Author

What's the simplest way to adding an attribute ?

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Hi,
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.
Pho
[This message has been edited by Ajith Kallambella (edited August 01, 2001).]


Regards,

Pho
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What's the simplest way to adding an attribute ?