Xander
Xander

Reputation: 9171

linq-to-xml and carriage returns

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

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

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

Upvotes: 0

Views: 172

Answers (1)

SLaks
SLaks

Reputation: 887195

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)

Upvotes: 3

Related Questions