What would be the simplest way to extract data from XML in Java? The XML data is always in the form:
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<groups>GROUPNAME</groups>
and all I want to do is capture the groupname in a string. I've tried using a regular expression, but I'm struggleing to write the pattern code:
String xmlline = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<groups>XWiki.G_SW_DEV</groups>";
String pattern = "";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(xmlline);
if(m.find()){
....
}
As described in: http://www.tutorialspoint.com/java/java_regular_expressions.htm
Any advice on the pattern code or is there a better way to extract the XML data?