Architecting and designing : XML schema design : The XML diagram : Importing/exporting schemas : Importing recursive relationships
  
Importing recursive relationships
A check for recursive relationships is applied during the import of DTDs. If, for example, the user imports the following DTD:
<!ELEMENT ele1 (ele2,ele3) >
<!ELEMENT ele2 EMPTY>
<!ELEMENT ele3 (ele1) >
<!ELEMENT ele5 EMPTY >
The system will determine that ele5 is a root because there are no other references to this Element., however the Elements ele1, ele2, and ele3 will not be imported because no valid root element can be determined because of the recursive relation from ele3 to ele1 and ele1 to ele3. When the system detects this situation the following message box will be displayed to warn the user:
The user has two choices in this situation, the first would be to add another Element to the DTD that contains a reference to ele1, ele0 in the following sample would accomplish this and create a valid root node.
<!ELEMENT ele0 (ele1) >
<!ELEMENT ele1 (ele2,ele3) >
<!ELEMENT ele2 EMPTY>
<!ELEMENT ele3 (ele1) >
<!ELEMENT ele5 EMPTY >
The second option is to remove the recursive reference, either from ele1 or ele3 depending which element is supposed to be the root. For example, removing the reference to ele1 from the content model of ele3 will cause ele1 to become the root.
<!ELEMENT ele1 (ele2,ele3) >
<!ELEMENT ele2 EMPTY>
<!ELEMENT ele3 EMPTY >
<!ELEMENT ele5 EMPTY >
See also
Importing/exporting schemas