Xbasic

a5_html_pretty Function

Syntax

C a5_HTML_Pretty(C html [,L flagXML ])

Arguments

htmlCharacter

The HTML to format.

flagXMLLogical

Default = .f.. If .t., HTML is treated as XML.

Returns

resultCharacter

Returns the formatted HTML or XML.

Description

Reformat HTML text to show proper indentation

Example 

The A5_HTML_Pretty() function, which takes an HTML string and adds the correct indentation to all of the elements can now also be used to format XML. The function takes a second, optional, parameter that indicates if the input string is XML. By default, this flag is .f.

txt = http_get_page2("http://feeds.gawker.com/lifehacker/full")
txt = a5_HTML_Pretty(txt,.t.)
showvar(txt)