I think I've managed to get a standards complaint expression for standalone="yes" documents, but the second you throw in an external subset a static parse is impossible. The parsing rules become dependent on the semantic meaning of previously parsed tokens.