2012-07-06 49 views
1
<Translation> ( benzene OR pyrobenzole OR pyrobenzol OR &quot;phenyl  hydride&quot;    OR phene OR &quot;fenzen czech &quot; cyclohexatriene &quot;coal naphtha&quot; OR &quot;benzolo italian &quot; benzole benzol &quot;benzen polish &quot; &quot;benzeen dutch &quot; ) The chemical name <b>benzene</b> was identified.<br>The following terms were added from ChemIDplus:<br><b>pyrobenzole</b><br><b>pyrobenzol</b><br><b>phenyl hydride</b><br><b>phene</b><br><b>fenzen czech </b><br><b>cyclohexatriene</b><br><b>coal naphtha</b><br><b>benzolo italian </b><br><b>benzole</b><br><b>benzol</b><br><b>benzen polish </b><br><b>benzeen dutch </b><br>CAS Registry Number: <b>71-43-2</b><br></Translation> 

我从Web服务获取字符串,它不发送在cdata部分的HTML。 ,我得到的错误是: System.Xml.XmlException:在“BR”开始第1行的标签不匹配的结束标记如何反序列化其中一个节点包含html标签的xml?

我使用.NET 3.5,Web客户端消耗REST Web服务。

+2

你应该发布实际的XML,因为你的例子有一个结束br标签。 – 2012-07-06 22:35:20

+3

在XML文档中嵌入未编码的HTML听起来像是一个可怕的想法。 – bmm6o 2012-07-06 22:38:10

+1

修改web服务以在cdata部分中对html进行编码。 – 2012-07-07 00:37:22

回答

0

我知道这个问题。我可以通过包含HTML的命名空间来解决它。

xmlns="http://www.w3.org/1999/xhtml" 

这个错误将被抛出像<br /><hr /><input />等所有空元素。

相关问题