<media:thumbnail url="http:// mysite.com/wp-content/uploads/2013/11/mes1-300x186.png" width="320" length="125399" type="image/jpg"/>
How to extract the URL from this xml ? If I have the above as string ?
<media:thumbnail url="http:// mysite.com/wp-content/uploads/2013/11/mes1-300x186.png" width="320" length="125399" type="image/jpg"/>
How to extract the URL from this xml ? If I have the above as string ?
Some times, as a quick "one time solution" you can use regular expressions.
String xml="<media:thumbnail url=\"http:// mysite.com/wp-content/uploads/2013/11/ mes1-300x186.png\" width=\"320\" length=\"125399\" type=\"image/jpg\"/>";
Pattern pattern=Pattern.compile("url\\s*=\\s*\\\"(.*?)\\\"");
Matcher m=pattern.matcher(xml);
if(m.find()){
String urlValue=m.group(1);
System.out.println(urlValue);
}