Circular Reference Problem
I have a file (it's an xml file but that doesn't matter) that contains records with several fields. The two important fields are "name" and "extends". "name" is the name of the record and "extends" is the name of another record in the file. This structure allows chains of records to be created (like a linked list). Here is an example:
(record 1) name: A extends: B
(record 2) name: B extends: C
(record 3) name: C extends: D
(record 4) name: D extends: (blank)
In my program the user can change or add "extends" values and I want to prevent circular references. For example a new extends value of "E" for record 4 would be Ok, but "A", "B", "C" or "D" would not be. I have a routine that finds the circular reference error if "B", "C" or "D" are entered, but it doesn't work for "A". Any ideas?