aboutcode-org / aboutcode-org/scancode-toolkit

Integration of sanexml fails.

未關閉
#3,483 6 則留言 0 個 reaction 已指派 1 人 已被 @35C4n0r 認領 在 GitHub 檢視
GSoC
主要語言
Python
星號
2.6k
分支
791
平均合併
1 天 12 小時
30 天內合併 PR
5

描述

The integration of [sanexml](https://github.com/nexB/sanexml) with Pymaven and SCTK are failing.
Here is the [log](https://gist.github.com/35C4n0r/c44ec67e80e7bb276847bdb9809d1172).
I think a lot of these are failing because the xmls are not in a proper format and i didn't implement any logic corresponding to the `recover=True` for the XMLParser. What this does that it Parses XML liniently.

I see two possibilitoes to solve this issue:

- Use `BeautifulSoup4` and use it's `html.parser` for linient parsing to get a correct xml string and then parse that string normally using python's default XML parsers. (BS4 [Docs](https://www.crummy.com/software/BeautifulSoup/bs4/doc/))
- Create a custom parser :(

If we go with the first approch we can either use this process ``html.parser -> get correct xml -> DefaultXMLParser`` as the default or we can do:

try: `DefaultXMLParser`
except:
try: `html.parser` -> get correct xml -> `DefaultXMLParser` # Slower #Lininent
except:
try: `html5lib` -> get correct xml -> `DefaultXMLParser` # Slowest #MoreLinient

@JonoYang @pombredanne @AyanSinhaMahapatra please share your opinions on this.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。