XSD file with multiple namespaces

I have been trying to import SharePoint XML data into database and I cannot seem to figure out the proper XSD file. The generators don’t seem to do it correctly. The namespaces seem to mess up the results.

A sample of the XML file (note that this format cannot be changed):

<rs:data xmlns:rs="http://www.w3.org/2001/XMLSchema">
    <z:row ID="1" ProductName="Widget" xmlns:z="#RowsetSchema"/>
    <z:row ID="2" ProductName="Widget" xmlns:z="#RowsetSchema"/>
</rs:data>

XSD (one attempt):

<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:ns1="urn:#RowsetSchema"
targetNamespace="urn:#RowsetSchema" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"
    >

  <xs:element name="data">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="unbounded" name="row">
          <xs:complexType>
            <xs:attribute name="ID" type="xs:unsignedByte" use="required" />
            <xs:attribute name="ProductName" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


Source: xml

Leave a Reply