aspose file tools
The moose likes Java in General and the fly likes How to replace a small string from a big StringBuffer Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to replace a small string from a big StringBuffer" Watch "How to replace a small string from a big StringBuffer" New topic
Author

How to replace a small string from a big StringBuffer

Rohit Kumar
Ranch Hand

Joined: Sep 20, 2007
Posts: 53
Hi,

I have a big string buffer, which has data in xml format.
I wann to change a particular small stings from the String buffer.
I don't think String's find/replace policy, or even xml parsing is good option here.

What would be best option in this senarieo?

Thnaks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35224
    
    7
I don't think String's find/replace policy, or even xml parsing is good option here.

What do you mean by "policy"? If you're certain that the text occurs only in within text elements (and not in attribute or element names), then find/replace should work fine.


Android appsImageJ pluginsJava web charts
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
You should prob'ly use a DOM library if you can find one. There are a variety of them that are tailored toward various uses.

If you are absolutely certain that the string you want to change will not be part of the markup, you could certainly use StringBuilder/StringBuffer. (i.e. "Frankensteen" => "Frankenstein")


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
 
I agree. Here's the link: http://jrebel.com/download
 
subject: How to replace a small string from a big StringBuffer
 
Similar Threads
Wrapper Classes
split big DOM xml file ??
BufferedInputStream
FileWriter & UTF-8 Encoding
designing approaches ?