我如何在XML中传递html?

时间:2014-02-04 07:05:09

标签: html xml sql-server-2008

当我尝试将以下数据插入MS-SQL server 2008中的表时。它插入为

{column1}联系信息{column2} {column3}地址{column4} {column5} {column6}

而不是下面给出的xml标签DecoratorLayout中的整个html代码。在这里它将所有html标签视为xml标签,我该如何克服这个问题?

<ROOT>
<DecoratorLayout>
    <div class="row-fluid"><div class="span12">{column1}</div></div><h3 class="form-section">Contact Information</h3><div class="row-fluid"><div class="span5">{column2}</div><div class="span5">{column3}</div></div><h3 class="form-section">Address</h3><div class="row-fluid"><div class="span5">{column4}</div><div class="span5">{column5}</div></div><div class="row-fluid"><div class="span12">{column6}</div></div>
</DecoratorLayout>
</ROOT>

1 个答案:

答案 0 :(得分:2)

通过使用CDATA,您可以实现

<ROOT>
<DecoratorLayout>
  <![CDATA[ <div class="row-fluid"><div class="span12">{column1}</div></div><h3 class="form-section">Contact Information</h3><div class="row-fluid"><div class="span5">{column2}</div><div class="span5">{column3}</div></div><h3 class="form-section">Address</h3><div class="row-fluid"><div class="span5">{column4}</div><div class="span5">{column5}</div></div><div class="row-fluid"><div class="span12">{column6}</div></div>]]>
</DecoratorLayout>
</ROOT>