Are line breaks in XML attribute values allowed?

前端 未结 4 960
遥遥无期
遥遥无期 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:43

    .NET only: If you're not sure if target string is valid xml attribute (and provide this attribute's value via code), you can always use SecurityElement.Escape function to escape invalid characters.

    According to the description of this function, the only invalid characters are:

    <, >, &, ', "

    And this means (as my predecessors wrote), that new line should be OK.

提交回复
热议问题