Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用c编写XML#_C#_Xml - Fatal编程技术网

C# 使用c编写XML#

C# 使用c编写XML#,c#,xml,C#,Xml,如何使用c#创建这种格式的xml文件 什么是角色? 角色是基于安全的权限,可以分配给站点的注册用户。用户可以拥有管理员认为适当的任意数量的基于角色的安全权限。应用程序的某些部分可能具有分配给它们的安全权限,以使它们包含的信息仅对具有所需权限的用户可用。 创建角色 要创建新角色,只需在顶部的文本框中输入其名称,然后单击“添加角色”按钮。创建后,管理员可以使用它并将其分配给任何已注册的用户帐户。 删除角色 要删除角色,请选中gridview左侧的复选框,然后单击“删除所选”按钮。 您可以看看 另一

如何使用c#创建这种格式的xml文件


什么是角色?
角色是基于安全的权限,可以分配给站点的注册用户。用户可以拥有管理员认为适当的任意数量的基于角色的安全权限。应用程序的某些部分可能具有分配给它们的安全权限,以使它们包含的信息仅对具有所需权限的用户可用。
创建角色
要创建新角色,只需在顶部的文本框中输入其名称,然后单击“添加角色”按钮。创建后,管理员可以使用它并将其分配给任何已注册的用户帐户。
删除角色
要删除角色,请选中gridview左侧的复选框,然后单击“删除所选”按钮。
您可以看看

另一种选择是使用or。

您可以查看


另一种选择是使用or。

谢谢你,达林:)。我得到了答案。例如,我的Xml文件存在。我可以用这些代码更新我的文件吗?我想打开一个现有文件并进行更新。@shaahin,是的,您可以使用XDocument更新XML文件:谢谢。然后我会用谷歌搜索我的问题:)谢谢你,达林:)。我得到了答案。例如,我的Xml文件存在。我可以用这些代码更新我的文件吗?我想打开一个现有文件并进行更新。@shaahin,是的,您可以使用XDocument更新XML文件:谢谢。之后我会用谷歌搜索我的问题:)
<?xml version="1.0" encoding="utf-8" ?>
<wrap>
  <content>
    <title>
      WHAT ARE ROLES?
    </title>
    <text>
        Roles are security based permissions that can be assigned to registered user of the site. Users can have any number of role based security permissions that the administrator deems appropriate. Certain parts of the application may have security permissions assigned to them to make the information they contain available only to those users with the required permisions.
    </text>
  </content>
  <content>
    <title>
      CREATE A ROLE
    </title>
    <text>
        To create a new role, simply enter its name into the textbox on top and click the "Add Role" button. Once it is created, it is then available to the administrator to be used and assigned to any registered user account.
    </text>
  </content>
  <content>
    <title>
      DELETE A ROLE
    </title>
    <text>
        To delete a role, select the checkboxes on the left side of the gridview and click the "Delete Selected" button.
    </text>
  </content>
</wrap>
XDocument doc = new XDocument(
    new XDeclaration("1.0", "utf-8", "yes"),
    new XElement("wrap",
        new XElement("content",
            new XElement("title", "WHAT ARE ROLES?"),
            new XElement("text", "Roles are security based permissions that can be assigned to registered user of the site. Users can have any number of role based security permissions that the administrator deems appropriate. Certain parts of the application may have security permissions assigned to them to make the information they contain available only to those users with the required permisions")
        ) // continue with other content tags
    ) 
);
doc.Save("test.xml");