I am new to .xml/.xsd world and I must say I am having a hard here, even though the task I want to do sounds quite simple to me !
I am currently retrieving datas from an API into Excel and I'd like to make an xml file out of it using first rows has headers -> name of the element and the following rows for the datas themselves.
Using the tools provided by Excel to import a .xsd schema and then being able to export the datas into .xml file, I get stuck in preparing correctly the .xsd file.
Problem : I'd like to have several layers in my .xml file and it looks difficult to do (for a reason I don't understand). Something like :
<element1>
<subelement1>
<subelement2>
<subelement3>
<element2>
<element3>
etc.
And here's my current .xsd file :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Offers">
<xs:complexType>
<xs:sequence>
<xs:element ref="offer" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="offer">
<xs:complexType>
<xs:sequence>
<xs:element name="code" type="xs:string"/>
<xs:element name="bathroom_count" type="xs:string"/>
<xs:element name="bedroom_count" type="xs:string"/>
<xs:element name="average_rating" type="xs:string"/>
<xs:element name="title" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="content_language" type="xs:string"/>
<xs:element name="main_photo" maxOccurs="unbounded"/>
<xs:complexType>
<xs:sequence>
<xs:element name="lalala" type="xs:string"/>
<xs:element name="slip" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:element>
</xs:schema>
I've read a tons of help about it, and I generally find a solution before asking on forums but I'm pretty stuck here. It seems to me this structure is perfect but it still doesn't work. :( Everytime I try to import it in Excel it gives me an error and the error for this layout is
Description /schema/element[1][@name = 'Offers']/element[1][@name = 'offer'] Element 'xs:element' is not allowed in this context.
I don't get it as I've read that ComplexType is needed in between to use element as the child of another element.