Documentation
¶
Index ¶
- type GopherParse
- func (gp *GopherParse) AddAttr(tagName, key, value string)
- func (gp *GopherParse) FindByClass(className string) []*html.Node
- func (gp *GopherParse) FindByTag(tagName string) []*html.Node
- func (gp *GopherParse) ModifyAttr(tagName, key, newValue string)
- func (gp *GopherParse) RemoveAttr(tagName, key string)
- func (gp *GopherParse) Render() string
- func (gp *GopherParse) SetText(tagName, text string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GopherParse ¶
type GopherParse struct {
// contains filtered or unexported fields
}
GopherParse represents a GopherParse object, similar to Cheerio.
func LoadHTML ¶
func LoadHTML(htmlContent string) (*GopherParse, error)
LoadHTML parses an HTML document and returns a GopherParse object.
func LoadHTMLFile ¶
func LoadHTMLFile(filePath string) (*GopherParse, error)
LoadHTMLFile reads an HTML file from the given path and returns a GopherParse object.
func LoadXML ¶
func LoadXML(xmlContent string) (*GopherParse, error)
LoadXML parses an XML document and returns a GopherParse object.
func LoadXMLFile ¶
func LoadXMLFile(filePath string) (*GopherParse, error)
LoadXMLFile reads an XML file from the given path and returns a GopherParse object.
func (*GopherParse) AddAttr ¶
func (gp *GopherParse) AddAttr(tagName, key, value string)
AddAttr adds an attribute with the specified key-value pair to all elements with the given tag name within the GopherParse object.
func (*GopherParse) FindByClass ¶
func (gp *GopherParse) FindByClass(className string) []*html.Node
FindByClass finds all elements with the specified class name within the GopherParse object.
func (*GopherParse) FindByTag ¶
func (gp *GopherParse) FindByTag(tagName string) []*html.Node
FindByTag finds all elements with the specified tag name within the GopherParse object.
func (*GopherParse) ModifyAttr ¶
func (gp *GopherParse) ModifyAttr(tagName, key, newValue string)
ModifyAttr modifies the value of the attribute with the specified key for all elements with the given tag name within the GopherParse object.
func (*GopherParse) RemoveAttr ¶
func (gp *GopherParse) RemoveAttr(tagName, key string)
RemoveAttr removes the attribute with the specified key from all elements with the given tag name within the GopherParse object.
func (*GopherParse) Render ¶
func (gp *GopherParse) Render() string
Render renders the GopherParse object into an HTML string.
func (*GopherParse) SetText ¶
func (gp *GopherParse) SetText(tagName, text string)
SetText sets the text content of all elements with the specified tag name within the GopherParse object.