You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Tools/Tidy/Tidy HTML Tree
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control ef Inherits TextArea
ControlInstance ef Inherits TextArea
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
work
End EventHandler
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
Private Sub ParseNode(node As TidyNodeMBS)
While node <> nil
dim s As String // for observing node content in the debugger
s = node.Text
Listbox1.AddRow s
dim c As TidyNodeMBS = node.Child
if c <> nil Then
ParseNode c
end if
node = node.NextNode
Wend
End Sub
Private Sub Work()
dim input As String = ef.Text
if input = "" Then
Beep
Return
end if
dim t as TidyDocumentMBS
t=new TidyDocumentMBS
t.OptionXhtmlOut=True
call t.ParseString(input)
call t.CleanAndRepair
'call t.RunDiagnostics
't.OptionForceOutput=true
dim s As String=t.SaveString
dim n as TidyNodeMBS=t.Body
while n<>nil
ParseNode(n)
n=n.NextNode
wend
End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar