I get a set of ‘Attributes’ with default values and I want to create a string which is a part xml document as below(not a complete xml document). I want to have a ‘tab’ in between every attribute. I’ve found string concatenation is the workable option in this case. In .Net is there any better way of doing this?
<XmlNodes>
<ChildNode Attribute1 ="100" Attribute2="200" Attribute3 ="0"/>
<ChildNode Attribute1="100" Attribute2="200" Attribute3 ="0"/>
...
</XmlNodes>
Here’s a fun little hack that at least only resorts to string manipulation late in the piece:
But I maintain that if this is about providing ‘templates’ for people to edit then you’re best off getting them to edit it in a non-XML format (like CSV) and then convert to XML when you parse it.