{"modulePath":"github.com/dracory/nodebase","version":"v0.7.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package html\n\nPackage html contains the html node implementation.\n\n## Types\n\n```go\ntype HTMLConfig struct {\n\t// Tag is the CSS selector. Supported subset: tag, .class, #id,\n\t// [attr], [attr=value], descendant and child (\u003e) combinators,\n\t// comma-separated groups.\n\tTag string `json:\"tag\"`\n\t// Ret selects what each match produces: \"html\" (outer HTML,\n\t// default), \"text\" (element text), \"val\" (the value attribute),\n\t// or any other string naming an attribute (Node-RED semantics).\n\tRet string `json:\"ret\"`\n\t// As selects the output shape: \"single\" (one message whose payload\n\t// is an array of matches — Node-RED default) or \"multi\" (one\n\t// parts-tagged message per match).\n\tAs string `json:\"as\"`\n\t// Property is the message property holding the HTML\n\t// (default \"payload\").\n\tProperty string `json:\"property\"`\n\t// OutProperty is the message property the extraction is written to\n\t// (defaults to Property).\n\tOutProperty string `json:\"outproperty\"`\n}\n```\nHTMLConfig holds configuration for the html node — the Node-RED \\`html\\` equivalent: it extracts elements from an HTML message payload via a CSS selector.\n\n```go\ntype HTMLNode struct {\n\t*nodebase.BaseNode\n\t// contains filtered or unexported fields\n}\n```\nHTMLNode extracts elements/text/attributes from an HTML payload. \"single\" mode stashes matches for the MessageExpander hook so each match travels downstream as its own parts-tagged message.\n\n```go\nfunc NewHTMLNode(node nodestore.NodeInterface, config *HTMLConfig) *HTMLNode\n```\nNewHTMLNode creates a new html node\n\n```go\nfunc (n *HTMLNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)\n```\nExecute parses the payload HTML and evaluates the selector. \"single\" (the default) writes an array of matches to the output property; \"multi\" stashes matches and returns a shell expanded by Expand into one parts-tagged message per match.\n\n```go\nfunc (n *HTMLNode) Expand(output nodestore.MessageInterface) []nodestore.MessageInterface\n```\nExpand turns stashed matches into one parts-tagged message per match (same parts {id,type,index,count} shape the split node produces so a downstream join can reassemble).\n\n```go\nfunc (n *HTMLNode) Validate() error\n```\nValidate checks the html node configuration\n\n","path":"github.com/dracory/nodebase/html","name":"html","synopsis":"Package html contains the html node implementation.","isRedistributable":true}
