Re: [xml] newline/form feed valid as attribute value?



Dan Shelton schrieb am 01.07.2012 um 17:35 (+0200):
On 1 July 2012 17:06, Dan Shelton <dan f shelton gmail com> wrote:
In which context are newlines valid values, i.e. is a newline
character or a form feed a valid character in an attribute value?

Clarifying the question:
Is this a valid xml fragment:
-----cut-----
<mytag myattribute="hello
 world">sometext</mytag>
-----cut-----

The document is well-formed. It is not *valid* because it doesn't have
a DOCTYPE. But you likely meant *well-formed*, not *valid*.

A newline in attribute values is okay, as is everything but either <&"
or <&'. [1] However, the parser is required to normalize all whitespace
characters to spaces. [2]

http://www.w3.org/TR/REC-xml/#NT-AttValue [1]
http://www.w3.org/TR/REC-xml/#AVNormalize [2]

-- 
Michael Ludwig



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]