Generic parse method.