Are elements allowed to nest within themselves?

Chris von See cvonsee at onramp.net
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* )>
<!ATTLIST foo answer CDATA #IMPLIED>

<!ELEMENT bar (#PCDATA)>

and a document with: 

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

Is this legal?


Chris


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




More information about the Xml-dev mailing list