htmlutil

package module
v0.0.0-...-a955877 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2016 License: MIT Imports: 2 Imported by: 2

README

Go Report Card

GoDoc

GitHub license

Documentation

Overview

Package htmlutil provides various utility functions for working with HTML nodes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllHtmlNodes

func GetAllHtmlNodes(n *html.Node, tag string, attr string, attrValue string) []*html.Node

GetAllHtmlNodes is a convenience function for GetHtmlNodes() that returns all matching HTML nodes.

func GetFirstHtmlNode

func GetFirstHtmlNode(n *html.Node, tag string, attr string, attrValue string) *html.Node

GetFirstHtmlNode is a convenience function for GetHtmlNodes() that returns the first matching node.

func GetHtmlNodes

func GetHtmlNodes(n *html.Node, tag string, attr string, attrValue string, count int) []*html.Node

GetHtmlNodes returns the HTML nodes found within the provided node given a tag, attribute, and attribute value up to the provided count.

The tag, attribute, and attribute value are all optional. If they are empty, they will not be used as search criteria.

If the count is -1, all nodes will be returned.

func HtmlNodeToString

func HtmlNodeToString(n *html.Node) (string, error)

HtmlNodeToString converts an HTML node to a string for easier printing.

func RemoveAllHtmlAttrs

func RemoveAllHtmlAttrs(n *html.Node, tag string, attr string, attrValue string)

RemoveAllHtmlAttrs is a convenience function for RemoveHtmlAttrs() that removes all matching attributes.

func RemoveAllHtmlNodes

func RemoveAllHtmlNodes(n *html.Node, tag string, attr string, attrValue string)

RemoveAllHtmlNodes is a convenience function for RemoveHtmlNodes() that removes all matching HTML nodes.

func RemoveFirstHtmlAttr

func RemoveFirstHtmlAttr(n *html.Node, tag string, attr string, attrValue string)

RemoveFirstHtmlAttr is a convenience function for RemoveHtmlAttrs() that removes the first matching attribute.

func RemoveFirstHtmlNode

func RemoveFirstHtmlNode(n *html.Node, tag string, attr string, attrValue string)

RemoveFirstHtmlNode is a convenience function for RemoveHtmlNodes() that removes the first matching node.

func RemoveHtmlAttrs

func RemoveHtmlAttrs(node *html.Node, tag string, attr string, attrValue string, count int)

RemoveHtmlAttrs removes HTML attributes matching the provided tag, attribute, and value up to the provided count.

Tag is optional. If no tag is provided, all attributes matching the attribute and value will be removed.

If the count is -1, all attributes meeting the criteria will be removed.

func RemoveHtmlNodes

func RemoveHtmlNodes(n *html.Node, tag string, attr string, attrValue string, count int)

RemoveHtmlNodes removes the HTML nodes found within the provided node given a tag, attribute, and attribute value up to the provided count.

The tag, attribute, and attribute value are all optional. If they are empty, they will not be used as search criteria.

If the count is -1, all nodes meeting the criteria will be removed.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL