
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
Interface to libxml2, with DOM interface
This library is still in very early stages of development. API may still change
import (
"log"
"net/http"
"github.com/lestrrat/go-libxml2"
)
func ExampleHTML() {
res, err := http.Get("http://golang.org")
if err != nil {
panic("failed to get golang.org: " + err.Error())
}
doc, err := libxml2.ParseHTML(res.Body)
if err != nil {
panic("failed to parse HTML: " + err.Error())
}
defer doc.Free()
doc.Walk(func(n Node) error {
log.Printf(n.NodeName())
return nil
})
nodes, err := doc.FindNodes(`//div[@id="menu"]/a`)
if err != nil {
panic("failed to evaluate xpath: " + err.Error())
}
for i := 0; i < len(nodes); i++ {
log.Printf("Found node: %s", nodes[i].NodeName())
}
}
There exists many similar libraries. I want speed, I want DOM, and I want XPath.When all of these are met, I'd be happy to switch to another library.
For now my closest contender was xmlpath, but as of this writing it suffers in the speed (for xpath) area a bit:
go test -tags bench -bench=. -benchtime=5s
PASS
BenchmarkXmlpath 100000 88764 ns/op
BenchmarkLibxml2 300000 22509 ns/op
ok github.com/lestrrat/go-libxml2 24.926s
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.