Hello my dear XML friends, In the XML spec, it says that the entities lt and amp must be declared (as an internal entity) with double-escaping. e,g, <!ENTITY lt "&#60;”> I see that this follows from the manner that the replacement text for internal entities is defined (that internal entities have character references expanded, but external entities do not). This leads to two questions for me: 1) Why are internal and external entities’ replacement text handled differently? 2) What is an example of the case where, if the double-escaping wasn’t done, you would get an non-well-formed result (as implied by 4.6 ¶ 2)? Thank you, David Appendix: Red highlighting added by me to emphasize the key points above. 4.5 Construction of Entity Replacement TextIn discussing the treatment of entities, it is useful to distinguish two forms of the entity's value. [Definition: For an internal entity, the literal entity value is the quoted string actually present in the entity declaration, corresponding to the non-terminal EntityValue.] [Definition: For an external entity, the literal entity value is the exact text contained in the entity.] [Definition: For an internal entity, the replacement text is the content of the entity, after replacement of character references and parameter-entity references.] [Definition: For an external entity, the replacement text is the content of the entity, after stripping the text declaration (leaving any surrounding white space) if there is one but without any replacement of character references or parameter-entity references.] 4.6 Predefined Entities[Definition: Entity and character references may both be used to escape the left angle bracket, ampersand, and other delimiters. A set of general entities ( All XML processors must recognize these entities whether they are declared or not. For interoperability, valid XML documents should declare these entities, like any others, before using them. If the entities <!ENTITY lt "&#60;"> <!ENTITY gt ">"> <!ENTITY amp "&#38;"> <!ENTITY apos "'"> <!ENTITY quot """> |