hi
how do i create a list contaiing one or more customers from the below xml

<?xml version="1.0" encoding="UTF-8"?>
<customers>
<customer>
<first>string</first>
<last>string</last>
</customer>
<customer>
<first>string</first>
<last>string</last>
</customer>
<customer>
<first>string</first>
<last>string</last>
</customer>
</customers>

i am new to writing xsd schemas,

appreciate a reply
thanks

I'm not sure why you write them manually. If you have Visual Studio, you have xsd.exe which will generate them for you.

hi pritaeas

is this a correct XSD for the above code

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="customers">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="customer" maxOccurs="unbounded" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element type="xs:string" name="first"/>
              <xs:element type="xs:string" name="last"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

and also which tag defined the list of customer: for example how do i know whether this is a xsd for a one or more Custres?

appreciate a reply
thank you

and also for the name there should be 2 parts which is firstname and lastname, have i defined it correctly in the XSD above?

This article has been dead for over six months. Start a new discussion instead.