html-react-parser
html-react-parser copied to clipboard
unable to rightly parse html when it contain some html tags with no ends.
I am unable to parse the current html from some reason
<div>
<div id="chr-content">
<span>
lkjasdkjasdkljakldj
</div>
</div>
`
My current Code is
const validate =()=> {
var h = html.replace(/<!DOCTYPE html>/g, "").
replace(/[[class]]/g, "").
replace(/[[id]]/g, "")
var container = parse("<div>" + h + "</div>");
var content = container.querySelector("#chr-content");
setFound(content != null ? "found" : "not found")
}
This is on Node.js with the latest version 4.1.4
Here is snack example if you would like to test
Apologies for the late response @AlenToma but are you still unable to parse the HTML?
I am using it together with react-native-html-parser
react-native-html-parser will enclose all open html tags and then I parse the html again.