我正在解析一个xml文本,其中包含像'áéñ'这样的字符。Sql 2008,无效字符解析xml,带字符的波浪号
我收到'在文本内容中发现无效字符'。错误,这样
declare @Xml varchar(100)
set @Xml =
'
<?xml version="1.0" encoding="UTF-8"?>
<Root>á</Root>
'
declare @XmlId integer
execute dbo.sp_xml_preparedocument @XmlId output, @Xml
select * from openXml(@XmlId, '/', 2) with (
Root varchar(10)
)
execute dbo.sp_xml_removedocument @XmlId
而且我发现了以下错误:
The XML parse error 0xc00ce508 occurred on line number 3, near the XML text "<Root>".
Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1
The error description is 'An invalid character was found in text content.'.
Msg 8179, Level 16, State 5, Line 13
Could not find prepared statement with handle 0.
Msg 6607, Level 16, State 3, Procedure sp_xml_removedocument, Line 1
sp_xml_removedocument: The value supplied for parameter number 1 is invalid.
是否有某种方式,SQL可以解析这个XML?或者问题是编码?
是对这些字符进行编码的唯一解决方案还是有更好的方法来解决它?
打印出你的@Xml,你应该看到这个 – Paparazzi