I searched for a solution but nothing was relevant, so here is my problem:
(我搜索了一个解决方案,但没有任何相关性,所以这是我的问题:)
I want to parse a string which contains HTML text.
(我想解析一个包含HTML文本的字符串。)
I want to do it in JavaScript.(我想用JavaScript做。)
I tried this library but it seems that it parses the HTML of my current page, not from a string.
(我试过这个库,但它似乎解析了我当前页面的HTML,而不是字符串。)
Because when I try the code below, it changes the title of my page:(因为当我尝试下面的代码时,它会更改我的页面标题:)
var parser = new HTMLtoDOM("<html><head><title>titleTest</title></head><body><a href='test0'>test01</a><a href='test1'>test02</a><a href='test2'>test03</a></body></html>", document);
My goal is to extract links from an HTML external page that I read just like a string.
(我的目标是从HTML外部页面中提取链接,就像字符串一样。)
Do you know an API to do it?
(你知道一个API来做吗?)
ask by stage translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…