views:

18

answers:

1

What is the best what to handle carriage returns in xml formatting with xml?

<myxml>
<mydata>
</mydata>
</myxml>

<myxml><mydata></mydata></myxml>
+3  A: 

It doesn't make any difference.

If you want the XML to be smaller, don't add newlines.
If you want it to be human-readable, add newlines and indentation.

LINQ to XML will format the XML with tabs and newlines by default; to prevent this, call element.ToString(SaveOptions.DisableFormatting)

SLaks