This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes replacing string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "replacing string" Watch "replacing string" New topic

replacing string

Neel Chow
Ranch Hand

Joined: Jan 10, 2005
Posts: 55
I need help desparately.
I have a XML file like this.

<?xml version = "1.0"?>
<Kdemo_WFC Version="1.0" >
<Request Action="Logon" Object="System" Username="Superuser" password="kdemo" />
<Request Action="LoadAllQueries">
VisibilityCode="Private" />
<Request Action="Logoff" Object="System" />

I have tons of user in a database and I have to run this xml api for all the user. essentially I have to change the username everytime in the loop.
my question is
1. how can I replace the username with a given name using string manipulation. there any other way to do it(SAX/DOM)?

Arto Pastinen
Ranch Hand

Joined: Dec 13, 2002
Posts: 79

Maby easiest way is to use some regular expression for it.

Barry Higgins
Ranch Hand

Joined: Jun 05, 2003
Posts: 89
Can you not just use 2 strings to sandwich the username?

something like ...

Hope this helps,
[ February 17, 2005: Message edited by: Barry Higgins ]
wood burning stoves
subject: replacing string
Similar Threads
Seam - Conversation scope example - notworking - New window tab sample
Not getting bean values inside IE, In firefox working fine
servlet error building
Struts 2 - wrong method executed
How to read an XML file using JSP?