我有以下 XML 文件:
<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>
以及它的 XSD 定义:
<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>
我想创建以下基于 XML 和 XSD 的 XML 文件:
<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>
使用 .NET 平台最简单的方法是什么?是否可以使用 XSLT 转换?