我有一个表列,它存储 xml 块,如
<Text>hello, world</Text></Image id="100">
或没有标签的纯文本。如何从没有转义符号的标记列值中生成 xml。
这是该语句的一个示例:
select xmlelement("Proposal", xmlforest(1 as "ProposalType"
,to_char(sysdate, 'dd.mm.yyyy') as "CreateDate"
,'title1' as "Title"
,'<Text>hello, world</Text></Image id="100">' as "InfoBlock"))
from dual;
生成的 xml 如下所示:
<Proposal>
<ProposalType>1</ProposalType>
<CreateDate>31.10.2012</CreateDate>
<Title>title1</Title>
<InfoBlock2><Text>hello, world</Text></Image id="100"></InfoBlock2>
</Proposal>
但我需要这样的xml:
<Proposal>
<ProposalType>1</ProposalType>
<CreateDate>31.10.2012</CreateDate>
<Title>title1</Title>
<InfoBlock2>
<Text>hello, world</Text><Image id="100"/>
</InfoBlock2>
</Proposal>