Are line breaks in XML attribute values allowed?

前端 未结 4 946
遥遥无期
遥遥无期 2020-11-27 05:14

I realise that it\'s not elegant or desired, but is it allowed (in well-formed XML) for an attribute value in an XML element to span multiple lines?

e.g.

<         


        
4条回答
  •  情歌与酒
    2020-11-27 05:56

    It is allowed, however according to W3C recommendation your XML parser should normalize the all whitespace characters to space (0x20) - so the output of your examples will differ (you should have new line on the output for " ", but only space in the first case).

    http://www.w3.org/TR/1998/REC-xml-19980210#AVNormalize

提交回复
热议问题