XML : how to generate xsd for element with an attribute and sequence of child elements

This is sample xml code

  <Address>          <StreetAddress></StreetAddress>          <OtherDestination />          <City>TORONTO</City>    </Address>    

This is currently using xsd

  <xs:element name="Address" nillable="true">      <xs:complexType>          <xs:sequence minOccurs="0">              <xs:element ref="StreetAddress" minOccurs="0"/>              <xs:element ref="OtherDestination" minOccurs="0"/>              <xs:element ref="City" minOccurs="0"/>          </xs:sequence>      </xs:complexType>  </xs:element>    

i want to add an attribute("id") to Address element like this..

  <Address id="first">          <StreetAddress></StreetAddress>          <OtherDestination />          <City>TORONTO</City>    </Address>    

How should i change the existing xsd to full fill my requirement? Thanks.

No comments:

Post a Comment