Having an XML document like this:
<Fathers>
<Father ID="1">
<Name>Homer</Name>
<Sons>
<Son ID="1">
<Name>Bart</Name>
</Son>
</Sons>
</Father>
</Fathers>
Is it valid to have the same attribute name ID
in different nested tags?
Also, is it valid to have duplicate ID
values?
ID attribute values must be unique in an XML document:
Values of type ID must match the Name production. A name must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them.
Regarding your other question, yes, it is ok to have the same attribute names, even ID
, among nested elements.