Map HTML
Verb: mapHTML
Maps data of an HTML text based on parameters of an XPath expression, saving it to variables.
Syntax
mapHTML --html(String) --outputtype(OutputHtmlType) [--removenamespaces(Boolean)] --mappings(String)
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--html | HTML | Required | Text | Text in HTML format to be mapped. |
--outputtype | Output Type | Required | OutputHtmlType | Filter to fetch and return the properties of HTML elements and/or their value:
|
--removenamespaces | Remove Namespaces | Optional | Boolean | When enabled, removes the namespace contained in the HTML text, so that XPATH mapping runs more simply. |
--mappings | Mappings | Required | Text | Maps the HTML text based on an XPATH expression extracted from the same HTML text:
|
Example
The Map HTML command gets text from an HTML from the mapped HTML element, with the Remove Namespaces parameter disabled and Output Type set to InnerHtml. The Log Message command records the content obtained.
defVar --name html --type String --value "<!DOCTYPE html>\r\n<html>\r\n <head>\r\n <title>HTML Example</title>\r\n </head>\r\n <body>\r\nHello World!\r\n </body>\r\n</html>"
defVar --name htmlText --type String
mapHTML --html "${html}" --outputtype "InnerHtml" --removenamespaces --mappings "html==${htmlText}"
logMessage --message "html: ${html}\r\n\r\n" --type "Info"
// Show in the console the HTML text according to the mapping.