How to add the same attribute multiple times to an Element Tag in XML

后端 未结 1 613
轻奢々
轻奢々 2020-12-19 01:45

In an XML Schema (XSD) I am writing, I need to define an attribute which can occur multiple times inside its parent element.

Just to clear it with an example : the p

相关标签:
1条回答
  • 2020-12-19 02:12

    You can't. Attribute names are unique per element.

    If you need to have multiple bits of data under the same name, then the usual solutions are either a space separated list or child elements.

    <event department="foo bar baz" />
    

    or

    <event>
        <department>foo</department>
        <department>bar</department>
        <department>baz</department>
    </event>
    
    0 讨论(0)
提交回复
热议问题