Say I have a node with title "foo & bar"

--> JSON :

"title":"foo \u0026 bar"

--> XML :

<title>foo </title>

the string after (and including) the '&' char is lost

CommentFileSizeAuthor
#2 1136350-restws-xml-encoding.patch732 bytesklausi

Comments

yched’s picture

Additionally, (noticed that on next page load) this generates an error :
"Warning: DOMDocument::createElement(): unterminated entity reference bar in RestWSFormatXML::addToXML() (line 265 of /home/yves/workspace/d7/sites/all/modules/restws/restws.formats.inc)."

That is, "unterminated entity reference [part of the string after the '&'] in RestWSFormatXML::addToXML()"

klausi’s picture

Status: Active » Needs review
StatusFileSize
new732 bytes

Here is a patch that creates an escaped XML text node for property values. Please test.

klausi’s picture

Status: Needs review » Fixed

Committed that plus another small fix for numeric names.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.