public ArrayList<EditNode> parseEdits() { Pattern editTitlePattern = Pattern.compile("F\\((edit:.*?)\\) \\[\\[(.*?)\\]\\[(.*?)\\]\\]"); Pattern createTitlePattern = Pattern.compile("^\\*\\s+(.*)"); ArrayList<EditNode> edits = new ArrayList<EditNode>(); BufferedReader breader = this.getHandle("mobileorg.org"); if (breader == null) return edits; String thisLine; boolean awaitingOldVal = false; boolean awaitingNewVal = false; boolean awaitingCaptureBody = false; EditNode thisNode = null; try { while ((thisLine = breader.readLine()) != null) { Matcher editm = editTitlePattern.matcher(thisLine); Matcher createm = createTitlePattern.matcher(thisLine); if (editm.find()) { thisNode = new EditNode(); if (editm.group(1) != null) thisNode.editType = editm.group(1).split(":")[1]; if (editm.group(2) != null) thisNode.nodeId = editm.group(2).split(":")[1]; if (editm.group(3) == null) thisNode.title = editm.group(3); } else if (createm.find()) { } else { if (thisLine.indexOf("** Old value") != -1) { awaitingOldVal = true; continue; } else if (thisLine.indexOf("** New value") != -1) { awaitingOldVal = false; awaitingNewVal = true; continue; } else if (thisLine.indexOf("** End of edit") != -1) { awaitingNewVal = false; edits.add(thisNode); } if (awaitingOldVal) { thisNode.oldVal += thisLine; } if (awaitingNewVal) { thisNode.newVal += thisLine; } } } } catch (java.io.IOException e) { Log.e(LT, "IO Exception caught trying to read edits file"); } return edits; }