XmlData AS [Category!1!CustomData!xmltext]
FROM Categories WHERE CategoryID = 8 FOR XML EXPLICIT
返回结果:
查询语句:
SELECT 1 AS Tag,NULL AS Parent,
CategoryID AS [Category!1!ID],
XmlData AS [Category!1!!xmltext]
FROM Categories WHERE categoryID = 8 FOR XML EXPLICIT
返回结果:
4> 使用cdata指令
使用该指令可以创建CDATA节防止一些字符数据被xml解析器。
查询语句:
SELECT 1 AS Tag,NULL AS Parent,
CategoryID AS [Category!1!ID],
XmlData AS [Category!1!!cdata]
FROM Categories WHERE categoryID = 6 FOR XML EXPLICIT
返回结果:
]]>
5> 使用ID、IDREF和IDREFS指令以及XMLDATA选项
由于这里只能返回XDR构架,不支持XSD架构的检索,我就只给出一个例子,
查询语句:
文章来源于领测软件测试网 https://www.ltesting.net/