日期:2014-05-20  浏览次数:20710 次

xml schema生成dataset时,遇到"The same table cannot be the child table in two nested relations"问题
如题。
我自己设计的xml schema.我根据这个xsd 文件生成了一个dataset 类(Entry)。 
我在web service中声明了一个web method, 将这个dataset类作为返回值。当我尝试运行这个web service的时候,出现了exception: The same table 'XXX' cannot be the child table in two nested relations.
然后我回去看自己的schema 设计,使用xml编辑器察看,没觉得有重复的命名; 使用dataset编辑器察看,发现特别多的relation 在图中,我根本无从知道什么引起了这个错误。这究竟是什么原因呢?

另我使用的vs2008.

我的schema大概是这个样子:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema >
   
  <xs:element name="CatalogEntry" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="MyEntry" msprop:Generator_DataSetName="MyEntry">
  <xs:complexType>
  <xs:sequence>
  <xs:element name="GeneralProperty">
  <xs:complexType>
  <xs:sequence>  
  <xs:element name="Formation" type="xs:string">
  </xs:element>
  <xs:element name="Depth" type="xs:string">
  </xs:element>
  <xs:element name="Age" type="xs:string">
  </xs:element>  
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  <xs:element name="Mercury">
  <xs:complexType>
  <xs:sequence>
  <xs:element name="Porosity" type="ctDoubleMeasure" />
  <xs:element name="Permeability" type="ctDoubleMeasure" />
  <xs:element name="Data" type="ctMercuryData" />  
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  <xs:element name="ABCT1Saturation" type="ABCMeasurement" />
  <xs:element name="ABCT2-1Saturation" type="ABCMeasurement" />
  <xs:element name="ABCT2-2Saturation" type="ABCMeasurement" />
  <xs:element name="ABCT2-3Saturation" type="ABCMeasurement" />  
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  <xs:complexType name="ctDoubleMeasure">
  <xs:sequence>
  <xs:element name="Value" type="xs:double" />
  <xs:element name="Unit" type="xs:string" />
  </xs:sequence>
  </xs:complexType>
  <xs:complexType name="ctMercuryData">
  <xs:sequence>
  <xs:element name="Pressure" type="xs:double" />
  <xs:element name="Function" type="xs:double" />
  </xs:sequence>
  </xs:complexType>
  <xs:complexType name="ABCMeasurement">
  <xs:sequence>  
  <xs:element name="SaturationCondition" type="ctDoubleMeasure" />  
  <xs:element name="CoreAnalysisPermeability" type="ctDoubleMeasure" />
  <xs:element name="CoreAnalysisPorosity" type="ctDoubleMeasure" />  
  <xs:choice>
  <xs:element name="T1m1" type="ctDoubleMeasure" />