User`s guide
Use an HTML Cleanup Program
13-99
Parsing HTML text:
"simple_html_example.html"
caused error:
"HTML error: "expected end of tag 'b'""
5
Download the HTML Tidy program. For example, to download Tidy for Windows,
go to http://www.paehl.com/open_source/?HTML_Tidy_for_Windows. Click the EXE
Version compiled 06 nov 2009 link.
Note: To download Tidy for other platforms, see http://tidy.sourceforge.net/#binaries.
6
In the tidy.zip file, right-click tidy.exe and select Extract. Extract tidy.exe to
the current MATLAB folder.
7
Create a batch file to use with Tidy. In Notepad, enter the following code.
tidy --doctype omit --input-xml no --output-xml yes --write-back yes -f errs.txt %1
Save the batch file in the Windows path. Save the file as tidyup.bat. You can use
this batch file with other HTML files that you want to append to a DOM report.
8
Make a backup copy of the simple_html_example.html file, which contains the
HTML to append to the DOM report.
9
Run Tidy on simple_html_example.html. In a Windows command window, enter:
tidyup simple_html_example.html
10
In the folder where you ran tidyup, check the errs.txt file. That file summarizes
the changes Tidy made, and lists as errors issues that Tidy could not fix. In this
example, there are no errors, but if errs.txt did report errors, manually edit the
HTML file to address those issues.
11
In MATLAB, append the simple_html_example.html file to a DOM report and
display the report.
import mlreportgen.dom.*;
rpt = Document('html_report','docx');
htmlFile = HTMLFile('simple_html_example.html');
append(rpt,htmlFile);
close(rpt);
rptview(rpt.OutputPath);
Related Examples
• “Append HTML Content to DOM Reports” on page 13-93