FAQ
xml.Marshal is encoding single apostrophes and closing angle brackets in
attribute values when it appears it should only encode & < " \t \r \n

Per the canonical XML spec http://www.w3.org/TR/xml-c14n2/

"*Attribute Nodes-* a space, the node's QName, an equals sign, an open
quotation mark (double quote), the modified string value, and a close
quotation mark (double quote). The string value of the node is modified by
replacing all ampersands (&) with &amp;, all open angle brackets (<) with
&lt;, all quotation mark characters with &quot;, and the whitespace
characters #x9, #xA, and #xD, with character references. The character
references are written in uppercase hexadecimal with no leading zeroes (for
example, #xD is represented by the character reference &#xD;)"

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Ian Lance Taylor at Apr 26, 2014 at 5:25 pm

    On Sat, Apr 26, 2014 at 6:05 AM, wrote:
    xml.Marshal is encoding single apostrophes and closing angle brackets in
    attribute values when it appears it should only encode & < " \t \r \n
    Is what xml.Marshal is doing wrong? That is, does it cause XML
    readers to do the wrong thing?

    Ian

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Phil Dodderidge at Apr 27, 2014 at 12:37 pm
    OK, that is a fair point. I am trying to produce canonical XML and was
    hoping I didn't have to muck around with EncodeToken. It is an edge case.

    Thanks,
    Phil
    On Saturday, April 26, 2014 12:25:24 PM UTC-5, Ian Lance Taylor wrote:

    On Sat, Apr 26, 2014 at 6:05 AM, <pdo...@poyntz.com <javascript:>>
    wrote:
    xml.Marshal is encoding single apostrophes and closing angle brackets in
    attribute values when it appears it should only encode & < " \t \r \n
    Is what xml.Marshal is doing wrong? That is, does it cause XML
    readers to do the wrong thing?

    Ian
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 26, '14 at 5:11p
activeApr 27, '14 at 12:37p
posts3
users2
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase