I\'d like to parse a string so I can build an XML document.
I have:
String value = \"path=/Some/Xpath/Here\";
I\'ve parsed it this way
Try with:
private void parseXpath() {
String s = "path=/Some/Xpath/Here";
s = s.replace("path=","");
String[] tokens = s.split("/");
for(String t: tokens){
System.out.println(t);
}
}
Also you can avoid removing it at all, if you get path=/Some/Xpath/Here
by other regex, use lookbehind instead of exact matching:
(?<=path=)[^\\,]*
you should get just /Some/Xpath/Here
.
EDIT
If you want to print array as String, use static method Arrays.toString(yourArray);