[web API] pwg.images.exist generates malformed XML #161

Open
opened 2026-10-04 23:45:27 +02:00 by adam · 0 comments
Owner

Reported by mlg on 1 May 2011 15:27

The web service method pwg.images.exist returns the md5 sums of the images as markups. For instance, here is a result :
<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
<33ad8a38ac38d2213562c13a630b2a7a>106</33ad8a38ac38d2213562c13a630b2a7a>
</rsp>

The XML is malformed because the first markup character is a number (the XML specifications do not accept a number as the first character).
It can cause bugs when an XML parser is used. For instance, with a java XML parser, trying to read the above text gives :
[Fatal Error] :1:56: The content of elements must consist of well-formed character data or markup.
Changing the XML to something like that could be a possibility :
<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
<md5sum value="33ad8a38ac38d2213562c13a630b2a7a">106</md5sum>
</rsp>

Piwigo Bugtracker #2290

**Reported by mlg on 1 May 2011 15:27** The web service method pwg.images.exist returns the md5 sums of the images as markups. For instance, here is a result : &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; &lt;rsp stat=&quot;ok&quot;&gt; &lt;33ad8a38ac38d2213562c13a630b2a7a&gt;106&lt;/33ad8a38ac38d2213562c13a630b2a7a&gt; &lt;/rsp&gt; The XML is malformed because the first markup character is a number (the XML specifications do not accept a number as the first character). It can cause bugs when an XML parser is used. For instance, with a java XML parser, trying to read the above text gives : [Fatal Error] :1:56: The content of elements must consist of well-formed character data or markup. Changing the XML to something like that could be a possibility : &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; &lt;rsp stat=&quot;ok&quot;&gt; &lt;md5sum value=&quot;33ad8a38ac38d2213562c13a630b2a7a&quot;&gt;106&lt;/md5sum&gt; &lt;/rsp&gt; [Piwigo Bugtracker #2290](http://piwigo.org/bugs/view.php?id=2290) <!-- github-sync-id:97226261 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#161