lestrrat-go / libxml2

Interface to libxml2, with DOM interface
MIT License
230 stars 55 forks source link

How to remove node #78

Closed asyncins closed 3 years ago

asyncins commented 3 years ago
</html>
<body>
<div>
    <h1>Example Domain</h1>
    <p>This domain is for use in illustrative examples in documents. You may use this
    domain in literature without prior coordination or asking for permission.</p>
    <p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>

Hello ~ I've come to learn from you again.

I want to remove h1 node. the code shuold be...?

asyncins commented 3 years ago

I got it

parent, _ := node.ParentNode()
parent.RemoveChild(node)