 |
 |
 |
Hi All,
I am using following code snippet to add another user in Users.xml:
-------------------------------------------------------------------
DataSet dstUsers = new DataSet();
dstUsers.ReadXml("Users.xml");
DataTable dtbUsers = dstUsers.Tables["User"];
DataRow drwUser = dtbUsers.NewRow();
drwUser["UserName"] = "Test User 2";
dtbUsers.Rows.Add(drwUser);
dstUsers.WriteXml("Users.xml");
-------------------------------------------------------------------
Users.xml looks like
-------------------------------------------------------------------
<?xml version="1.0" standalone="yes"?>
<Configuration>
<Users>
<User>
<UserName>Test User</UserName>
</User>
</Users>
<Roles>
<Role>
<RoleName>Test Role</RoleName>
</Role>
</Roles>
</Configuration>
-------------------------------------------------------------------
After execution of code, <User> tag is inserted at wrong position and
Users.xml looks like:
-------------------------------------------------------------------
<?xml version="1.0" standalone="yes"?>
<Configuration>
<Users>
<User>
<UserName>Test User</UserName>
</User>
</Users>
<User>
<UserName>Test User 2</UserName>
</User>
<Roles>
<Role>
<RoleName>Test Role</RoleName>
</Role>
</Roles>
</Configuration>
-------------------------------------------------------------------
But if I modify Users.xml as below, <User> tag is inserted at proper
position.
-------------------------------------------------------------------
<?xml version="1.0" standalone="yes"?>
<Users>
<User>
<UserName>Test User</UserName>
</User>
</Users>
-------------------------------------------------------------------
Can anyone give any idea that how can I insert <User> tag inside
<Users> tag without modifying XML format like above???
---
Posted using Wimdows.net NntpNews Component -
Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
|
 | 

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |