Skip to content

Fails to Encode Entities #1

Open
@ComedyTomedy

Description

@ComedyTomedy

Hello! I'm aware this is a pretty old library, but libxml2 deletes all my namespaces. So xml.el it is, and your xml-to-string seems to still be the discerning connoisseur's way to re-serialise it.

However I've discovered a bug - xml-to-string doesn't encode entities.

(let ((expected-output "<xml title=\"&amp;\">&amp;</xml>"))
 (xml-to-string
  (with-temp-buffer
    (insert expected-output)
    (xml-parse-region
     (point-min)
     (point-max)))))

The fix is to use the function (xml-escape-string ) when writing CDATA and attribute values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions