I use this rule of thumb:
- An Attribute is something that is self-contained, i.e., a color, an ID, a name.
- An Element is something that does or could have attributes of its own or contain other elements.
So yours is close. I would have done something like:
EDIT: Updated the original example based on feedback below.
<ITEM serialNumber="something">
<BARCODE encoding="Code39">something</BARCODE>
<LOCATION>XYX</LOCATION>
<TYPE modelNumber="something">
<VENDOR>YYZ</VENDOR>
</TYPE>
</ITEM>