foo.xml があります。VisualStudio->Xml->CreateSchema で生成されるので、foo.xsd を生成したいと思います。xsd.exe を試してみましたが、結果は同じではありません。( xsd.exe foo.xml
)
コマンドラインから VisualStudio->Xml->CreateSchema と同じコマンドを呼び出す方法は?
1 つの小さな例が役立つかもしれませんが、type="xs:string" minOccurs="0"
xml がより複雑になると、違いが大きくなることに注意してください。
xml:
<foo>
<x />
<y />
</foo>
VS:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element name="x" />
<xs:element name="y" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
xsd.exe
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element name="x" type="xs:string" minOccurs="0" />
<xs:element name="y" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="foo" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>