Documentation
¶
Overview ¶
Package unhtml provides reflection-based HTML unmarshalling on top of goquery, aiming for an experience similar to json.Unmarshal / xml.Unmarshal but for HTML DOM trees.
A destination struct describes what it wants via struct tags:
type Lot struct {
ID string `html:".batch-id" opt:"required"`
Product string `html:".product"`
}
var lot Lot
err := unhtml.Unmarshal(row, &lot)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unmarshal ¶
Unmarshal extracts data from sel into dest according to the struct tags (html, attr, conv, opt) declared on dest's type.
- If dest is a pointer to a struct, sel is treated as the single node to unmarshal fields from.
- If dest is a pointer to a slice (of structs or of struct pointers), one element is produced per node contained in sel.
Types ¶
type HTMLUnmarshaler ¶
HTMLUnmarshaler is implemented by types that know how to parse their own extracted text/attribute value. It takes priority over every other conversion, including encoding.TextUnmarshaler.
Click to show internal directories.
Click to hide internal directories.