The Public API is the API that LibTidy programmers must access in order to harness HTML Tidy as a library. The API limits all exposure to internal structures and provides only accessors that return simple types such as C strings and integers, which makes it quite suitable for integration with any number of other languages.
Modules | |
Basic Operations | |
For an excellent example of how to invoke LibTidy, please consult console/tidy.c:main() for in-depth implementation details. A simplified example can be seen on our site: http://www.html-tidy.org/developer/. | |
Configuration Options | |
Functions for getting and setting Tidy configuration options. | |
Diagnostics and Repair | |
After parsing the document, you can use these functions to attempt cleanup, repair, get additional diagnostics, and determine the document type. | |
Document Parse | |
Functions for parsing markup from a given input source, as well as string and filename functions for added convenience. HTML/XHTML version determined from input. | |
Document Save Functions | |
Save currently parsed document to the given output sink. File name and string/buffer functions provided for convenience. | |
Document Tree | |
A parsed (and optionally repaired) document is represented by Tidy as a tree, much like a W3C DOM. This tree may be traversed using these functions. The following snippet gives a basic idea how these functions can be used. | |
I/O and Messages | |
Tidy provides flexible I/O. By default, Tidy will define, create and use instances of input and output handlers for standard C buffered I/O (i.e., FILE* stdin , FILE* stdout , and FILE* stderr for content input, content output and diagnostic output, respectively. A FILE* cfgFile input handler will be used for config files. Command line options will just be set directly. | |
Localization Support | |
These functions help manage localization in Tidy. | |
Memory Allocation | |
Tidy can use a user-provided allocator for all memory allocations. If this allocator is not provided, then a default allocator is used which simply wraps standard C malloc()/free() calls. These wrappers call the panic() function upon any failure. The default panic function prints an out of memory message to stderr, and calls exit(2) . | |
Message Key Management | |
These functions serve to manage message codes, i.e., codes that are used Tidy and communicated via its callback filters to represent reports and dialogue that Tidy emits. | |
Opaque Types | |
Instances of these types are returned by LibTidy API functions, however they are opaque; you cannot see into them, and must use accessor functions to access the contents. This ensures that interfacing to LibTidy remains as universal as possible. | |
Public Enumerations | |