Hello,
I have the below xml & xsd files and need to upload the data to sql server.
Can anyone help to how can I acheive this using asp.net. I have followed several articles & all of them are using simple xml file not like the one below.
xsd is only for table creation and how to insert this xml data to database?
XSD FILE CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:tns="http://www.tous.com/customers"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.tous.com/customers">
<xsd:element name="customers" type="tns:customers">
<xsd:annotation>
<xsd:documentation>Root element</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:complexType name="customers" id="customers">
<xsd:sequence>
<xsd:element name="customer" type="tns:customer"
maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="customer" id="customer">
<xsd:sequence>
<xsd:element name="store" type="xsd:string">
<xsd:annotation>
<xsd:documentation>store (4 characters)</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="code" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Client code</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="name" type="xsd:string">
<xsd:annotation>
<xsd:documentation>Customer Name</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="street" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>street</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="postalCode" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Postal code</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="town" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Town</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="country" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Country code (ES,PT,..)</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="region" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Region</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="language" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>language</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="phone" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>phone</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="email" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>email</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="indexTypeDocumentID" type="xsd:integer" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
NULL
1 - DNI/NIE
2 - Passport
3 - CIF
5 - Doc. Id. extranjero
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="typeDocumentID" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Tyep document ID</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="nif" type="xsd:string">
<xsd:annotation>
<xsd:documentation>NIF</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="nifCommunity" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Nif community</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="society" type="xsd:integer">
<xsd:annotation>
<xsd:documentation>society</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="employee" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>Employee</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="gender" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Gender</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="purpose" type="xsd:integer">
<xsd:annotation>
<xsd:documentation>
1 . Credit
2 . Invoice
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
XML FILE CONTENT
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
-<ns2:customers xmlns:ns2="http://www.tous.com/customers">
-<customer>
<store>0020</store>
<code>6661207</code>
<name>MUÑOZ VERA, RAUL</name>
<street>CARRER SANT JOSEP, 53 2N 2ª </street>
<postalCode>08242</postalCode>
<town>MANRESA</town>
<country>ES</country>
<region/>
<language>ES</language>
<phone>659712887</phone>
<email>rmunoz@raulmuve.cat</email>
<typeDocumentID/>
<nif>39374240B</nif>
<nifCommunity/>
<society>38</society>
<employee>true</employee>
<gender>M</gender>
<purpose>2</purpose>
</customer>
-<customer>
<store>0020</store>
<code>6661207</code>
<name>MUÑOZ VERA, RAUL</name>
<street>CARRER SANT JOSEP, 53 2N 2ª </street>
<postalCode>08242</postalCode>
<town>MANRESA</town>
<country>ES</country>
<region/>
<language>ES</language>
<phone>659712887</phone>
<email>rmunoz@raulmuve.cat</email>
<typeDocumentID/>
<nif>39374240B</nif>
<nifCommunity/>
<society>38</society>
<employee>true</employee>
<gender>M</gender>
<purpose>2</purpose>
</customer>
-<customer>
<store>0020</store>
<code>6661207</code>
<name>MUÑOZ VERA, RAUL</name>
<street>CARRER SANT JOSEP, 53 2N 2ª </street>
<postalCode>08242</postalCode>
<town>MANRESA</town>
<country>ES</country>
<region/>
<language>ES</language>
<phone>659712887</phone>
<email>rmunoz@raulmuve.cat</email>
<typeDocumentID/>
<nif>39374240B</nif>
<nifCommunity/>
<society>38</society>
<employee>true</employee>
<gender>M</gender>
<purpose>2</purpose>
</customer>
-<customer>
<store>0020</store>
<code>6661207</code>
<name>MUÑOZ VERA, RAUL</name>
<street>CARRER SANT JOSEP, 53 2N 2ª </street>
<postalCode>08242</postalCode>
<town>MANRESA</town>
<country>ES</country>
<region/>
<language>ES</language>
<phone>659712887</phone>
<email>rmunoz@raulmuve.cat</email>
<typeDocumentID/>
<nif>39374240B</nif>
<nifCommunity/>
<society>38</society>
<employee>true</employee>
<gender>M</gender>
<purpose>2</purpose>
</customer>
-<customer>
<store>0020</store>
<code/>
<name>Raul Muñoz</name>
<street>Calle La Pau</street>
<postalCode>08242</postalCode>
<town>Manresa</town>
<country/>
<region/>
<language>ES</language>
<phone>0</phone>
<email/>
<typeDocumentID/>
<nif>39374240B</nif>
<nifCommunity/>
<society>38</society>
<employee>false</employee>
<gender/>
<purpose>2</purpose>
</customer>
-<customer>
<store>0020</store>
<code>6661207</code>
<name>MUÑOZ VERA, RAUL</name>
<street>CRER SANT JOSEP 53 P02 2</street>
<postalCode>08242</postalCode>
<town>MANRESA</town>
<country>ES</country>
<region>08</region>
<language>ES</language>
<phone>659712887</phone>
<email>rmunoz@raulmuve.cat</email>
<indexTypeDocumentID>1</indexTypeDocumentID>
<typeDocumentID>DNI/NIE</typeDocumentID>
<nif>39374240B</nif>
<nifCommunity>ES39374240B</nifCommunity>
<society>38</society>
<employee>true</employee>
<gender>M</gender>
<purpose>1</purpose>
</customer>
</ns2:customers>
Thanks