1
我的任務是替換特定解決方案的xsd。但是,我不斷收到一個「元素在這種情況下不受支持」。用新的替換舊的XSD
這裏原來的xsd:
public const string Xsd = @"
<xs:schema attributeFormDefault='unqualified' elementFormDefault='qualified' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name='DataRow'>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs='unbounded' name='Data'>
<xs:complexType>
<xs:attribute name='Site' type='xs:string' use='required' />
<xs:attribute name='Month_Num' type='xs:unsignedShort' use='required' />
<xs:attribute name='Numerator' type='xs:unsignedByte' use='required' />
<xs:attribute name='Data_Indicator' type='xs:string' use='required' />
<xs:attribute name='Budgeted' type='xs:unsignedByte' use='required' />
<xs:attribute name='Executive_Comments' type='xs:string' use='required' />
<xs:attribute name='Fleet_Executive_Comments' type='xs:string' use='required' />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>";
這是我應該與被替換它的內容:
<xs:schema attributeFormDefault='unqualified' elementFormDefault='qualified' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<MonthlyValues>
<MonthlyValue IndicatorName='name' LocationName='name' GroupingName='name' Year='MonthNum.Value.Year' Month='MonthNum.Value.Month' Numerator='Numerator' Budget='Budget'>
</MonthlyValue>
</MonthlyValues>
</xs:schema>
該架構是由別人做,我本來只是能夠取代它。不幸的是,它沒有這樣做,我對此知之甚少。
我應該改變
<MonthlyValues>
到
<xs:element name='MonthlyValues> and keep the
<xs:sequence>
<xs:element maxOccurs='unbounded' name='MonthlyValues'>
<xs:complexType>
,並添加
<MonthlyValue IndicatorName='name' LocationName='name' GroupingName='name' Year='MonthNum.Value.Year' Month='MonthNum.Value.Month' Numerator='Numerator' Budget='Budget'>
</MonthlyValue>
之後?其實,我試過了,它不起作用,但有什麼類似的我必須做的?
加爾達感謝您的幫助。我比我想象的更接近。至少我是在正確的軌道上! – 2012-07-27 18:47:06