[OpenStreetMap] #4382: Invalid character in GPX track description produces bad XML in API response

OpenStreetMap trac at noreply.openstreetmap.org
Sun Apr 14 16:52:07 UTC 2013


#4382: Invalid character in GPX track description produces bad XML in API response
----------------------+-------------------------
  Reporter:  don-vip  |      Owner:  rails-dev@…
      Type:  defect   |     Status:  new
  Priority:  minor    |  Milestone:
 Component:  api      |    Version:
Resolution:           |   Keywords:
----------------------+-------------------------

Comment (by TomH):

 Well it turns out that this is very odd in fact... We are using libxml to
 return this so I find it hard to believe that it isn't doing the right
 escaping, but that does seem to be what is happening. Here is our code:

   https://github.com/openstreetmap/openstreetmap-
 website/blob/master/app/controllers/api_controller.rb#L71

 which is just invoking << on an XML::Node object, which is documented
 here:

   http://xml4r.github.io/libxml-
 ruby/rdoc/classes/LibXML/XML/Node.html#method-i-3C-3C

 in turn that calls the xmlNodeAddContent function in libxml:

   http://xmlsoft.org/html/libxml-tree.html#xmlNodeAddContent

 according to which the content being added should be "raw text, so
 unescaped XML special chars are allowed" which suggests that it should do
 the escaping.

-- 
Ticket URL: <https://trac.openstreetmap.org/ticket/4382#comment:8>
OpenStreetMap <http://www.openstreetmap.org/>
OpenStreetMap is a free editable map of the whole world



More information about the rails-dev mailing list