Convert document-oriented XML to data structures, preserving element order