Visit children who have xmlAttribue first when building up xml

#407

Uh oh I guess my re-write to use xmlWriter was responsible for this.

I've got this which is ugly and I am not sure fixes all the issues. Hopefully you've got something better or plans to revert back to simpleXML.