There's an interesting Wikipedia piece about it, saying " A number of its lines and the general plot resemble those of a contemporary broadside ballad Patrick Fleming (also called "Patrick Flemmen he was a Valiant Soldier") about Irish highwayman Patrick Fleming, who was executed in 1650."