Are elements allowed to nest within themselves?

Chris von See cvonsee at
Wed Sep 9 21:51:49 BST 1998

The XML 1.0 spec is unclear (unless I missed the reference) on whether or
not an element can nest within itself.  For example, let's say I define a
DTD with:

<!ELEMENT foo ( foo*, bar* )>


and a document with: 

<!-- top-level "foo" element -->
     <!-- first nested "foo" element -->
     <foo answer="yes">
          <bar>this one</bar>
          <bar>that one</bar>
     <!-- second nested "foo" element -->
     <foo answer="no">
          <bar>the other one</bar>
     <!-- third nested "foo" element (empty) -->

Is this legal?


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as:
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list