Where does xsd:attribute declaration go in global xsd:complexType?

后端 未结 1 790
眼角桃花
眼角桃花 2021-01-21 14:37

I want to declare an attribute of an element already defined. I would like that the element person could have 2 attributes (name, id) I ha

相关标签:
1条回答
  • 2021-01-21 15:08

    Attribute declarations go after xs:sequence:

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="person" type="perso" />
      <xs:complexType name="perso">
        <xs:sequence>
          <xs:element name="description" type="xs:string" />
        </xs:sequence>
        <xs:attribute name="name" type="xs:string"/>
        <xs:attribute name="id" type="xs:string"/>
      </xs:complexType>
    </xs:schema>
    
    0 讨论(0)
提交回复
热议问题