4
/** @file tidy.h - Defines HTML Tidy API implemented by tidy library.
6
Public interface is const-correct and doesn't explicitly depend
7
on any globals. Thus, thread-safety may be introduced w/out
8
changing the interface.
10
Looking ahead to a C++ wrapper, C functions always pass
11
this-equivalent as 1st arg.
14
Copyright (c) 1998-2005 World Wide Web Consortium
15
(Massachusetts Institute of Technology, European Research
16
Consortium for Informatics and Mathematics, Keio University).
22
$Date: 2005/04/08 09:11:12 $
25
Contributing Author(s):
27
Dave Raggett <dsr@w3.org>
29
The contributing author(s) would like to thank all those who
30
helped with testing, bug fixes and suggestions for improvements.
31
This wouldn't have been possible without your help.
35
This software and documentation is provided "as is," and
36
the copyright holders and contributing author(s) make no
37
representations or warranties, express or implied, including
38
but not limited to, warranties of merchantability or fitness
39
for any particular purpose or that the use of the software or
40
documentation will not infringe any third party patents,
41
copyrights, trademarks or other rights.
43
The copyright holders and contributing author(s) will not be held
44
liable for any direct, indirect, special or consequential damages
45
arising out of any use of the software or documentation, even if
46
advised of the possibility of such damage.
48
Permission is hereby granted to use, copy, modify, and distribute
49
this source code, or portions hereof, documentation and executables,
50
for any purpose, without fee, subject to the following restrictions:
52
1. The origin of this source code must not be misrepresented.
53
2. Altered versions must be plainly marked as such and must
54
not be misrepresented as being the original source.
55
3. This Copyright notice may not be removed or altered from any
56
source or altered source distribution.
58
The copyright holders and contributing author(s) specifically
59
permit, without fee, and encourage the use of this source code
60
as a component for supporting the Hypertext Markup Language in
61
commercial products. If you use this source code in a product,
62
acknowledgment is not required but would be appreciated.
65
Created 2001-05-20 by Charles Reitzel
66
Updated 2002-07-01 by Charles Reitzel - 1st Implementation
77
/** @defgroup Opaque Opaque Types
79
** Cast to implementation types within lib.
80
** Reduces inter-dependencies/conflicts w/ application code.
85
** Opaque document datatype
87
opaque_type( TidyDoc );
89
/** @struct TidyOption
90
** Opaque option datatype
92
opaque_type( TidyOption );
95
** Opaque node datatype
97
opaque_type( TidyNode );
100
** Opaque attribute datatype
102
opaque_type( TidyAttr );
106
TIDY_STRUCT struct _TidyBuffer;
107
typedef struct _TidyBuffer TidyBuffer;
110
/** @defgroup Basic Basic Operations
112
** Tidy public interface
114
** Several functions return an integer document status:
118
** >0 -> 1 == TIDY WARNING, 2 == TIDY ERROR
119
** <0 -> SEVERE ERROR
122
The following is a short example program.
125
#include <tidy.h>
126
#include <buffio.h>
127
#include <stdio.h>
128
#include <errno.h>
131
int main(int argc, char **argv )
133
const char* input = "<title>Foo</title><p>Foo!";
134
TidyBuffer output = {0};
135
TidyBuffer errbuf = {0};
139
TidyDoc tdoc = tidyCreate(); // Initialize "document"
140
printf( "Tidying:\t\%s\\n", input );
142
ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes ); // Convert to XHTML
144
rc = tidySetErrorBuffer( tdoc, &errbuf ); // Capture diagnostics
146
rc = tidyParseString( tdoc, input ); // Parse the input
148
rc = tidyCleanAndRepair( tdoc ); // Tidy it up!
150
rc = tidyRunDiagnostics( tdoc ); // Kvetch
151
if ( rc > 1 ) // If error, force output.
152
rc = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? rc : -1 );
154
rc = tidySaveBuffer( tdoc, &output ); // Pretty Print
159
printf( "\\nDiagnostics:\\n\\n\%s", errbuf.bp );
160
printf( "\\nAnd here is the result:\\n\\n\%s", output.bp );
163
printf( "A severe error (\%d) occurred.\\n", rc );
165
tidyBufFree( &output );
166
tidyBufFree( &errbuf );
174
TIDY_EXPORT TidyDoc TIDY_CALL tidyCreate(void);
175
TIDY_EXPORT void TIDY_CALL tidyRelease( TidyDoc tdoc );
177
/** Let application store a chunk of data w/ each Tidy instance.
178
** Useful for callbacks.
180
TIDY_EXPORT void TIDY_CALL tidySetAppData( TidyDoc tdoc, ulong appData );
182
/** Get application data set previously */
183
TIDY_EXPORT ulong TIDY_CALL tidyGetAppData( TidyDoc tdoc );
185
/** Get release date (version) for current library */
186
TIDY_EXPORT ctmbstr TIDY_CALL tidyReleaseDate(void);
188
/* Diagnostics and Repair
191
/** Get status of current document. */
192
TIDY_EXPORT int TIDY_CALL tidyStatus( TidyDoc tdoc );
194
/** Detected HTML version: 0, 2, 3 or 4 */
195
TIDY_EXPORT int TIDY_CALL tidyDetectedHtmlVersion( TidyDoc tdoc );
197
/** Input is XHTML? */
198
TIDY_EXPORT Bool TIDY_CALL tidyDetectedXhtml( TidyDoc tdoc );
200
/** Input is generic XML (not HTML or XHTML)? */
201
TIDY_EXPORT Bool TIDY_CALL tidyDetectedGenericXml( TidyDoc tdoc );
203
/** Number of Tidy errors encountered. If > 0, output is suppressed
204
** unless TidyForceOutput is set.
206
TIDY_EXPORT uint TIDY_CALL tidyErrorCount( TidyDoc tdoc );
208
/** Number of Tidy warnings encountered. */
209
TIDY_EXPORT uint TIDY_CALL tidyWarningCount( TidyDoc tdoc );
211
/** Number of Tidy accessibility warnings encountered. */
212
TIDY_EXPORT uint TIDY_CALL tidyAccessWarningCount( TidyDoc tdoc );
214
/** Number of Tidy configuration errors encountered. */
215
TIDY_EXPORT uint TIDY_CALL tidyConfigErrorCount( TidyDoc tdoc );
217
/* Get/Set configuration options
219
/** Load an ASCII Tidy configuration file */
220
TIDY_EXPORT int TIDY_CALL tidyLoadConfig( TidyDoc tdoc, ctmbstr configFile );
222
/** Load a Tidy configuration file with the specified character encoding */
223
TIDY_EXPORT int TIDY_CALL tidyLoadConfigEnc( TidyDoc tdoc, ctmbstr configFile,
226
TIDY_EXPORT Bool TIDY_CALL tidyFileExists( ctmbstr filename );
229
/** Set the input/output character encoding for parsing markup.
230
** Values include: ascii, latin1, raw, utf8, iso2022, mac,
231
** win1252, utf16le, utf16be, utf16, big5 and shiftjis. Case in-sensitive.
233
TIDY_EXPORT int TIDY_CALL tidySetCharEncoding( TidyDoc tdoc, ctmbstr encnam );
235
/** Set the input encoding for parsing markup.
236
** As for tidySetCharEncoding but only affects the input encoding
238
TIDY_EXPORT int TIDY_CALL tidySetInCharEncoding( TidyDoc tdoc, ctmbstr encnam );
240
/** Set the output encoding.
242
TIDY_EXPORT int TIDY_CALL tidySetOutCharEncoding( TidyDoc tdoc, ctmbstr encnam );
244
/** @} end Basic group */
247
/** @defgroup Configuration Configuration Options
249
** Functions for getting and setting Tidy configuration options.
253
/** Applications using TidyLib may want to augment command-line and
254
** configuration file options. Setting this callback allows an application
255
** developer to examine command-line and configuration file options after
256
** TidyLib has examined them and failed to recognize them.
259
typedef Bool (TIDY_CALL *TidyOptCallback)( ctmbstr option, ctmbstr value );
261
TIDY_EXPORT Bool TIDY_CALL tidySetOptionCallback( TidyDoc tdoc, TidyOptCallback pOptCallback );
263
/** Get option ID by name */
264
TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetIdForName( ctmbstr optnam );
266
/** Get iterator for list of option */
270
TidyIterator itOpt = tidyGetOptionList( tdoc );
273
TidyOption opt = tidyGetNextOption( tdoc, &itOpt );
274
.. get/set option values ..
279
TIDY_EXPORT TidyIterator TIDY_CALL tidyGetOptionList( TidyDoc tdoc );
280
/** Get next Option */
281
TIDY_EXPORT TidyOption TIDY_CALL tidyGetNextOption( TidyDoc tdoc, TidyIterator* pos );
283
/** Lookup option by ID */
284
TIDY_EXPORT TidyOption TIDY_CALL tidyGetOption( TidyDoc tdoc, TidyOptionId optId );
285
/** Lookup option by name */
286
TIDY_EXPORT TidyOption TIDY_CALL tidyGetOptionByName( TidyDoc tdoc, ctmbstr optnam );
288
/** Get ID of given Option */
289
TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetId( TidyOption opt );
291
/** Get name of given Option */
292
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetName( TidyOption opt );
294
/** Get datatype of given Option */
295
TIDY_EXPORT TidyOptionType TIDY_CALL tidyOptGetType( TidyOption opt );
297
/** Is Option read-only? */
298
TIDY_EXPORT Bool TIDY_CALL tidyOptIsReadOnly( TidyOption opt );
300
/** Get category of given Option */
301
TIDY_EXPORT TidyConfigCategory TIDY_CALL tidyOptGetCategory( TidyOption opt );
303
/** Get default value of given Option as a string */
304
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDefault( TidyOption opt );
306
/** Get default value of given Option as an unsigned integer */
307
TIDY_EXPORT ulong TIDY_CALL tidyOptGetDefaultInt( TidyOption opt );
309
/** Get default value of given Option as a Boolean value */
310
TIDY_EXPORT Bool TIDY_CALL tidyOptGetDefaultBool( TidyOption opt );
312
/** Iterate over Option "pick list" */
313
TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetPickList( TidyOption opt );
314
/** Get next string value of Option "pick list" */
315
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextPick( TidyOption opt, TidyIterator* pos );
317
/** Get current Option value as a string */
318
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetValue( TidyDoc tdoc, TidyOptionId optId );
319
/** Set Option value as a string */
320
TIDY_EXPORT Bool TIDY_CALL tidyOptSetValue( TidyDoc tdoc, TidyOptionId optId, ctmbstr val );
321
/** Set named Option value as a string. Good if not sure of type. */
322
TIDY_EXPORT Bool TIDY_CALL tidyOptParseValue( TidyDoc tdoc, ctmbstr optnam, ctmbstr val );
324
/** Get current Option value as an integer */
325
TIDY_EXPORT ulong TIDY_CALL tidyOptGetInt( TidyDoc tdoc, TidyOptionId optId );
326
/** Set Option value as an integer */
327
TIDY_EXPORT Bool TIDY_CALL tidyOptSetInt( TidyDoc tdoc, TidyOptionId optId, ulong val );
329
/** Get current Option value as a Boolean flag */
330
TIDY_EXPORT Bool TIDY_CALL tidyOptGetBool( TidyDoc tdoc, TidyOptionId optId );
331
/** Set Option value as a Boolean flag */
332
TIDY_EXPORT Bool TIDY_CALL tidyOptSetBool( TidyDoc tdoc, TidyOptionId optId, Bool val );
334
/** Reset option to default value by ID */
335
TIDY_EXPORT Bool TIDY_CALL tidyOptResetToDefault( TidyDoc tdoc, TidyOptionId opt );
336
/** Reset all options to their default values */
337
TIDY_EXPORT Bool TIDY_CALL tidyOptResetAllToDefault( TidyDoc tdoc );
339
/** Take a snapshot of current config settings */
340
TIDY_EXPORT Bool TIDY_CALL tidyOptSnapshot( TidyDoc tdoc );
341
/** Reset config settings to snapshot (after document processing) */
342
TIDY_EXPORT Bool TIDY_CALL tidyOptResetToSnapshot( TidyDoc tdoc );
344
/** Any settings different than default? */
345
TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanDefault( TidyDoc tdoc );
346
/** Any settings different than snapshot? */
347
TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanSnapshot( TidyDoc tdoc );
349
/** Copy current configuration settings from one document to another */
350
TIDY_EXPORT Bool TIDY_CALL tidyOptCopyConfig( TidyDoc tdocTo, TidyDoc tdocFrom );
352
/** Get character encoding name. Used with TidyCharEncoding,
353
** TidyOutCharEncoding, TidyInCharEncoding */
354
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetEncName( TidyDoc tdoc, TidyOptionId optId );
356
/** Get current pick list value for option by ID. Useful for enum types. */
357
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetCurrPick( TidyDoc tdoc, TidyOptionId optId);
359
/** Iterate over user declared tags */
360
TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDeclTagList( TidyDoc tdoc );
361
/** Get next declared tag of specified type: TidyInlineTags, TidyBlockTags,
362
** TidyEmptyTags, TidyPreTags */
363
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextDeclTag( TidyDoc tdoc,
365
TidyIterator* iter );
366
/** Get option description */
367
TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDoc( TidyDoc tdoc, TidyOption opt );
369
/** Iterate over a list of related options */
370
TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDocLinksList( TidyDoc tdoc,
372
/** Get next related option */
373
TIDY_EXPORT TidyOption TIDY_CALL tidyOptGetNextDocLinks( TidyDoc tdoc,
376
/** @} end Configuration group */
378
/** @defgroup IO I/O and Messages
380
** By default, Tidy will define, create and use
381
** instances of input and output handlers for
382
** standard C buffered I/O (i.e. FILE* stdin,
383
** FILE* stdout and FILE* stderr for content
384
** input, content output and diagnostic output,
385
** respectively. A FILE* cfgFile input handler
386
** will be used for config files. Command line
387
** options will just be set directly.
395
/** Input Callback: get next byte of input */
396
typedef int (TIDY_CALL *TidyGetByteFunc)( ulong sourceData );
398
/** Input Callback: unget a byte of input */
399
typedef void (TIDY_CALL *TidyUngetByteFunc)( ulong sourceData, byte bt );
401
/** Input Callback: is end of input? */
402
typedef Bool (TIDY_CALL *TidyEOFFunc)( ulong sourceData );
404
/** End of input "character" */
405
#define EndOfStream (~0u)
407
/** TidyInputSource - Delivers raw bytes of input
410
typedef struct _TidyInputSource
413
ulong sourceData; /**< Input context. Passed to callbacks */
416
TidyGetByteFunc getByte; /**< Pointer to "get byte" callback */
417
TidyUngetByteFunc ungetByte; /**< Pointer to "unget" callback */
418
TidyEOFFunc eof; /**< Pointer to "eof" callback */
421
/** Facilitates user defined source by providing
422
** an entry point to marshal pointers-to-functions.
423
** Needed by .NET and possibly other language bindings.
425
TIDY_EXPORT Bool TIDY_CALL tidyInitSource( TidyInputSource* source,
427
TidyGetByteFunc gbFunc,
428
TidyUngetByteFunc ugbFunc,
429
TidyEOFFunc endFunc );
431
/** Helper: get next byte from input source */
432
TIDY_EXPORT uint TIDY_CALL tidyGetByte( TidyInputSource* source );
434
/** Helper: unget byte back to input source */
435
TIDY_EXPORT void TIDY_CALL tidyUngetByte( TidyInputSource* source, uint byteValue );
437
/** Helper: check if input source at end */
438
TIDY_EXPORT Bool TIDY_CALL tidyIsEOF( TidyInputSource* source );
444
/** Output callback: send a byte to output */
445
typedef void (TIDY_CALL *TidyPutByteFunc)( ulong sinkData, byte bt );
448
/** TidyOutputSink - accepts raw bytes of output
451
typedef struct _TidyOutputSink
454
ulong sinkData; /**< Output context. Passed to callbacks */
457
TidyPutByteFunc putByte; /**< Pointer to "put byte" callback */
460
/** Facilitates user defined sinks by providing
461
** an entry point to marshal pointers-to-functions.
462
** Needed by .NET and possibly other language bindings.
464
TIDY_EXPORT Bool TIDY_CALL tidyInitSink( TidyOutputSink* sink,
466
TidyPutByteFunc pbFunc );
468
/** Helper: send a byte to output */
469
TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue );
472
/** Callback to filter messages by diagnostic level:
473
** info, warning, etc. Just set diagnostic output
474
** handler to redirect all diagnostics output. Return true
475
** to proceed with output, false to cancel.
477
typedef Bool (TIDY_CALL *TidyReportFilter)( TidyDoc tdoc, TidyReportLevel lvl,
478
uint line, uint col, ctmbstr mssg );
480
/** Give Tidy a filter callback to use */
481
TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc,
482
TidyReportFilter filtCallback );
484
/** Set error sink to named file */
485
TIDY_EXPORT FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam );
486
/** Set error sink to given buffer */
487
TIDY_EXPORT int TIDY_CALL tidySetErrorBuffer( TidyDoc tdoc, TidyBuffer* errbuf );
488
/** Set error sink to given generic sink */
489
TIDY_EXPORT int TIDY_CALL tidySetErrorSink( TidyDoc tdoc, TidyOutputSink* sink );
491
/** @} end IO group */
494
/** @defgroup Memory Memory Allocation
496
** By default, Tidy will use its own wrappers
497
** around standard C malloc/free calls.
498
** These wrappers will abort upon any failures.
499
** If any are set, all must be set.
500
** Pass NULL to clear previous setting.
502
** May be used to set environment-specific allocators
503
** such as used by web server plugins, etc.
508
/** Callback for "malloc" replacement */
509
typedef void* (TIDY_CALL *TidyMalloc)( size_t len );
510
/** Callback for "realloc" replacement */
511
typedef void* (TIDY_CALL *TidyRealloc)( void* buf, size_t len );
512
/** Callback for "free" replacement */
513
typedef void (TIDY_CALL *TidyFree)( void* buf );
514
/** Callback for "out of memory" panic state */
515
typedef void (TIDY_CALL *TidyPanic)( ctmbstr mssg );
517
/** Give Tidy a malloc() replacement */
518
TIDY_EXPORT Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc );
519
/** Give Tidy a realloc() replacement */
520
TIDY_EXPORT Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc );
521
/** Give Tidy a free() replacement */
522
TIDY_EXPORT Bool TIDY_CALL tidySetFreeCall( TidyFree ffree );
523
/** Give Tidy an "out of memory" handler */
524
TIDY_EXPORT Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic );
526
/** @} end Memory group */
528
/* TODO: Catalog all messages for easy translation
529
TIDY_EXPORT ctmbstr tidyLookupMessage( int errorNo );
534
/** @defgroup Parse Document Parse
536
** Parse markup from a given input source. String and filename
537
** functions added for convenience. HTML/XHTML version determined
542
/** Parse markup in named file */
543
TIDY_EXPORT int TIDY_CALL tidyParseFile( TidyDoc tdoc, ctmbstr filename );
545
/** Parse markup from the standard input */
546
TIDY_EXPORT int TIDY_CALL tidyParseStdin( TidyDoc tdoc );
548
/** Parse markup in given string */
549
TIDY_EXPORT int TIDY_CALL tidyParseString( TidyDoc tdoc, ctmbstr content );
551
/** Parse markup in given buffer */
552
TIDY_EXPORT int TIDY_CALL tidyParseBuffer( TidyDoc tdoc, TidyBuffer* buf );
554
/** Parse markup in given generic input source */
555
TIDY_EXPORT int TIDY_CALL tidyParseSource( TidyDoc tdoc, TidyInputSource* source);
557
/** @} End Parse group */
560
/** @defgroup Clean Diagnostics and Repair
564
/** Execute configured cleanup and repair operations on parsed markup */
565
TIDY_EXPORT int TIDY_CALL tidyCleanAndRepair( TidyDoc tdoc );
567
/** Run configured diagnostics on parsed and repaired markup.
568
** Must call tidyCleanAndRepair() first.
570
TIDY_EXPORT int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc );
572
/** @} end Clean group */
575
/** @defgroup Save Document Save Functions
577
** Save currently parsed document to the given output sink. File name
578
** and string/buffer functions provided for convenience.
582
/** Save to named file */
583
TIDY_EXPORT int TIDY_CALL tidySaveFile( TidyDoc tdoc, ctmbstr filename );
585
/** Save to standard output (FILE*) */
586
TIDY_EXPORT int TIDY_CALL tidySaveStdout( TidyDoc tdoc );
588
/** Save to given TidyBuffer object */
589
TIDY_EXPORT int TIDY_CALL tidySaveBuffer( TidyDoc tdoc, TidyBuffer* buf );
591
/** Save document to application buffer. If buffer is not big enough,
592
** ENOMEM will be returned and the necessary buffer size will be placed
595
TIDY_EXPORT int TIDY_CALL tidySaveString( TidyDoc tdoc,
596
tmbstr buffer, uint* buflen );
598
/** Save to given generic output sink */
599
TIDY_EXPORT int TIDY_CALL tidySaveSink( TidyDoc tdoc, TidyOutputSink* sink );
601
/** @} end Save group */
604
/** @addtogroup Basic
607
/** Save current settings to named file.
608
Only non-default values are written. */
609
TIDY_EXPORT int TIDY_CALL tidyOptSaveFile( TidyDoc tdoc, ctmbstr cfgfil );
611
/** Save current settings to given output sink.
612
Only non-default values are written. */
613
TIDY_EXPORT int TIDY_CALL tidyOptSaveSink( TidyDoc tdoc, TidyOutputSink* sink );
616
/* Error reporting functions
619
/** Write more complete information about errors to current error sink. */
620
TIDY_EXPORT void TIDY_CALL tidyErrorSummary( TidyDoc tdoc );
622
/** Write more general information about markup to current error sink. */
623
TIDY_EXPORT void TIDY_CALL tidyGeneralInfo( TidyDoc tdoc );
625
/** @} end Basic group (again) */
628
/** @defgroup Tree Document Tree
630
** A parsed and, optionally, repaired document is
631
** represented by Tidy as a Tree, much like a W3C DOM.
632
** This tree may be traversed using these functions.
633
** The following snippet gives a basic idea how these
634
** functions can be used.
637
void dumpNode( TidyNode tnod, int indent )
641
for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) )
644
switch ( tidyNodeGetType(child) )
646
case TidyNode_Root: name = "Root"; break;
647
case TidyNode_DocType: name = "DOCTYPE"; break;
648
case TidyNode_Comment: name = "Comment"; break;
649
case TidyNode_ProcIns: name = "Processing Instruction"; break;
650
case TidyNode_Text: name = "Text"; break;
651
case TidyNode_CDATA: name = "CDATA"; break;
652
case TidyNode_Section: name = "XML Section"; break;
653
case TidyNode_Asp: name = "ASP"; break;
654
case TidyNode_Jste: name = "JSTE"; break;
655
case TidyNode_Php: name = "PHP"; break;
656
case TidyNode_XmlDecl: name = "XML Declaration"; break;
660
case TidyNode_StartEnd:
662
name = tidyNodeGetName( child );
665
assert( name != NULL );
666
printf( "\%*.*sNode: \%s\\n", indent, indent, " ", name );
667
dumpNode( child, indent + 4 );
671
void dumpDoc( TidyDoc tdoc )
673
dumpNode( tidyGetRoot(tdoc), 0 );
676
void dumpBody( TidyDoc tdoc )
678
dumpNode( tidyGetBody(tdoc), 0 );
686
TIDY_EXPORT TidyNode TIDY_CALL tidyGetRoot( TidyDoc tdoc );
687
TIDY_EXPORT TidyNode TIDY_CALL tidyGetHtml( TidyDoc tdoc );
688
TIDY_EXPORT TidyNode TIDY_CALL tidyGetHead( TidyDoc tdoc );
689
TIDY_EXPORT TidyNode TIDY_CALL tidyGetBody( TidyDoc tdoc );
692
TIDY_EXPORT TidyNode TIDY_CALL tidyGetParent( TidyNode tnod );
693
TIDY_EXPORT TidyNode TIDY_CALL tidyGetChild( TidyNode tnod );
696
TIDY_EXPORT TidyNode TIDY_CALL tidyGetNext( TidyNode tnod );
697
TIDY_EXPORT TidyNode TIDY_CALL tidyGetPrev( TidyNode tnod );
699
/* Null for non-element nodes and all pure HTML
700
TIDY_EXPORT ctmbstr tidyNodeNsLocal( TidyNode tnod );
701
TIDY_EXPORT ctmbstr tidyNodeNsPrefix( TidyNode tnod );
702
TIDY_EXPORT ctmbstr tidyNodeNsUri( TidyNode tnod );
705
/* Iterate over attribute values */
706
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrFirst( TidyNode tnod );
707
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrNext( TidyAttr tattr );
709
TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrName( TidyAttr tattr );
710
TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrValue( TidyAttr tattr );
712
/* Null for pure HTML
713
TIDY_EXPORT ctmbstr tidyAttrNsLocal( TidyAttr tattr );
714
TIDY_EXPORT ctmbstr tidyAttrNsPrefix( TidyAttr tattr );
715
TIDY_EXPORT ctmbstr tidyAttrNsUri( TidyAttr tattr );
718
/** @} end Tree group */
721
/** @defgroup NodeAsk Node Interrogation
723
** Get information about any givent node.
728
TIDY_EXPORT TidyNodeType TIDY_CALL tidyNodeGetType( TidyNode tnod );
729
TIDY_EXPORT ctmbstr TIDY_CALL tidyNodeGetName( TidyNode tnod );
731
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsText( TidyNode tnod );
732
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsProp( TidyDoc tdoc, TidyNode tnod );
733
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHeader( TidyNode tnod ); /* h1, h2, ... */
735
TIDY_EXPORT Bool TIDY_CALL tidyNodeHasText( TidyDoc tdoc, TidyNode tnod );
736
TIDY_EXPORT Bool TIDY_CALL tidyNodeGetText( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf );
738
TIDY_EXPORT TidyTagId TIDY_CALL tidyNodeGetId( TidyNode tnod );
740
TIDY_EXPORT uint TIDY_CALL tidyNodeLine( TidyNode tnod );
741
TIDY_EXPORT uint TIDY_CALL tidyNodeColumn( TidyNode tnod );
743
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHTML( TidyNode tnod );
744
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHEAD( TidyNode tnod );
745
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTITLE( TidyNode tnod );
746
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASE( TidyNode tnod );
747
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMETA( TidyNode tnod );
748
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBODY( TidyNode tnod );
749
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAMESET( TidyNode tnod );
750
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAME( TidyNode tnod );
751
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIFRAME( TidyNode tnod );
752
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOFRAMES( TidyNode tnod );
753
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHR( TidyNode tnod );
754
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH1( TidyNode tnod );
755
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH2( TidyNode tnod );
756
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPRE( TidyNode tnod );
757
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLISTING( TidyNode tnod );
758
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsP( TidyNode tnod );
759
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsUL( TidyNode tnod );
760
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOL( TidyNode tnod );
761
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDL( TidyNode tnod );
762
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIR( TidyNode tnod );
763
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLI( TidyNode tnod );
764
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDT( TidyNode tnod );
765
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDD( TidyNode tnod );
766
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTABLE( TidyNode tnod );
767
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCAPTION( TidyNode tnod );
768
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTD( TidyNode tnod );
769
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTH( TidyNode tnod );
770
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTR( TidyNode tnod );
771
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOL( TidyNode tnod );
772
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOLGROUP( TidyNode tnod );
773
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBR( TidyNode tnod );
774
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsA( TidyNode tnod );
775
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLINK( TidyNode tnod );
776
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsB( TidyNode tnod );
777
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsI( TidyNode tnod );
778
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRONG( TidyNode tnod );
779
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEM( TidyNode tnod );
780
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBIG( TidyNode tnod );
781
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSMALL( TidyNode tnod );
782
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPARAM( TidyNode tnod );
783
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTION( TidyNode tnod );
784
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTGROUP( TidyNode tnod );
785
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIMG( TidyNode tnod );
786
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMAP( TidyNode tnod );
787
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAREA( TidyNode tnod );
788
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOBR( TidyNode tnod );
789
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsWBR( TidyNode tnod );
790
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFONT( TidyNode tnod );
791
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLAYER( TidyNode tnod );
792
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPACER( TidyNode tnod );
793
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCENTER( TidyNode tnod );
794
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTYLE( TidyNode tnod );
795
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSCRIPT( TidyNode tnod );
796
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOSCRIPT( TidyNode tnod );
797
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFORM( TidyNode tnod );
798
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTEXTAREA( TidyNode tnod );
799
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLOCKQUOTE( TidyNode tnod );
800
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAPPLET( TidyNode tnod );
801
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOBJECT( TidyNode tnod );
802
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIV( TidyNode tnod );
803
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPAN( TidyNode tnod );
804
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsINPUT( TidyNode tnod );
805
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsQ( TidyNode tnod );
806
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLABEL( TidyNode tnod );
807
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH3( TidyNode tnod );
808
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH4( TidyNode tnod );
809
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH5( TidyNode tnod );
810
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH6( TidyNode tnod );
811
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsADDRESS( TidyNode tnod );
812
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsXMP( TidyNode tnod );
813
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSELECT( TidyNode tnod );
814
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLINK( TidyNode tnod );
815
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMARQUEE( TidyNode tnod );
816
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEMBED( TidyNode tnod );
817
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASEFONT( TidyNode tnod );
818
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsISINDEX( TidyNode tnod );
819
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsS( TidyNode tnod );
820
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRIKE( TidyNode tnod );
821
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsU( TidyNode tnod );
822
TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMENU( TidyNode tnod );
824
/** @} End NodeAsk group */
827
/** @defgroup Attribute Attribute Interrogation
829
** Get information about any given attribute.
833
TIDY_EXPORT TidyAttrId TIDY_CALL tidyAttrGetId( TidyAttr tattr );
834
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsEvent( TidyAttr tattr );
835
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsProp( TidyAttr tattr );
837
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHREF( TidyAttr tattr );
838
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSRC( TidyAttr tattr );
839
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsID( TidyAttr tattr );
840
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsNAME( TidyAttr tattr );
841
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSUMMARY( TidyAttr tattr );
842
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALT( TidyAttr tattr );
843
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLONGDESC( TidyAttr tattr );
844
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsUSEMAP( TidyAttr tattr );
845
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsISMAP( TidyAttr tattr );
846
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANGUAGE( TidyAttr tattr );
847
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTYPE( TidyAttr tattr );
848
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVALUE( TidyAttr tattr );
849
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCONTENT( TidyAttr tattr );
850
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTITLE( TidyAttr tattr );
851
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsXMLNS( TidyAttr tattr );
852
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsDATAFLD( TidyAttr tattr );
853
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsWIDTH( TidyAttr tattr );
854
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHEIGHT( TidyAttr tattr );
855
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsFOR( TidyAttr tattr );
856
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSELECTED( TidyAttr tattr );
857
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCHECKED( TidyAttr tattr );
858
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANG( TidyAttr tattr );
859
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTARGET( TidyAttr tattr );
860
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHTTP_EQUIV( TidyAttr tattr );
861
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsREL( TidyAttr tattr );
862
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEMOVE( TidyAttr tattr );
863
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEDOWN( TidyAttr tattr );
864
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEUP( TidyAttr tattr );
865
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnCLICK( TidyAttr tattr );
866
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOVER( TidyAttr tattr );
867
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOUT( TidyAttr tattr );
868
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYDOWN( TidyAttr tattr );
869
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYUP( TidyAttr tattr );
870
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYPRESS( TidyAttr tattr );
871
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnFOCUS( TidyAttr tattr );
872
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnBLUR( TidyAttr tattr );
873
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsBGCOLOR( TidyAttr tattr );
874
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLINK( TidyAttr tattr );
875
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALINK( TidyAttr tattr );
876
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVLINK( TidyAttr tattr );
877
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTEXT( TidyAttr tattr );
878
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSTYLE( TidyAttr tattr );
879
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsABBR( TidyAttr tattr );
880
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCOLSPAN( TidyAttr tattr );
881
TIDY_EXPORT Bool TIDY_CALL tidyAttrIsROWSPAN( TidyAttr tattr );
883
/** @} end AttrAsk group */
886
/** @defgroup AttrGet Attribute Retrieval
888
** Lookup an attribute from a given node
893
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHREF( TidyNode tnod );
894
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSRC( TidyNode tnod );
895
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetID( TidyNode tnod );
896
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetNAME( TidyNode tnod );
897
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSUMMARY( TidyNode tnod );
898
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALT( TidyNode tnod );
899
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLONGDESC( TidyNode tnod );
900
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetUSEMAP( TidyNode tnod );
901
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetISMAP( TidyNode tnod );
902
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANGUAGE( TidyNode tnod );
903
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTYPE( TidyNode tnod );
904
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVALUE( TidyNode tnod );
905
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCONTENT( TidyNode tnod );
906
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTITLE( TidyNode tnod );
907
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetXMLNS( TidyNode tnod );
908
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetDATAFLD( TidyNode tnod );
909
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetWIDTH( TidyNode tnod );
910
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHEIGHT( TidyNode tnod );
911
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetFOR( TidyNode tnod );
912
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSELECTED( TidyNode tnod );
913
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCHECKED( TidyNode tnod );
914
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANG( TidyNode tnod );
915
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTARGET( TidyNode tnod );
916
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHTTP_EQUIV( TidyNode tnod );
917
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetREL( TidyNode tnod );
918
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEMOVE( TidyNode tnod );
919
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEDOWN( TidyNode tnod );
920
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEUP( TidyNode tnod );
921
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnCLICK( TidyNode tnod );
922
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOVER( TidyNode tnod );
923
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOUT( TidyNode tnod );
924
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYDOWN( TidyNode tnod );
925
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYUP( TidyNode tnod );
926
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYPRESS( TidyNode tnod );
927
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnFOCUS( TidyNode tnod );
928
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnBLUR( TidyNode tnod );
929
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetBGCOLOR( TidyNode tnod );
930
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLINK( TidyNode tnod );
931
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALINK( TidyNode tnod );
932
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVLINK( TidyNode tnod );
933
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTEXT( TidyNode tnod );
934
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSTYLE( TidyNode tnod );
935
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetABBR( TidyNode tnod );
936
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCOLSPAN( TidyNode tnod );
937
TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetROWSPAN( TidyNode tnod );
940
/** @} end AttrGet group */
945
#endif /* __TIDY_H__ */