How can I define an XSD file that allows unknown (wildcard) elements?

What you want is a wildcard particle, for details see http://www.w3.org/TR/xmlschema-1/#Wildcards

To do it you can use xs:any. Note that xs:element and xs:any cannot be placed directly inside an xs:complexType. You need a container like a xs:sequence or xs:choice.

A valid schema that handles wildcards is below:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  
  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="service" type="xs:string"/>
        <xs:element name="resource" type="xs:string"/>
        <xs:element name="action" type="xs:string"/>
        <xs:element name="parameters">
          <xs:complexType>
            <xs:sequence maxOccurs="unbounded">
              <xs:any processContents="lax"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
</xs:schema>

Try this:

<xs:element name="parameters">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:any processContents="lax"></xs:any>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

Tags:

Xml

Xsd