|
Code Listing 4: Create an XMLType view to expose XML data as files.
CREATE OR REPLACE VIEW ATTRACTION_XML
OF XMLType
WITH OBJECT ID (
extractValue(sys_nc_rowinfo$,'/County/@Name')
) from columns (c.County_name)
AS
SELECT XMLElement("County",
XMLAttributes(c.county_name AS "Name",
'http://www.w3.org/2001/XMLSchema-instance'
AS "xmlns:xsi",
'http://gennick.com/tourist.xsd'
AS "xsi:noNamespaceSchemaLocation"),
XMLAgg(
XMLElement("Attraction",
XMLAttributes(government_owned AS GOV),
XMLForest(a.attraction_name AS "Name",
a.Location AS "Location",
a.attraction_url AS "URL")))) x
FROM county c INNER JOIN attraction a
ON c.county_name = a.county_name
GROUP BY c.county_name;
|