簡體   English   中英

是否可以處理html以自動關閉沒有關閉標簽的標簽?

[英]is it possible to process html to auto close tags with no close tags?

我有這串

<div>
  <p><strong>Elem_A</strong>String_A2_2 <String_A2_2> asdas</p>
  <p><strong>Elem_B</strong>String_B2_2 String_B2_2</p>
</div>

我想隱瞞它

<div>
  <p><strong>Elem_A</strong>String_A2_2 <String_A2_2/> asdas</p>
  <p><strong>Elem_B</strong>String_B2_2 String_B2_2</p>
</div>

基本上,我想自動關閉任何非html已知的標簽,因為我在htmlagilitypack中處理此html時遇到問題,因為它會更改html的含義。

HTML(不是XHTML)已經做到了這一點:定義了自動關閉的標簽 ,而沒有結尾的結束符/<br> )。

我不熟悉htmlagilitypack ,但是如果您基於HTML4.01制作自己的DTD(使用您自己的標簽進行擴展),則必須有一些可以使用的HTML解析器。


同樣,只是好奇,為什么在HTML中使用“特殊”標簽?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM