我有如下的XML
<ACS:Instrument>
<ACS:AsOfDate>2016-03-07T00:00:00Z</ACS:AsOfDate>
<ACS:InstrumentID>12345</ACS:InstrumentID>
<ACS:DenominatedCurrency>USD</ACS:DenominatedCurrency>
<ACS:InstrumentName>INDUSTRY</ACS:InstrumentName>
</ACS:Instrument>
我想为这个XML创建一个XSD复杂元素。
答案 0 :(得分:1)
<?xml version="1.0" encoding="UTF-8"?>
<ACS:Instrument xmlns:ACS="http://www.example.com/ACS">
<ACS:AsOfDate>2016-03-07T00:00:00Z</ACS:AsOfDate>
<ACS:InstrumentID>12345</ACS:InstrumentID>
<ACS:DenominatedCurrency>USD</ACS:DenominatedCurrency>
<ACS:InstrumentName>INDUSTRY</ACS:InstrumentName>
</ACS:Instrument>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://www.example.com/ACS"
xmlns:ACS="http://www.example.com/ACS">
<xs:element name="Instrument">
<xs:complexType>
<xs:sequence>
<xs:element name="AsOfDate" type="xs:dateTime"/>
<xs:element name="InstrumentID" type="xs:integer"/>
<xs:element name="DenominatedCurrency" type="xs:string"/>
<xs:element name="InstrumentName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>