I'm writing a DTD parser and I'm a little uncertain how to expand parameter entities. For example is this DTD excerpt valid?
<!ENTITY % xx '%zz;'>
<!ENTITY % zz '<!ENTITY tricky "error-prone" >' >
<!ENTITY % abcd '%xx;'>
<!ENTITY % ef 'c'>
<!ENTITY % gh '%ab%ef;d;'>
%gh;
More specifically I'm curious to know if entity gh will expand correctly. In my opinion %ef; should expand first to 'c' and then the newly formed PE reference %abcd; should expand to %xx; and so on.
Most of the parsers I've seen are identifying %ab as a PE reference and fail since that PE is not defined. But I found absolutely no reference in the standard asking for the parser to work this way. The only reference I found was Included in Literal as opposed to Included as PE where it states that the replacement text must be enlarged with one leading and one following 0x20 - but not in a literal.
Any pointers? Thank you.