The faster processing comes at a cost of a copy into xmlDecl (no problem, just pointing it out).  Also, I don't think you use the fact that you've got a NULL char at end?