I have this XSD to validate incoming requests to my api:
<?xml version="1.0"?>
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="request">
<xs:complexType>
<xs:sequence>
<xs:element name="amenity">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
But it seems kind of cluttered. Too many nested elements etc. Is it possible to rewrite it in a simpler, less confusing way?
If you don’t want it so deeply nested, you can change the complex types to be named types and then refer to them by name from the element declarations. That has benefits in that the types can then be reused. But it won’t make this simple schema any simpler…