Combine XML and XSD files

remzi23

New Member
I have following XML file:\[code\]<my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-05-05T12:20:38"> <my:Text1></my:Text1> <my:Group> <my:Text2></my:Text2> </my:Group></my:myFields>\[/code\]And XSD definition for it:\[code\]<xsd:schema targetNamespace="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-05-05T12:20:38" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-05-05T12:20:38" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="myFields"> <xsd:complexType> <xsd:sequence> <xsd:element ref="my:Text1" minOccurs="0"/> <xsd:element ref="my:Group" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> <xsd:anyAttribute processContents="lax" namespace="http://www.w3.org/XML/1998/namespace"/> </xsd:complexType> </xsd:element> <xsd:element name="Text1" type="xsd:string"/> <xsd:element name="Group"> <xsd:complexType> <xsd:sequence> <xsd:element ref="my:Text2" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <xsd:element name="Text2" type="xsd:string"/> </xsd:element></xsd:schema>\[/code\]I would like to create following XML file which is based on the XML and XSD:\[code\]<my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-05-05T12:20:38"> <my:Text1 type="string" minOccurs="0"></my:Text1> <my:Group minOccurs="0" maxOccurs="unbounded"> <my:Text2 type="string" minOccurs="0"></my:Text2> </my:Group></my:myFields>\[/code\]What is the easiest way to do that with .NET platform? Is it possible using XSLT transformation?
 
Back
Top