Improve XML parsing to handle attributes as well.