C # XML operations: edit XML file content

Source: Internet
Author: User
Chapter 3: edit XML file records
Use C # to edit XML files. The most convenient method is to use DATASET.
We continue to use the XML file in the previous article, as follows: <users>
<Xs: schema id = "users" xmlns = "" xmlns: xs = "http://www.w3.org/2001/XMLSchema" xmlns: msdata = "urn: schemas-microsoft-com: xml-msdata">
<Xs: element name = "users" msdata: IsDataSet = "true" msdata: Locale = "zh-CN">
<Xs: complexType>
<Xs: choice maxOccurs = "unbounded">
<Xs: element name = "user">
<Xs: complexType>
<Xs: sequence>
<Xs: element name = "userName" type = "xs: string" minOccurs = "0" msdata: Ordinal = "0"/>
<Xs: element name = "userPass" type = "xs: string" minOccurs = "0" msdata: Ordinal = "1"/>
</Xs: sequence>
<Xs: attribute name = "id" type = "xs: string"/>
</Xs: complexType>
</Xs: element>
</Xs: choice>
</Xs: complexType>
</Xs: element>
</Xs: schema>
<User id = "1">
<UserName> outrace </userName>
<UserPass> mypass </userPass>
</User>
<User id = "2">
<UserName> trace </userName>
<UserPass> mypass </userPass>
</User>
<User id = "3">
<UserName> new user </userName>
<UserPass> new passwd </userPass>
</User>
</Users>

Then, create an XML file with the following content: <% @ Import Namespace = "System. IO" %>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.