tags:

views:

323

answers:

1

I have a method:

public static DataSet getTable()
{
    DataSet DS = new DataSet("My Set");
    DS.ReadXml(getCategories());
    return DS;
}

My getCategories() returns a stream containing my XML.

But when I run this, I get this error: The supplied xml instance is a schema or contains an inline schema. This class cannot infer a schema for a schema.

So I'm not sure what to do.

My goal is to use the call to getTable() to populate a DataList.

I've tried using the DataTable and I get a different, but similar error.

Any help would be great.

Thanks.

Here is my XML file. Might help. Thanks.

<?xml version="1.0" encoding="utf-8"?>
<WSPackage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"&gt;
  <ResponseInteger>0</ResponseInteger>
  <ResponseBoolean>false</ResponseBoolean>
  <ResponseDataset>
    <xs:schema id="CategoryDS" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
      <xs:element name="CategoryDS" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">

            <xs:element name="Category">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="PartCategories" type="xs:string" minOccurs="0" />
                  <xs:element name="CategoryDescriptions" type="xs:string" minOccurs="0" />
                  <xs:element name="CategoryImageURLs" type="xs:string" minOccurs="0" />
                  <xs:element name="CategoryModelFlags" type="xs:string" minOccurs="0" />
                </xs:sequence>
              </xs:complexType>

            </xs:element>
          </xs:choice>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
      <CategoryDS xmlns="">
        <Category diffgr:id="Category1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
          <PartCategories>TESTCAT</PartCategories>

          <CategoryDescriptions>TESTING API</CategoryDescriptions>
          <CategoryImageURLs />
          <CategoryModelFlags />
        </Category>
      </CategoryDS>
    </diffgr:diffgram>
  </ResponseDataset>
  <ErrorMessage />

  <UserMessage />
</WSPackage>
A: 

It is related to the fact that you have the following xml in there.. If you take that out it should work. it is not going to create a schema for something that already exists.

        <xs:element name="Category">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="PartCategories" type="xs:string" minOccurs="0" />
              <xs:element name="CategoryDescriptions" type="xs:string" minOccurs="0" />
              <xs:element name="CategoryImageURLs" type="xs:string" minOccurs="0" />
              <xs:element name="CategoryModelFlags" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>

        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

t

htkhtk
htkhtk, so you're saying that the webservice where I'm getting this xml file is producing it improperly and that's why I can't make this work? It would make sense, I'm not overly impressed with them at all.
Kevin Korb