Names of attributes should be unique per XML Element in xml document, isn't it?
<tag is_such_attr_is_valid="value1" is_such_attr_is_valid="value2"> </tag>
p.s. I'm interesting not how to add this constraint in validation schema (DTD, XSD). But I'm interesting in is it such case lead to well-formed xml document itself, if talking strictly.
Yes. You can't have two XML attributes with the same expanded name in one element (see references: 1, 2). So the XML sample you posted is clearly not allowed.
Even if the two attributes were given different prefixes, as long as the prefixes are bound to the same uri, it is still not allowed. Contrasts the <bad> elements against the <good> one in the example below (adapted from the linked reference above and expanded to show good alternatives) :
<!-- http://www.w3.org is bound to foo and bar -->
<x xmlns:foo="http://www.w3.org"
xmlns:bar="http://www.w3.org" >
<bad a="1" a="2" />
<bad foo:a="1" bar:a="2" />
<good a="1 2"/>
<good>
<a>1</a>
<a>2</a>
</good>
<good a="1" b="2" />
</x>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With