Abstract
While XML databases are a good solution for managing XML content, frequently it is necessary to uses non-XML databases for managing XML content. In most cases, these databases will be relational databases. There a two major approaches of how to manage XML content in a relational database. The first approach is to define a mapping between XML and relational structures and work with this mapping. The second approach is to use the XML-specific functionality, which is increasingly provided by relational databases, turning them into XML-aware databases.
SQL/XML Example
SELECT
e.EmpId,
e.FirstName,
e.LastName,
e.StartDate,
e.EndDate
FROM Employees e WHERE e.EmpId = 12
SELECT
XMLELEMENT (NAME "employee",
XMLATTRIBUTES(e.EmpId as "id"),
XMLELEMENT(NAME "names",
XMLELEMENT(NAME "first", e.FirstName),
XMLELEMENT(NAME "last", e.LastName)),
XMLELEMENT(NAME "hire-dates",
XMLATTRIBUTES(e.StartDate as "start", e.EndDate as "end")))
FROM Employees e WHERE e.EmpId = 12