File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion 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 ]
I agree. Here's the link:
subject: replacing string
It's not a secret anymore!