Hi Folks, Below are three ways of organizing data for searching. I have seen all three ways in a project that I am working. The first way is how text data was organized in the 1970s. The second way is how data is organized by a database-oriented
shop. The third way is the XML way. The first way embeds codes in the records. Searching involves using the codes to narrow the search. Below is an example that uses these codes: Type = B (Book), Subtype = C (Computer), Type = W (Watch), Subtype = Q (Quartz), Type = A (Author),
Subtype = P (Professor), Type = E (battEry), Subtype = L (Lithium).
<Records> Suppose we want to search for the computer book written by Shriram Krishnamurti and then find his employer. To find the computer book, search for the record with Type = B (Book), Subtype = C (Computer) and the author field containing Shriram
Krishnamurti. That yields the first record shown above. Then use its second set of Type/Subtype fields (Type = A, Subtype = P) to locate the record about the author. That yields the third record, which shows that he is a professor at Brown University. The second way is to use multiple documents – a document containing book data, a document containing author data, a document containing watch data, a document containing battery data – and use primary/foreign keys to connect the documents
together. Here are the four documents: Books.xml
<Books> Authors.xml
<Authors> Watches.xml
<Watches> Batteries.xml
<Batteries> Again, suppose we want to search for the computer book written by Shriram Krishnamurti and find his employer. To find the computer book, search Books.xml for the record with the author field containing Shriram Krishnamurti. Use its foreign
key to reference a record in Authors.xml. The third way is to use the ID-IDREF capability of XML.
<BooksAndWatches> To find the computer book written by Shriram Krishnamurti we search for the Book element with Author = Shriram Krishnamurti. To find his employer follow the idref value on the Author element. TaDa! Three different ways to organize data: the old (1970s) way, the database way, and the XML way. /Roger |