Hello all,

I'm a bit confused because I don't know how to solve next problem. I'm receiving a XML from a WebService and I want to insert it into an Excel Sheet.

This is the XML returned from the WebService:

<DataSet xmlns="http://tempuri.org/">
<xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="NewDataSet">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="provinces">
<xs:complexType>
<xs:sequence>
<xs:element name="C_PROVINCE" type="xs:int"/>
<xs:element name="PROVINCE" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ZONE" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MATR" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="5"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//provinces"/>
<xs:field xpath="C_PROVINCE"/>
</xs:unique>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<provinces diffgr:id="provinces1" msdata:rowOrder="0">
<C_PROVINCE>1</C_PROVINCE>
<PROVINCE>ÁLAVA</PROVINCE>
<MATR>VI</MATR>
</provinces>
<provinces diffgr:id="provinces2" msdata:rowOrder="1">
<C_PROVINCE>47</C_PROVINCE>
<PROVINCE>VALLADOLID</PROVINCE>
<ZONE>CyL</ZONE>
<MATR>VA</MATR>
</provinces>
</NewDataSet>
</diffgr:diffgram>
</DataSet>

And the code I'm using to insert it into the sheet is:
Dim oFullNodeList As MSXML2.IXMLDOMNodeList

' Web Service call
Set oFullNodeList = clsWS2.wsm_Import(LogIn.tbUser, LogIn.tbPasswd, ActiveSheet.Name, ActiveSheet.Cells(7, 1), PrimColIndice)


'Delete all previous xmlMaps
Dim xmlMap1 As Excel.XmlMap
For Each xmlMap1 In ActiveWorkbook.XmlMaps
xmlMap1.Delete
Next


' Add the Schema coming with the Web Service response as a XmlMap
ActiveWorkbook.XmlMaps.Add(oFullNodeList.Item(0).XML)


' Import data coming from the Web Service using the Schema also provided from the Web Service response
' -------- NEXT LINE RAISES AN EXCEL WARNING
ActiveWorkbook.XmlImportXml(oFullNodeList.Item(1).XML, ActiveWorkbook.XmlMaps(1), True, Range("$A$7"))

The message I got is "The specified XML source does not refer to a schema. Excel will create a schema based on the XML source data"


I have not idea how to solve it!!

Thanks in advance for your help!!!