code: def is_valid_xml_char(self, char):
          
          codepoint = ord(char)
          return (0x20 <= codepoint <= 0xD7FF or
                  codepoint in (0x9, 0xA, 0xD) or
                  0xE000 <= codepoint <= 0xFFFD or
                  0x10000 <= codepoint <= 0x10FFFF)
docs: Check if a character is valid based on the XML specification.