dalecon
asked on
substring query
hi all
i have a string "<?xml version="1.0" encoding="UTF-8"?><node><e
can someone tell me how i get the section <?xml version="1.0" encoding="UTF-8"?> and remove it from the string, so i am left with <node><element>some data</element></node>
many thanks
Sorry, I made some typos. It should be:
String s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><node> <element>s ome data</element></node>";
s = s.substring(0, s.indexOf("<?")) + s.substring(s.indexOf("?>" )+2, s.length());
System.out.println(s);
String s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><node>
s = s.substring(0, s.indexOf("<?")) + s.substring(s.indexOf("?>"
System.out.println(s);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i get the string using jdom
Yeah you can use same as my post to remove the header. So, you needn't remove it.
ASKER
what jar is import org.dom4j.*; in, i can't find it
thanks
I use dom4j but jdom
ASKER
no worries found it
ASKER
cool that works
s = s.substring(0, s.indexOf("<?")) + s.substring(s.stringOf(">?
or something similar using regex or even some other technique