java - How to get substring from the given string? -


i have read whole xml file single string using class.the output

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> 

now want replace date value.so first want extract date string , replace new value.i have following code,

  date date=new date()   string str=result.substring(result.indexof("<date>")); 

it displays whole string date tag end tag. how extract date tag , replace it?

just value:

string str = result.substring(result.indexof("<date>") + "<date>".length(),         result.indexof("</date>")); 

including tags:

string str = result.substring(result.indexof("<date>"),         result.indexof("</date>") + "</date>".length()); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -