我有以下查询,它在 xml 的一行中返回所有内容,有没有办法让输出格式为可读格式?就像下面的示例一样。
SELECT XMLELEMENT("rss",
XMLATTRIBUTES('http://www.georss.org/georss' AS "xmlns:georss"),
XMLELEMENT("channel",
XMLAGG(XMLELEMENT("item",
XMLFOREST(title AS "title",
description AS "description",
point AS "georss:point"))))).EXTRACT('/*')
FROM (SELECT trim(s.sitedesc) AS title,
'Employee Count: ' || s.sitefte || '<br /> Bldg Gross SF: ' || s.bldgarea || '<br />' || CASE WHEN s.leasestat = '0' THEN 'Owned' WHEN s.leasestat = '1' THEN 'Leased, end date: ' || trim(l.edate) END || '<br /><a href="../scripts/fmiinfo.asp?file_code=_BLDGLIST&sitecode='||trim(s.sitecode)||'&forceDB=">'||'More Details'||'</a> <br />' AS description,
trim(s.latitude) || ' ' || trim(s.longitude) AS point
FROM ls s
LEFT OUTER JOIN c0 l ON l.sitecode = s.sitecode
WHERE s.sold <> 1
AND s.longitude != ' '
)
;
返回
<rss xmlns:georss="http://www.georss.org/georss"><channel><item><title>TITLE</title><description>DESCRIPTION<description><georss:point>LAT LON</georss:point></item> ... </channel></rss>
但为了更容易阅读,希望输出更接近于:
<rss xmlns:georss="http://www.georss.org/georss">
<channel>
<item>
<title>TITLE</title>
<description>DESCRIPTION</description>
<georss:point>LAT LON</georss:point>
</item>
...
</channel>
</rss>