2012-07-06 45 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 />等所有空元素。

相關問題