htmlparser
Parses a HTML document.
Methods
Clears the document text (deletes all lines)
Returns the value of a tag attribute
returns: string
Loads a document
Returns true while still parsing the document
returns: boolean
Stops parsing the document, goes back to the beginning
Sets the value of a tag attribute
Stops parsing the document
Properties
pos | integer | Returns the current position |
tagcontent | string | Returns the content of the current tag |
tagline | integer | Returns the line of the current tag |
tagname | string | Returns the name of the current tag |
tagpos | integer | Returns the position of the current tag |
Example - Using htmlparser
html = [[
<html>
<a href="http://www.lua.org">Lua</a>
</html>
]]
p = scl.htmlparser:new()
p:load(html)
while p:parsing() do
print(p.tagname)
print(p:getattrib('href'))
end