クラスを使用してxmlファイル全体を単一の文字列として読み取りました。出力は
String result=<?xml version="1.0"?><catalog><book id="bk101"><part1><date>Fri Apr 05 11:46:46 IST 2013</date><author>Gambardella, Matthew</author><title>XML Developer's Guide</title><genre>Computer</genre><price>44.95</price> <publish_date>2000-10-01</publish_date></part1></book></catalog>
今、日付の値を置き換えたいので、最初に文字列から日付を抽出し、新しい値を置き換えたいと思います。次のコードがあります。
Date date=new Date()
String str=result.substring(result.indexOf("<date>"));
日付タグから終了タグまでの文字列全体を表示します。日付タグを抽出して置き換える方法は?