Description
You are given the following XML document (doc1.xml):
Write a DTD D1 for project/employee documents, enforcing the following constraints: • Each project is identified by a unique pid. • Each project involves one or more employees. • There are only two roles: leader and analyst. • Each project has at least one leader. • The first employee listed in a project is always a leader. The document doc1.xml should be valid with respect to the DTD D1.
Problem 2
Write an XQUERY script that transforms documents valid with respect to the DTD D1 to a format in which projects involving an employee are listed under this employee. In particular, the document doc1.xml should be transformed into the following document (doc2.xml):
Note: you have to make sure that employees are listed in alphabetical order.
Problem 3
Write a DTD for doc2.xml.
Problem 4
Write an XQUERY script that will extract from doc1.xml all the projects that have no analysts. The output should be formatted as follows:
Submission rules
Test your XQuery code with https://www.xpathtester.com/xquery. Test your DTDs with https://www.validome.org/xml/validate/. If your code does not work with these websites, it will not be graded. Please embed the DTDs in the original xml files, as discussed in class. Please submit four distinct files: Project3 P1.xml, Project3 P2.xquery, Project3 P3.xml and Project3 P4.xquery. You should submit your work using submit cse462.