SELECT xmlserialize (DOCUMENT (
SELECT xmlroot(
xmlelement(name root,
xmlelement(name value, 'test')
), version '1.0')
) AS text);
returns:
<root><value>test</value></root>
I want (and expected):
<?xml version='1.0'?><root><value>test</value></root>
Of course I could go:
SELECT '<?x开发者_如何学Cml version="1.0"?> ' || xmlserialize (CONTENT (...
but then what is the point of including xmlroot?
(I experimented with v8.3.7, v8.4.4 & v9.0.0 on Windows XP)
It includes the xml declaration if the standalone
option of xmlroot
is used with a value of yes
or no
:
SELECT xmlserialize (DOCUMENT (
SELECT xmlroot(
xmlelement(name root,
xmlelement(name value, 'test')
), version '1.0', standalone yes)
) AS text);
精彩评论