我从另一个测试/错误跟踪工具导入一些数据到tfs,我想转换它的描述,这是简单的
HTML,所以一个简单的字符串,其中HTML的“布局”被保留.
例如:
<body>
<ol>
<li>Log on with user Acme & Co.</li>
<li>Navigate to the details tab</li>
<li>Check the official name</li>
</ol>
<br>
<br>
Expected Result:<br>
official name is filled in<br>
<br>
Actual Result:<br>
The &-sign is not shown correctly<br>
See attachement.
</body>
将成为纯文本,插入换行符和HTML实体翻译如下:
1. Log on with user Acme & Co. 2. Navigate to the details tab 3. Check the official name Expected Result: official name is filled in Actual Result: The &-sign is not shown correctly See attachment
我现在可以使用正则表达式替换一些带有换行符的标签,并删除其他标签,但是替换HTML实体和诸如< ol>和< ul>好像我正在重新发明一些东西(浏览器?).所以我想知道有没有人在我之前这样做.我找不到使用Google.
解决方法
而不是正则表达式,您可以尝试将其加载到
HTML agility pack?如果是xhtml,那么xslt转换可能是一个很好的选择.