DomDocument gymnastics, parsing chapters from a flat xml structure