XML: child and parent with the same name

In valid XML, is it possible to have children with the same name as their parent? For instance:

<parent>
    <child>
    </child>
    <parent>
    </parent>
</parent>

Thank.

+5
source share
2 answers

There is nothing but a special DTD or XSD that would prevent this.

+7
source

Yes, this is even true (sometimes) in XHTML. for example, XHTML is acceptable (inside the body of the page):

<div>
  <div>
  </div>
</div>
+2
source

All Articles