I am not trying to save dataset or datatable to a xml file rather create a xml structure for saving related data? For example i would like to know how below data could be in a xml file
UserId
Username
Password
RoleId
UserId [FK]
CreatedOn
will it look like this
<User userid="" username="" password="">
<Roles id="">
<Name></Name>
<Description></Description>
</Roles>
</User>
which structure would be best to use xml files as DB
I think you want to consider implementing the XML in a more normalized manner, similar to how you would do so with a relational database. For instance in your current solution you would be required to type out the entire role structure within every user such as
<User userid="1" username="user01" password="password">
<Roles id="1">
<Name>Role 1</Name>
<Description>This is Role 1</Description>
</Roles>
</User>
<User userid="2" username="user02" password="password">
<Roles id="1">
<Name>Role 1</Name>
<Description>This is Role 1</Description>
</Roles>
</User>
A normalized structure could look like the following
<Roles>
<Role id="1">
<Name>Role 1</Name>
<Description>This is Role 1</Description>
</Role>
</Roles>
<User id="1" username="user01" password="password">
<Roles>
<Role>1</Role>
</Roles>
</User>
<User id="2" username="user02" password="password">
<Roles>
<Role>1</Role>
</Roles>
</User>
Hope this helps