Currently, I am utilizing XMLSerializer() to generate an XML document in memory. However, the issue arises when it starts encoding elements using XHTML standard entities such as   ; . My goal is to create an XML document devoid of any XHTML entities.
The problem further complicates due to my target DTD not defining these entities. Hence, if a user enters a character with a corresponding XHTML entity, the resulting serialized document becomes invalid (referencing an undefined entity like &nsbp;).
Could it be that I am constructing the DOM tree incorrectly? Alternatively, is there a different approach to prevent XMLSerializer() from acting like XHTMLSerializer()?