tags:

views:

1394

answers:

2

I realise that it's not elegant or desired, but is it valid for an attribute value in an XML element to span multiple lines?

e.g.

<some-xml-element value="this value goes over....
multiple lines!" />

Yeah I realise there's better ways of writing that. I would personally write it like:

<some-xml-element>
<value>this value goes over...
multiple lines!</value>
</some-xml-element>

or:

<some-xml-element value="this value goes over....&#13;&#10;" />

But we have our own XML parser and I'd like to know whether the first example is valid for XML.

+2  A: 

Yes the first example is a valid one.

GreenShadow
+11  A: 

http://www.w3.org/TR/REC-xml/#NT-AttValue

Seems to say everything except < & and " are OK. So newline should be, too.

derobert
+1 for the research.
Ben Daniel