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

Recommended Answers

All 4 Replies

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.