Proper Declaration/PE Nesting is a validity, not a well-formedness constraint
Documents violating the constraint are still well-formed. libxml2 currently stops parsing if it encounters such errors (XML_ERR_ENTITY_BOUNDARY
). This causes some "invalid document turned not well-formed too" errors in the XML conformance tests.