Added support for preserving the order of attributes and namespace prefixes, though the mixing of them is still not preserved.