Use java XML parsing instead of unreliable regex