Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibXML2 bindings for html5ever #423

Open
aminya opened this issue Jun 25, 2020 · 4 comments
Open

LibXML2 bindings for html5ever #423

aminya opened this issue Jun 25, 2020 · 4 comments

Comments

@aminya
Copy link

aminya commented Jun 25, 2020

Is there a possibility that we have LibXML2 bindings for html5ever similar to how gumbo has it?
https://github.com/sevenval/gumbo-libxml

I have a program that is written on top of LibXML2, however, I need to parse HTML5 with it. I was wondering if I can use html5ever for this purpose without changing my whole library.

@jdm
Copy link
Member

jdm commented Jun 25, 2020

The current maintainers of this library have no experience with libxml2 and won't spend any time investigating this as a possibility, sorry.

@aminya
Copy link
Author

aminya commented Jun 25, 2020

The conversion is very simple. We just need a node_convert function similar to this to convert html5ever nodes to LibXML nodes, and also a html5_parse function which uses that node_convert internally, similar to this

@SimonSapin
Copy link
Member

to convert html5ever nodes

There is no such thing as html5ever nodes. Instead the intended use is that you implement the html5ever::tree_builder::TreeSink trait to parse into whatever tree representation you wish, including libxml nodes. Such support doesn’t need to live in this crate or repository. The rcdom crate has a naive TreeSink implementation and tree data structure that exist mostly so we can run tests, and can also serve as an example to look at.

@hhaensel
Copy link

I know this is quite a while ago. We went away from Gumbo.jl as it couldn't preserve templates. I just submitted a PR to add template handling and to fix JuliaWeb/Gumbo.jl#86. Maybe, this is an option for you as soon as it is merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants