R
Rehan Mubarak
Guest
hi
Could you please tell me how can I generate xml file in C# from multiple xsd file ? Below is the format of my two xsd files . and I also I need to make sure that the xml generated gets validated with the xsd .
EmployeeDetailsEvent.xsd
<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://xmlns.geg.com/api/Gegroup/EmployeeDetailsEvent/1.0" xmlns:xs="XML Schema" xmlns:tns="http://xmlns.geg.com/api/Gegroup/EmployeeDetailsEvent/1.0" xmlns:EmployeeDetails="http://xmlns.geg.com/Gegroup/EmployeeDetails/1.0">
<xs:import schemaLocation="/home/GEgroup/Asia/ge/schema/.EmployeeDetails.0.xsd" namespace="http://xmlns.geg.com/Gegroup/EmployeeDetails/1.0"/>
-<xs:element name="EmployeeDetailsEvent">
-<xs:complexType>
-<xs:sequence>
-<xs:element name="EmployeeDetails">
-<xs:complexType>
-<xs:sequence>
<xs:element name="EmployeeDetails" maxOccurs="unbounded" minOccurs="1" type="EmployeeDetails:EmployeeDetailsType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
EmployeeDetails.xsd
<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://xmlns.geg.com/Gegroup/EmployeeDetails/1.0" xmlns="http://xmlns.geg.com/Gegroup/EmployeeDetails/1.0" xmlns:xs="XML Schema">
<xs:element type="EmployeeDetailsType" name="EmployeeDetails"/>
-<xs:complexType name="EmployeeDetailsType">
-<xs:sequence>
<xs:element type="KeyType" name="EmployeIdId" maxOccurs="1" minOccurs="1"/>
<xs:element type="xs:date" name="JoiningDate" minOccurs="0"/>
<xs:element type="EmployeeBrochureListType" name="brochures" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
-<xs:complexType name="KeyType">
<xs:attribute type="xs:string" name="DepartmentOwner" use="required"> </xs:attribute>
<xs:attribute type="xs:string" name="Department" use="required"> </xs:attribute>
<xs:attribute type="xs:string" name="Id" use="required"> </xs:attribute>
</xs:complexType>
-<xs:complexType name="EmployeeBrochureListType">
-<xs:sequence>
<xs:element type="EmployeeBrochureType" name="brochure" maxOccurs="unbounded" minOccurs="1"/>
</xs:sequence>
</xs:complexType>
-<xs:complexType name="EmployeeBrochureType">
-<xs:sequence>
-<xs:element type="xs:string" name="code" maxOccurs="1" minOccurs="1">
-<xs:annotation>
<xs:documentation>employee code</xs:documentation>
</xs:annotation>
</xs:element>
-<xs:element type="xs:date" name="orderDate" maxOccurs="1" minOccurs="0">
-<xs:annotation>
<xs:documentation>Sample documentation.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
Continue reading...
Could you please tell me how can I generate xml file in C# from multiple xsd file ? Below is the format of my two xsd files . and I also I need to make sure that the xml generated gets validated with the xsd .
EmployeeDetailsEvent.xsd
<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://xmlns.geg.com/api/Gegroup/EmployeeDetailsEvent/1.0" xmlns:xs="XML Schema" xmlns:tns="http://xmlns.geg.com/api/Gegroup/EmployeeDetailsEvent/1.0" xmlns:EmployeeDetails="http://xmlns.geg.com/Gegroup/EmployeeDetails/1.0">
<xs:import schemaLocation="/home/GEgroup/Asia/ge/schema/.EmployeeDetails.0.xsd" namespace="http://xmlns.geg.com/Gegroup/EmployeeDetails/1.0"/>
-<xs:element name="EmployeeDetailsEvent">
-<xs:complexType>
-<xs:sequence>
-<xs:element name="EmployeeDetails">
-<xs:complexType>
-<xs:sequence>
<xs:element name="EmployeeDetails" maxOccurs="unbounded" minOccurs="1" type="EmployeeDetails:EmployeeDetailsType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
EmployeeDetails.xsd
<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://xmlns.geg.com/Gegroup/EmployeeDetails/1.0" xmlns="http://xmlns.geg.com/Gegroup/EmployeeDetails/1.0" xmlns:xs="XML Schema">
<xs:element type="EmployeeDetailsType" name="EmployeeDetails"/>
-<xs:complexType name="EmployeeDetailsType">
-<xs:sequence>
<xs:element type="KeyType" name="EmployeIdId" maxOccurs="1" minOccurs="1"/>
<xs:element type="xs:date" name="JoiningDate" minOccurs="0"/>
<xs:element type="EmployeeBrochureListType" name="brochures" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
-<xs:complexType name="KeyType">
<xs:attribute type="xs:string" name="DepartmentOwner" use="required"> </xs:attribute>
<xs:attribute type="xs:string" name="Department" use="required"> </xs:attribute>
<xs:attribute type="xs:string" name="Id" use="required"> </xs:attribute>
</xs:complexType>
-<xs:complexType name="EmployeeBrochureListType">
-<xs:sequence>
<xs:element type="EmployeeBrochureType" name="brochure" maxOccurs="unbounded" minOccurs="1"/>
</xs:sequence>
</xs:complexType>
-<xs:complexType name="EmployeeBrochureType">
-<xs:sequence>
-<xs:element type="xs:string" name="code" maxOccurs="1" minOccurs="1">
-<xs:annotation>
<xs:documentation>employee code</xs:documentation>
</xs:annotation>
</xs:element>
-<xs:element type="xs:date" name="orderDate" maxOccurs="1" minOccurs="0">
-<xs:annotation>
<xs:documentation>Sample documentation.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
Continue reading...