I keep getting \"XML parser failure: Unterminated attribute\" with my parser when I attempt to put HTML text or CDATA inside my XML attribute. Is there a way to do this or
Attributes can only have plain text inside, no tags, comments, or other structured data. You need to escape any special characters by using character entities. For example:
That would give the text attribute the value . Note that this is just plain text so if you wanted to treat it as HTML you'd have to run that string through an HTML parser yourself. The XML DOM wouldn't parse the text attribute for you.