Is it possible to map relational database schema to document type definition (DTD) Then start Populating an XML document. I have been given something like the following:
Division(A, B, C, D) and other 4 more relations (tables)
I know that if I have xml then I can make the DTD, but in this case the relational database schema has been given. The question was:
"Design a proper DTD for the information given by the above relational database schema. The valid XML documents under this DTD must have a tree structure with as much nesting as possible. The DTD must also capture all the primary key and foreign key constraints."
I am not looking for pure direct answer, but I really want to understand if I can make DTD from the 4 given relations (tables). If it is possible, are there any steps that I need to know.
I have tried to do the xml but the instruction given ask to make the DTD first then populate an xml file.
The way the requirement has been expressed indicates that the XML should represent relationships using the XML tree structure where possible, or ID/IDREF relationships otherwise. I think that to get this right, you need to reverse-engineer an entity-relationship model from the SQL database schema, and then find an XML representation of that entity-relationship model - which will involve deciding which relationships to model using XML containment and which to model using ID/IDREF foreign keys.
Good luck: it's an interesting assignment.
You say:
I would never try to write a DTD without first producing a representative XML document to test it against.