Parse partial HTML as-is? #160
Unanswered
maxcorbeau
asked this question in
Q&A
Replies: 1 comment
-
|
@maxcorbeau With PR #188 being merged, you can do it! (just wait for the release) from selectolax.lexbor import LexborHTMLParser
sample = "<tr><i>foo</i><i>bar</i></tr>"
print(f"{LexborHTMLParser(sample, is_fragment=True).html=}") |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When I try to parse HTML, selectolax does a few extra things (not shocking for an HTML parser):
html/head/bodyfrom what I can see)<tr>encountered outside a<table>)Is there a way to use selectolax in loose mode (i.e. don't remove/add any tags)?
Reason I wanted to use
selectolaxis because of speed (I get ~3x to 4x vs.lxml, ~20x vs.bs4)I think I'm going to end up using some Rust pure XML parser if selectolax can't do it.
Beta Was this translation helpful? Give feedback.
All reactions