<p>I have a xml file like this:</p>

<pre><code>&lt;customer&gt;
  &lt;field1 /&gt;
  &lt;field2 /&gt;
  &lt;field3&gt;
    &lt;item1 /&gt;
  &lt;/field3&gt;
  &lt;field3&gt;
    &lt;item1 /&gt;
  &lt;/field3&gt;
&lt;/customer&gt;
</code></pre>

<p>field* can appear in any order and only field3 can appear more than once.</p>

<p>How can I create a XSD file to validate this?</p>

<p>Thank you!</p>

Try this
I'm not a guru, but this appears to work.
```
```
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="customer" type="customerType"/>
  <xs:complexType name="customerType">
    <xs:sequence>
      <xs:element name="field1" minOccurs="1" maxOccurs="1">
      </xs:element>
      <xs:element name="field2" minOccurs="1" maxOccurs="1">
      </xs:element>
      <xs:element name="field3" type="field3Type"
                  minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="field3Type">
    <xs:sequence>
      <xs:element name="item1">
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>
```
```
tools
I used
XML Copy Editor
, but there are loads of editors which will validate XML.
links
You might also be interested in
this article
about generating an XSD from an XML file.