简体   繁体   English

忽略QC REST API输出中的HTML标签

[英]Ignore HTML tags in QC REST API output

Using HP ALM REST API, we get the Memo fields embedded with HTML tags such as <html> , <span> , <body> , etc. Is there a way to suppress the same using any options? 使用HP ALM REST API,我们获得了嵌入有HTML标记(例如<html><span><body>等)的Memo字段。是否可以使用任何选项抑制相同的内容?

Using the earlier OTA API, we had the option to use tdconnection.IgnoreHtmlFormat=True , which used to suppress these tags, but using REST API, I am unable to find an equivalent one. 使用较早的OTA API,我们可以选择使用tdconnection.IgnoreHtmlFormat=True ,它用来禁止显示这些标签,但是使用REST API,我找不到等效的标签。 Any suggestions or should I build a parser myself after reading the output? 有什么建议,还是我应该在阅读输出后自己构建一个解析器?

I personally don't know of a switch like that. 我个人不知道这样的开关。

Alternatively you might try this: How to Parse Only Text from HTML 或者,您可以尝试以下操作: 如何仅解析HTML中的文本

On paper this seems quite nice. 从纸面上看,这似乎很好。

This requires an extra step though. 但是,这需要额外的步骤。 After getting the request you'ld have to run it through the proposed library to get the get the flat text. 收到请求后,您必须在提议的库中运行它以获取文本。 Shouldn't be more than a line of code I think. 我认为不应只是一行代码。

Downside is there might be some stuff going south because you dump any formatting stored as HTML. 不利的一面可能是有些东西向南,因为您转储了任何存储为HTML的格式。 Usually that isn't much though. 通常,虽然不多。 Depends of the project and the people off course. 取决于项目和偏离路线的人员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM