I want to write an XML file. I have created an XSD file named XMLSchema.xsd, and run the command ‘xsd /c XMLSchema.xsd’ which generated a c# class file. Now, how do I use this file to generate XML files?
Part of my code:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="XMLSchema" targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" >
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="Audit">
<xs:complexType>
...
which generates a c# class ‘root’.
How do I call ‘root’ from my C# web program?
Thanks
You need to include the
root.csfile in your project, then it will be accessible.In order to read and write XML files using this class, you need to use serialization.