开发者

Insert xml to database with full declaration

开发者 https://www.devze.com 2023-04-03 13:35 出处:网络
I have a xml string with declaration such: N\'<?xml version=\"1.0\" encoding=\"utf-16\"?> <ParentNode xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">

I have a xml string with declaration such:

N'<?xml version="1.0" encoding="utf-16"?>
<ParentNode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ChildNodes>
    <Node1>106637.5</Node1>
    <Node2>4</Node2>
  </ChildNodes>
</ParentNode>'

I had successfully insert to MSSQL database, but it seems sql server automatic trims off the xml declaration (<?xml version="1.0" enco开发者_Python百科ding="utf-16"?>).

How can I force sql server to insert above xml string with full declaration ?


How can I force sql server to insert above xml string with full declaration ?

It is not possible. Limitations of the xml Data Type

The XML declaration PI in an instance is not preserved when the instance is stored in the database.

0

精彩评论

暂无评论...
验证码 换一张
取 消