XML formatting for later parsing in c#

rossape

New Member
I'm using XML to hold some settings, so let's go with the following example:\[code\]<PermissionLevels> <Permission Name="MyPermission 1" Bases="XXX" /> <Permission Name="MyPermission 2" Bases="XXX" /></PermissionLevels>\[/code\]So the XXX is my problem. I will have several base permissions, e.g. "Read, Create, Delete", and I know C# has the \[code\].Split\[/code\] method, so I could probably try it with "," as a delimiter. I could also have child nodes to \[code\]<Permission>\[/code\].Is there a correct way to do it? With correct I mean the following: I'm not sure whether I should use LINQ (\[code\]XDocument\[/code\]) or the regular \[code\]System.Xml\[/code\] variant (\[code\]XmlDocument\[/code\]) and I am not sure if some different way might be better to handle.
With \[code\].Split\[/code\] I will have to take the \[code\]node.Attributes["Base"].Value\[/code\], split it and do a \[code\]foreach\[/code\] for all elements in the array - maybe LINQ is smarter and can do something differently?Sorry for my rambling, this is just not my domain. The question actually is: When I have multiple values for one attribute, do I concatenate them with e.g. a ",", or do I do it differently (e.g. with child nodes of the object)?
 
Top