No, neither XML DTDs nor any other XML schema language I'm familiar with provide a way to constrain the order of attributes. As stwissel has already pointed out, the XML specification says that the order of attributes is not significant.
Your options include:
- writing a filter to accept XML with attributes in any order and emit the same XML with the attributes in the order you wish them to appear;
- improving (or at least: changing) your existing PHP code to accept attribute in arbitrary sequence;
- rewriting your PHP code to use an XML-aware toolkit that makes it easier to deal with the non-determinism of attribute order;
- redesigning the XML vocabulary to make the attributes in question appear as child elements, so that you can force them to appear in a prescribed sequence.
I would not go so far as to say that XML and regular expressions don't mix. But when you apply regular expressions to XML, you do need to deal with the basic facts of XML syntax.