XML bad format?

How about this format?

<name>cData1
<category>cData2
<name>cData3</name>
</category>
</name>

I’ve been asked to include this as a test case in an assignment. What do you think?

Hi gavincangan, welcome to the forums

I suppose a lot depends on what Data1, Data2, and Data3 are.

But I don’t like the way it’s nested at all and I think reusing the “name” tag is an unwise choice.

I do understand that the formatting looks bad. But I’ve been asked to take this test case into consideration! So I’ll have to handle it anyway
I was just wondering if there was any grammar in XML which prohibited using same tag name in different levels

I have seen a lot of XML that uses the same tag names. But they have different namespaces so they aren’t really the same name.
eg.
<a:name>whatever</a:name>
<b:name>whosit</b:name>
etc.

The trouble with the format of your example is that XML is used for transporting data. If someone parses the file for “name” they should be able to get what they want as specifically and as easily as possible. Not knowing which level “name” is at is neither.