Commands & Syntax > Commands > File Mainpulation >

www.perfectkeyboard.com

 

Convert HTML to XML - < file_html2xml >() ... [Pro]

 

File Convert HTML to XML
<file_html2xml>("HTML File","XML File")
Available in: Professional edition

This command converts HTML file to XML file. HTML files are not always XML syntax compliant. This command makes an HTML file XML compliant so that XML maco commands can be used to parse the file content.

 

#

Parameter name

Parameter description

1

HTML File

(Full) path to the input HTML file.

2

XML File

(Full) path to the output XML file.

 

Example (Macro Steps):

 

1

<#> <#> This example shows how to use HTML to XML command.

2

Macro execution: ONLY COMMANDS

3

Http DOWNLOAD "http://www.macrotoolworks.com" (Login name=) to file "macrotoolworks.html"

4

File Convert HTML to XML Convert HTML file macrotoolworks.html to XML file macrotoolworks.xml

5

XML File Open File path = "macrotoolworks.xml", File handle variable = "vXmlDoc", Root element handle variable = "vXmlDocRoot", Password = ""

6

XML Navigate to Element (Element handle variable = "%vXmlDoc%", Path = "root\html\body\div\div\div\div\h1\a", Element handle variable = "vTestElem")

7

XML Attribute Get (Element handle variable = "%vTestElem%", Attribute name = "title", Variable for result = "vHtmlPageTitle")

8

Message SHOW "Information" : "%vHtmlPageTitle%" (other parameters: x = -100, y = -100, Window title = , Buttons = OK, Timeout (seconds) = 0, Always on top = No).

Example (Plain Text):

 

<#> This example shows how to use HTML to XML command.

<#>

<cmds>

<download>("macrotoolworks.html","http://www.macrotoolworks.com","","")

<file_html2xml>("macrotoolworks.html","macrotoolworks.xml")

<xml_file_open>("macrotoolworks.xml",vXmlDoc,vXmlDocRoot)

<xml_element_navigate>(%vXmlDoc%,"root\html\body\div\div\div\div\h1\a",vTestElem)

<xml_attribute_get>(%vTestElem%,title,vHtmlPageTitle)

<msg>(-100,-100,"%vHtmlPageTitle%","",1,0,0,0)