HTML Tidy  4.9.15
The HTACG Tidy HTML Project
tidy.h
Go to the documentation of this file.
1 #ifndef __TIDY_H__
2 #define __TIDY_H__
3 
4 /** @file tidy.h - Defines HTML Tidy API implemented by tidy library.
5 
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.
9 
10  Looking ahead to a C++ wrapper, C functions always pass
11  this-equivalent as 1st arg.
12 
13 
14  Copyright (c) 1998-2008 World Wide Web Consortium
15  (Massachusetts Institute of Technology, European Research
16  Consortium for Informatics and Mathematics, Keio University).
17  All Rights Reserved.
18 
19  Contributing Author(s):
20 
21  Dave Raggett <dsr@w3.org>
22 
23  The contributing author(s) would like to thank all those who
24  helped with testing, bug fixes and suggestions for improvements.
25  This wouldn't have been possible without your help.
26 
27  COPYRIGHT NOTICE:
28 
29  This software and documentation is provided "as is," and
30  the copyright holders and contributing author(s) make no
31  representations or warranties, express or implied, including
32  but not limited to, warranties of merchantability or fitness
33  for any particular purpose or that the use of the software or
34  documentation will not infringe any third party patents,
35  copyrights, trademarks or other rights.
36 
37  The copyright holders and contributing author(s) will not be held
38  liable for any direct, indirect, special or consequential damages
39  arising out of any use of the software or documentation, even if
40  advised of the possibility of such damage.
41 
42  Permission is hereby granted to use, copy, modify, and distribute
43  this source code, or portions hereof, documentation and executables,
44  for any purpose, without fee, subject to the following restrictions:
45 
46  1. The origin of this source code must not be misrepresented.
47  2. Altered versions must be plainly marked as such and must
48  not be misrepresented as being the original source.
49  3. This Copyright notice may not be removed or altered from any
50  source or altered source distribution.
51 
52  The copyright holders and contributing author(s) specifically
53  permit, without fee, and encourage the use of this source code
54  as a component for supporting the Hypertext Markup Language in
55  commercial products. If you use this source code in a product,
56  acknowledgment is not required but would be appreciated.
57 
58 
59  Created 2001-05-20 by Charles Reitzel
60  Updated 2002-07-01 by Charles Reitzel - 1st Implementation
61 
62 */
63 
64 #include "platform.h"
65 #include "tidyenum.h"
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
71 /** @defgroup Opaque Opaque Types
72 **
73 ** Cast to implementation types within lib.
74 ** Reduces inter-dependencies/conflicts w/ application code.
75 ** @{
76 */
77 
78 /** @struct TidyDoc
79 ** Opaque document datatype
80 */
81 opaque_type( TidyDoc );
82 
83 /** @struct TidyOption
84 ** Opaque option datatype
85 */
86 opaque_type( TidyOption );
87 
88 /** @struct TidyNode
89 ** Opaque node datatype
90 */
91 opaque_type( TidyNode );
92 
93 /** @struct TidyAttr
94 ** Opaque attribute datatype
95 */
96 opaque_type( TidyAttr );
97 
98 /** @} end Opaque group */
99 
100 TIDY_STRUCT struct _TidyBuffer;
101 typedef struct _TidyBuffer TidyBuffer;
102 
103 
104 /** @defgroup Memory Memory Allocation
105 **
106 ** Tidy uses a user provided allocator for all
107 ** memory allocations. If this allocator is
108 ** not provided, then a default allocator is
109 ** used which simply wraps standard C malloc/free
110 ** calls. These wrappers call the panic function
111 ** upon any failure. The default panic function
112 ** prints an out of memory message to stderr, and
113 ** calls exit(2).
114 **
115 ** For applications in which it is unacceptable to
116 ** abort in the case of memory allocation, then the
117 ** panic function can be replaced with one which
118 ** longjmps() out of the tidy code. For this to
119 ** clean up completely, you should be careful not
120 ** to use any tidy methods that open files as these
121 ** will not be closed before panic() is called.
122 **
123 ** TODO: associate file handles with tidyDoc and
124 ** ensure that tidyDocRelease() can close them all.
125 **
126 ** Calling the withAllocator() family (
127 ** tidyCreateWithAllocator, tidyBufInitWithAllocator,
128 ** tidyBufAllocWithAllocator) allow settings custom
129 ** allocators).
130 **
131 ** All parts of the document use the same allocator.
132 ** Calls that require a user provided buffer can
133 ** optionally use a different allocator.
134 **
135 ** For reference in designing a plug-in allocator,
136 ** most allocations made by tidy are less than 100
137 ** bytes, corresponding to attribute names/values, etc.
138 **
139 ** There is also an additional class of much larger
140 ** allocations which are where most of the data from
141 ** the lexer is stored. (It is not currently possible
142 ** to use a separate allocator for the lexer, this
143 ** would be a useful extension).
144 **
145 ** In general, approximately 1/3rd of the memory
146 ** used by tidy is freed during the parse, so if
147 ** memory usage is an issue then an allocator that
148 ** can reuse this memory is a good idea.
149 **
150 ** @{
151 */
152 
153 /** Prototype for the allocator's function table */
154 struct _TidyAllocatorVtbl;
155 /** The allocators function table */
157 
158 /** Prototype for the allocator */
159 struct _TidyAllocator;
160 /** The allocator **/
162 
163 /** An allocator's function table. All functions here must
164  be provided.
165  */
167  /** Called to allocate a block of nBytes of memory */
168  void* (TIDY_CALL *alloc)( TidyAllocator *self, size_t nBytes );
169  /** Called to resize (grow, in general) a block of memory.
170  Must support being called with NULL.
171  */
172  void* (TIDY_CALL *realloc)( TidyAllocator *self, void *block, size_t nBytes );
173  /** Called to free a previously allocated block of memory */
174  void (TIDY_CALL *free)( TidyAllocator *self, void *block);
175  /** Called when a panic condition is detected. Must support
176  block == NULL. This function is not called if either alloc
177  or realloc fails; it is up to the allocator to do this.
178  Currently this function can only be called if an error is
179  detected in the tree integrity via the internal function
180  CheckNodeIntegrity(). This is a situation that can
181  only arise in the case of a programming error in tidylib.
182  You can turn off node integrity checking by defining
183  the constant NO_NODE_INTEGRITY_CHECK during the build.
184  **/
185  void (TIDY_CALL *panic)( TidyAllocator *self, ctmbstr msg );
186 };
187 
188 /** An allocator. To create your own allocator, do something like
189  the following:
190 
191  typedef struct _MyAllocator {
192  TidyAllocator base;
193  ...other custom allocator state...
194  } MyAllocator;
195 
196  void* MyAllocator_alloc(TidyAllocator *base, void *block, size_t nBytes)
197  {
198  MyAllocator *self = (MyAllocator*)base;
199  ...
200  }
201  (etc)
202 
203  static const TidyAllocatorVtbl MyAllocatorVtbl = {
204  MyAllocator_alloc,
205  MyAllocator_realloc,
206  MyAllocator_free,
207  MyAllocator_panic
208  };
209 
210  myAllocator allocator;
211  TidyDoc doc;
212 
213  allocator.base.vtbl = &amp;MyAllocatorVtbl;
214  ...initialise allocator specific state...
215  doc = tidyCreateWithAllocator(&allocator);
216  ...
217 
218  Although this looks slightly long winded, the advantage is that to create
219  a custom allocator you simply need to set the vtbl pointer correctly.
220  The vtbl itself can reside in static/global data, and hence does not
221  need to be initialised each time an allocator is created, and furthermore
222  the memory is shared amongst all created allocators.
223 */
225  const TidyAllocatorVtbl *vtbl;
226 };
227 
228 /** Callback for "malloc" replacement */
229 typedef void* (TIDY_CALL *TidyMalloc)( size_t len );
230 /** Callback for "realloc" replacement */
231 typedef void* (TIDY_CALL *TidyRealloc)( void* buf, size_t len );
232 /** Callback for "free" replacement */
233 typedef void (TIDY_CALL *TidyFree)( void* buf );
234 /** Callback for "out of memory" panic state */
235 typedef void (TIDY_CALL *TidyPanic)( ctmbstr mssg );
236 
237 
238 /** Give Tidy a malloc() replacement */
239 TIDY_EXPORT Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc );
240 /** Give Tidy a realloc() replacement */
241 TIDY_EXPORT Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc );
242 /** Give Tidy a free() replacement */
243 TIDY_EXPORT Bool TIDY_CALL tidySetFreeCall( TidyFree ffree );
244 /** Give Tidy an "out of memory" handler */
245 TIDY_EXPORT Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic );
246 
247 /** @} end Memory group */
248 
249 /** @defgroup Basic Basic Operations
250 **
251 ** Tidy public interface
252 **
253 ** Several functions return an integer document status:
254 **
255 ** <pre>
256 ** 0 -> SUCCESS
257 ** >0 -> 1 == TIDY WARNING, 2 == TIDY ERROR
258 ** <0 -> SEVERE ERROR
259 ** </pre>
260 **
261 The following is a short example program.
262 
263 <pre>
264 #include &lt;tidy.h&gt;
265 #include &lt;buffio.h&gt;
266 #include &lt;stdio.h&gt;
267 #include &lt;errno.h&gt;
268 
269 
270 int main(int argc, char **argv )
271 {
272  const char* input = "&lt;title&gt;Foo&lt;/title&gt;&lt;p&gt;Foo!";
273  TidyBuffer output;
274  TidyBuffer errbuf;
275  int rc = -1;
276  Bool ok;
277 
278  TidyDoc tdoc = tidyCreate(); // Initialize "document"
279  tidyBufInit( &amp;output );
280  tidyBufInit( &amp;errbuf );
281  printf( "Tidying:\t\%s\\n", input );
282 
283  ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes ); // Convert to XHTML
284  if ( ok )
285  rc = tidySetErrorBuffer( tdoc, &amp;errbuf ); // Capture diagnostics
286  if ( rc &gt;= 0 )
287  rc = tidyParseString( tdoc, input ); // Parse the input
288  if ( rc &gt;= 0 )
289  rc = tidyCleanAndRepair( tdoc ); // Tidy it up!
290  if ( rc &gt;= 0 )
291  rc = tidyRunDiagnostics( tdoc ); // Kvetch
292  if ( rc &gt; 1 ) // If error, force output.
293  rc = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? rc : -1 );
294  if ( rc &gt;= 0 )
295  rc = tidySaveBuffer( tdoc, &amp;output ); // Pretty Print
296 
297  if ( rc &gt;= 0 )
298  {
299  if ( rc &gt; 0 )
300  printf( "\\nDiagnostics:\\n\\n\%s", errbuf.bp );
301  printf( "\\nAnd here is the result:\\n\\n\%s", output.bp );
302  }
303  else
304  printf( "A severe error (\%d) occurred.\\n", rc );
305 
306  tidyBufFree( &amp;output );
307  tidyBufFree( &amp;errbuf );
308  tidyRelease( tdoc );
309  return rc;
310 }
311 </pre>
312 ** @{
313 */
314 
315 TIDY_EXPORT TidyDoc TIDY_CALL tidyCreate(void);
316 TIDY_EXPORT TidyDoc TIDY_CALL tidyCreateWithAllocator( TidyAllocator *allocator );
317 TIDY_EXPORT void TIDY_CALL tidyRelease( TidyDoc tdoc );
318 
319 /** Let application store a chunk of data w/ each Tidy instance.
320 ** Useful for callbacks.
321 */
322 TIDY_EXPORT void TIDY_CALL tidySetAppData( TidyDoc tdoc, void* appData );
323 
324 /** Get application data set previously */
325 TIDY_EXPORT void* TIDY_CALL tidyGetAppData( TidyDoc tdoc );
326 
327 /** Get release date (version) for current library
328  ** @deprecated tidyReleaseDate() is deprecated in favor of semantic
329  ** versioning and should be replaced with tidyLibraryVersion().
330  */
331 
332 TIDY_EXPORT ctmbstr TIDY_CALL tidyReleaseDate(void);
333 
334 /** Get version number for the current library */
335 TIDY_EXPORT ctmbstr tidyLibraryVersion(void);
336 
337 /* Diagnostics and Repair
338 */
339 
340 /** Get status of current document. */
341 TIDY_EXPORT int TIDY_CALL tidyStatus( TidyDoc tdoc );
342 
343 /** Detected HTML version: 0, 2, 3 or 4 */
344 TIDY_EXPORT int TIDY_CALL tidyDetectedHtmlVersion( TidyDoc tdoc );
345 
346 /** Input is XHTML? */
347 TIDY_EXPORT Bool TIDY_CALL tidyDetectedXhtml( TidyDoc tdoc );
348 
349 /** Input is generic XML (not HTML or XHTML)? */
350 TIDY_EXPORT Bool TIDY_CALL tidyDetectedGenericXml( TidyDoc tdoc );
351 
352 /** Number of Tidy errors encountered. If > 0, output is suppressed
353 ** unless TidyForceOutput is set.
354 */
355 TIDY_EXPORT uint TIDY_CALL tidyErrorCount( TidyDoc tdoc );
356 
357 /** Number of Tidy warnings encountered. */
358 TIDY_EXPORT uint TIDY_CALL tidyWarningCount( TidyDoc tdoc );
359 
360 /** Number of Tidy accessibility warnings encountered. */
361 TIDY_EXPORT uint TIDY_CALL tidyAccessWarningCount( TidyDoc tdoc );
362 
363 /** Number of Tidy configuration errors encountered. */
364 TIDY_EXPORT uint TIDY_CALL tidyConfigErrorCount( TidyDoc tdoc );
365 
366 /* Get/Set configuration options
367 */
368 /** Load an ASCII Tidy configuration file */
369 TIDY_EXPORT int TIDY_CALL tidyLoadConfig( TidyDoc tdoc, ctmbstr configFile );
370 
371 /** Load a Tidy configuration file with the specified character encoding */
372 TIDY_EXPORT int TIDY_CALL tidyLoadConfigEnc( TidyDoc tdoc, ctmbstr configFile,
373  ctmbstr charenc );
374 
375 TIDY_EXPORT Bool TIDY_CALL tidyFileExists( TidyDoc tdoc, ctmbstr filename );
376 
377 
378 /** Set the input/output character encoding for parsing markup.
379 ** Values include: ascii, latin1, raw, utf8, iso2022, mac,
380 ** win1252, utf16le, utf16be, utf16, big5 and shiftjis. Case in-sensitive.
381 */
382 TIDY_EXPORT int TIDY_CALL tidySetCharEncoding( TidyDoc tdoc, ctmbstr encnam );
383 
384 /** Set the input encoding for parsing markup.
385 ** As for tidySetCharEncoding but only affects the input encoding
386 **/
387 TIDY_EXPORT int TIDY_CALL tidySetInCharEncoding( TidyDoc tdoc, ctmbstr encnam );
388 
389 /** Set the output encoding.
390 **/
391 TIDY_EXPORT int TIDY_CALL tidySetOutCharEncoding( TidyDoc tdoc, ctmbstr encnam );
392 
393 /** @} end Basic group */
394 
395 
396 /** @defgroup Configuration Configuration Options
397 **
398 ** Functions for getting and setting Tidy configuration options.
399 ** @{
400 */
401 
402 /** Applications using TidyLib may want to augment command-line and
403 ** configuration file options. Setting this callback allows an application
404 ** developer to examine command-line and configuration file options after
405 ** TidyLib has examined them and failed to recognize them.
406 **/
407 
408 typedef Bool (TIDY_CALL *TidyOptCallback)( ctmbstr option, ctmbstr value );
409 
410 TIDY_EXPORT Bool TIDY_CALL tidySetOptionCallback( TidyDoc tdoc, TidyOptCallback pOptCallback );
411 
412 /** Get option ID by name */
413 TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetIdForName( ctmbstr optnam );
414 
415 /** Get iterator for list of option */
416 /**
417 Example:
418 <pre>
419 TidyIterator itOpt = tidyGetOptionList( tdoc );
420 while ( itOpt )
421 {
422  TidyOption opt = tidyGetNextOption( tdoc, &itOpt );
423  .. get/set option values ..
424 }
425 </pre>
426 */
427 
428 TIDY_EXPORT TidyIterator TIDY_CALL tidyGetOptionList( TidyDoc tdoc );
429 /** Get next Option */
430 TIDY_EXPORT TidyOption TIDY_CALL tidyGetNextOption( TidyDoc tdoc, TidyIterator* pos );
431 
432 /** Lookup option by ID */
433 TIDY_EXPORT TidyOption TIDY_CALL tidyGetOption( TidyDoc tdoc, TidyOptionId optId );
434 /** Lookup option by name */
435 TIDY_EXPORT TidyOption TIDY_CALL tidyGetOptionByName( TidyDoc tdoc, ctmbstr optnam );
436 
437 /** Get ID of given Option */
438 TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetId( TidyOption opt );
439 
440 /** Get name of given Option */
441 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetName( TidyOption opt );
442 
443 /** Get datatype of given Option */
444 TIDY_EXPORT TidyOptionType TIDY_CALL tidyOptGetType( TidyOption opt );
445 
446 /** Is Option read-only? */
447 TIDY_EXPORT Bool TIDY_CALL tidyOptIsReadOnly( TidyOption opt );
448 
449 /** Get category of given Option */
450 TIDY_EXPORT TidyConfigCategory TIDY_CALL tidyOptGetCategory( TidyOption opt );
451 
452 /** Get default value of given Option as a string */
453 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDefault( TidyOption opt );
454 
455 /** Get default value of given Option as an unsigned integer */
456 TIDY_EXPORT ulong TIDY_CALL tidyOptGetDefaultInt( TidyOption opt );
457 
458 /** Get default value of given Option as a Boolean value */
459 TIDY_EXPORT Bool TIDY_CALL tidyOptGetDefaultBool( TidyOption opt );
460 
461 /** Iterate over Option "pick list" */
462 TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetPickList( TidyOption opt );
463 /** Get next string value of Option "pick list" */
464 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextPick( TidyOption opt, TidyIterator* pos );
465 
466 /** Get current Option value as a string */
467 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetValue( TidyDoc tdoc, TidyOptionId optId );
468 /** Set Option value as a string */
469 TIDY_EXPORT Bool TIDY_CALL tidyOptSetValue( TidyDoc tdoc, TidyOptionId optId, ctmbstr val );
470 /** Set named Option value as a string. Good if not sure of type. */
471 TIDY_EXPORT Bool TIDY_CALL tidyOptParseValue( TidyDoc tdoc, ctmbstr optnam, ctmbstr val );
472 
473 /** Get current Option value as an integer */
474 TIDY_EXPORT ulong TIDY_CALL tidyOptGetInt( TidyDoc tdoc, TidyOptionId optId );
475 /** Set Option value as an integer */
476 TIDY_EXPORT Bool TIDY_CALL tidyOptSetInt( TidyDoc tdoc, TidyOptionId optId, ulong val );
477 
478 /** Get current Option value as a Boolean flag */
479 TIDY_EXPORT Bool TIDY_CALL tidyOptGetBool( TidyDoc tdoc, TidyOptionId optId );
480 /** Set Option value as a Boolean flag */
481 TIDY_EXPORT Bool TIDY_CALL tidyOptSetBool( TidyDoc tdoc, TidyOptionId optId, Bool val );
482 
483 /** Reset option to default value by ID */
484 TIDY_EXPORT Bool TIDY_CALL tidyOptResetToDefault( TidyDoc tdoc, TidyOptionId opt );
485 /** Reset all options to their default values */
486 TIDY_EXPORT Bool TIDY_CALL tidyOptResetAllToDefault( TidyDoc tdoc );
487 
488 /** Take a snapshot of current config settings */
489 TIDY_EXPORT Bool TIDY_CALL tidyOptSnapshot( TidyDoc tdoc );
490 /** Reset config settings to snapshot (after document processing) */
491 TIDY_EXPORT Bool TIDY_CALL tidyOptResetToSnapshot( TidyDoc tdoc );
492 
493 /** Any settings different than default? */
494 TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanDefault( TidyDoc tdoc );
495 /** Any settings different than snapshot? */
496 TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanSnapshot( TidyDoc tdoc );
497 
498 /** Copy current configuration settings from one document to another */
499 TIDY_EXPORT Bool TIDY_CALL tidyOptCopyConfig( TidyDoc tdocTo, TidyDoc tdocFrom );
500 
501 /** Get character encoding name. Used with TidyCharEncoding,
502 ** TidyOutCharEncoding, TidyInCharEncoding */
503 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetEncName( TidyDoc tdoc, TidyOptionId optId );
504 
505 /** Get current pick list value for option by ID. Useful for enum types. */
506 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetCurrPick( TidyDoc tdoc, TidyOptionId optId);
507 
508 /** Iterate over user declared tags */
509 TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDeclTagList( TidyDoc tdoc );
510 /** Get next declared tag of specified type: TidyInlineTags, TidyBlockTags,
511 ** TidyEmptyTags, TidyPreTags */
512 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextDeclTag( TidyDoc tdoc,
513  TidyOptionId optId,
514  TidyIterator* iter );
515 /** Get option description */
516 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDoc( TidyDoc tdoc, TidyOption opt );
517 
518 /** Iterate over a list of related options */
519 TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDocLinksList( TidyDoc tdoc,
520  TidyOption opt );
521 /** Get next related option */
522 TIDY_EXPORT TidyOption TIDY_CALL tidyOptGetNextDocLinks( TidyDoc tdoc,
523  TidyIterator* pos );
524 
525 /** @} end Configuration group */
526 
527 /** @defgroup IO I/O and Messages
528 **
529 ** By default, Tidy will define, create and use
530 ** instances of input and output handlers for
531 ** standard C buffered I/O (i.e. FILE* stdin,
532 ** FILE* stdout and FILE* stderr for content
533 ** input, content output and diagnostic output,
534 ** respectively. A FILE* cfgFile input handler
535 ** will be used for config files. Command line
536 ** options will just be set directly.
537 **
538 ** @{
539 */
540 
541 /*****************
542  Input Source
543 *****************/
544 /** Input Callback: get next byte of input */
545 typedef int (TIDY_CALL *TidyGetByteFunc)( void* sourceData );
546 
547 /** Input Callback: unget a byte of input */
548 typedef void (TIDY_CALL *TidyUngetByteFunc)( void* sourceData, byte bt );
549 
550 /** Input Callback: is end of input? */
551 typedef Bool (TIDY_CALL *TidyEOFFunc)( void* sourceData );
552 
553 /** End of input "character" */
554 #define EndOfStream (~0u)
555 
556 /** TidyInputSource - Delivers raw bytes of input
557 */
558 TIDY_STRUCT
559 typedef struct _TidyInputSource
560 {
561  /* Instance data */
562  void* sourceData; /**< Input context. Passed to callbacks */
563 
564  /* Methods */
565  TidyGetByteFunc getByte; /**< Pointer to "get byte" callback */
566  TidyUngetByteFunc ungetByte; /**< Pointer to "unget" callback */
567  TidyEOFFunc eof; /**< Pointer to "eof" callback */
569 
570 /** Facilitates user defined source by providing
571 ** an entry point to marshal pointers-to-functions.
572 ** Needed by .NET and possibly other language bindings.
573 */
574 TIDY_EXPORT Bool TIDY_CALL tidyInitSource( TidyInputSource* source,
575  void* srcData,
576  TidyGetByteFunc gbFunc,
577  TidyUngetByteFunc ugbFunc,
578  TidyEOFFunc endFunc );
579 
580 /** Helper: get next byte from input source */
581 TIDY_EXPORT uint TIDY_CALL tidyGetByte( TidyInputSource* source );
582 
583 /** Helper: unget byte back to input source */
584 TIDY_EXPORT void TIDY_CALL tidyUngetByte( TidyInputSource* source, uint byteValue );
585 
586 /** Helper: check if input source at end */
587 TIDY_EXPORT Bool TIDY_CALL tidyIsEOF( TidyInputSource* source );
588 
589 
590 /****************
591  Output Sink
592 ****************/
593 /** Output callback: send a byte to output */
594 typedef void (TIDY_CALL *TidyPutByteFunc)( void* sinkData, byte bt );
595 
596 
597 /** TidyOutputSink - accepts raw bytes of output
598 */
599 TIDY_STRUCT
600 typedef struct _TidyOutputSink
601 {
602  /* Instance data */
603  void* sinkData; /**< Output context. Passed to callbacks */
604 
605  /* Methods */
606  TidyPutByteFunc putByte; /**< Pointer to "put byte" callback */
608 
609 /** Facilitates user defined sinks by providing
610 ** an entry point to marshal pointers-to-functions.
611 ** Needed by .NET and possibly other language bindings.
612 */
613 TIDY_EXPORT Bool TIDY_CALL tidyInitSink( TidyOutputSink* sink,
614  void* snkData,
615  TidyPutByteFunc pbFunc );
616 
617 /** Helper: send a byte to output */
618 TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue );
619 
620 
621 /** Callback to filter messages by diagnostic level:
622 ** info, warning, etc. Just set diagnostic output
623 ** handler to redirect all diagnostics output. Return true
624 ** to proceed with output, false to cancel.
625 */
626 typedef Bool (TIDY_CALL *TidyReportFilter)( TidyDoc tdoc, TidyReportLevel lvl,
627  uint line, uint col, ctmbstr mssg );
628 
629 typedef Bool (TIDY_CALL *TidyReportFilter2)( TidyDoc tdoc, TidyReportLevel lvl,
630  uint line, uint col, ctmbstr mssg, va_list args );
631 
632 /** Give Tidy a filter callback to use */
633 TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc,
634  TidyReportFilter filtCallback );
635 
636 TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter2( TidyDoc tdoc,
637  TidyReportFilter2 filtCallback );
638 
639 /** Set error sink to named file */
640 TIDY_EXPORT FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam );
641 /** Set error sink to given buffer */
642 TIDY_EXPORT int TIDY_CALL tidySetErrorBuffer( TidyDoc tdoc, TidyBuffer* errbuf );
643 /** Set error sink to given generic sink */
644 TIDY_EXPORT int TIDY_CALL tidySetErrorSink( TidyDoc tdoc, TidyOutputSink* sink );
645 
646 /** @} end IO group */
647 
648 /* TODO: Catalog all messages for easy translation
649 TIDY_EXPORT ctmbstr tidyLookupMessage( int errorNo );
650 */
651 
652 
653 
654 /** @defgroup Parse Document Parse
655 **
656 ** Parse markup from a given input source. String and filename
657 ** functions added for convenience. HTML/XHTML version determined
658 ** from input.
659 ** @{
660 */
661 
662 /** Parse markup in named file */
663 TIDY_EXPORT int TIDY_CALL tidyParseFile( TidyDoc tdoc, ctmbstr filename );
664 
665 /** Parse markup from the standard input */
666 TIDY_EXPORT int TIDY_CALL tidyParseStdin( TidyDoc tdoc );
667 
668 /** Parse markup in given string */
669 TIDY_EXPORT int TIDY_CALL tidyParseString( TidyDoc tdoc, ctmbstr content );
670 
671 /** Parse markup in given buffer */
672 TIDY_EXPORT int TIDY_CALL tidyParseBuffer( TidyDoc tdoc, TidyBuffer* buf );
673 
674 /** Parse markup in given generic input source */
675 TIDY_EXPORT int TIDY_CALL tidyParseSource( TidyDoc tdoc, TidyInputSource* source);
676 
677 /** @} End Parse group */
678 
679 
680 /** @defgroup Clean Diagnostics and Repair
681 **
682 ** @{
683 */
684 /** Execute configured cleanup and repair operations on parsed markup */
685 TIDY_EXPORT int TIDY_CALL tidyCleanAndRepair( TidyDoc tdoc );
686 
687 /** Run configured diagnostics on parsed and repaired markup.
688 ** Must call tidyCleanAndRepair() first.
689 */
690 TIDY_EXPORT int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc );
691 
692 TIDY_EXPORT int TIDY_CALL tidyReportDoctype( TidyDoc tdoc );
693 
694 /** @} end Clean group */
695 
696 
697 /** @defgroup Save Document Save Functions
698 **
699 ** Save currently parsed document to the given output sink. File name
700 ** and string/buffer functions provided for convenience.
701 ** @{
702 */
703 
704 /** Save to named file */
705 TIDY_EXPORT int TIDY_CALL tidySaveFile( TidyDoc tdoc, ctmbstr filename );
706 
707 /** Save to standard output (FILE*) */
708 TIDY_EXPORT int TIDY_CALL tidySaveStdout( TidyDoc tdoc );
709 
710 /** Save to given TidyBuffer object */
711 TIDY_EXPORT int TIDY_CALL tidySaveBuffer( TidyDoc tdoc, TidyBuffer* buf );
712 
713 /** Save document to application buffer. If buffer is not big enough,
714 ** ENOMEM will be returned and the necessary buffer size will be placed
715 ** in *buflen.
716 */
717 TIDY_EXPORT int TIDY_CALL tidySaveString( TidyDoc tdoc,
718  tmbstr buffer, uint* buflen );
719 
720 /** Save to given generic output sink */
721 TIDY_EXPORT int TIDY_CALL tidySaveSink( TidyDoc tdoc, TidyOutputSink* sink );
722 
723 /** @} end Save group */
724 
725 
726 /** @addtogroup Basic
727 ** @{
728 */
729 /** Save current settings to named file.
730  Only non-default values are written. */
731 TIDY_EXPORT int TIDY_CALL tidyOptSaveFile( TidyDoc tdoc, ctmbstr cfgfil );
732 
733 /** Save current settings to given output sink.
734  Only non-default values are written. */
735 TIDY_EXPORT int TIDY_CALL tidyOptSaveSink( TidyDoc tdoc, TidyOutputSink* sink );
736 
737 
738 /* Error reporting functions
739 */
740 
741 /** Write more complete information about errors to current error sink. */
742 TIDY_EXPORT void TIDY_CALL tidyErrorSummary( TidyDoc tdoc );
743 
744 /** Write more general information about markup to current error sink. */
745 TIDY_EXPORT void TIDY_CALL tidyGeneralInfo( TidyDoc tdoc );
746 
747 /** @} end Basic group (again) */
748 
749 
750 /** @defgroup Tree Document Tree
751 **
752 ** A parsed and, optionally, repaired document is
753 ** represented by Tidy as a Tree, much like a W3C DOM.
754 ** This tree may be traversed using these functions.
755 ** The following snippet gives a basic idea how these
756 ** functions can be used.
757 **
758 <pre>
759 void dumpNode( TidyNode tnod, int indent )
760 {
761  TidyNode child;
762 
763  for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) )
764  {
765  ctmbstr name;
766  switch ( tidyNodeGetType(child) )
767  {
768  case TidyNode_Root: name = "Root"; break;
769  case TidyNode_DocType: name = "DOCTYPE"; break;
770  case TidyNode_Comment: name = "Comment"; break;
771  case TidyNode_ProcIns: name = "Processing Instruction"; break;
772  case TidyNode_Text: name = "Text"; break;
773  case TidyNode_CDATA: name = "CDATA"; break;
774  case TidyNode_Section: name = "XML Section"; break;
775  case TidyNode_Asp: name = "ASP"; break;
776  case TidyNode_Jste: name = "JSTE"; break;
777  case TidyNode_Php: name = "PHP"; break;
778  case TidyNode_XmlDecl: name = "XML Declaration"; break;
779 
780  case TidyNode_Start:
781  case TidyNode_End:
782  case TidyNode_StartEnd:
783  default:
784  name = tidyNodeGetName( child );
785  break;
786  }
787  assert( name != NULL );
788  printf( "\%*.*sNode: \%s\\n", indent, indent, " ", name );
789  dumpNode( child, indent + 4 );
790  }
791 }
792 
793 void dumpDoc( TidyDoc tdoc )
794 {
795  dumpNode( tidyGetRoot(tdoc), 0 );
796 }
797 
798 void dumpBody( TidyDoc tdoc )
799 {
800  dumpNode( tidyGetBody(tdoc), 0 );
801 }
802 </pre>
803 
804 @{
805 
806 */
807 
808 TIDY_EXPORT TidyNode TIDY_CALL tidyGetRoot( TidyDoc tdoc );
809 TIDY_EXPORT TidyNode TIDY_CALL tidyGetHtml( TidyDoc tdoc );
810 TIDY_EXPORT TidyNode TIDY_CALL tidyGetHead( TidyDoc tdoc );
811 TIDY_EXPORT TidyNode TIDY_CALL tidyGetBody( TidyDoc tdoc );
812 
813 /* parent / child */
814 TIDY_EXPORT TidyNode TIDY_CALL tidyGetParent( TidyNode tnod );
815 TIDY_EXPORT TidyNode TIDY_CALL tidyGetChild( TidyNode tnod );
816 
817 /* siblings */
818 TIDY_EXPORT TidyNode TIDY_CALL tidyGetNext( TidyNode tnod );
819 TIDY_EXPORT TidyNode TIDY_CALL tidyGetPrev( TidyNode tnod );
820 
821 /* Null for non-element nodes and all pure HTML
822 TIDY_EXPORT ctmbstr tidyNodeNsLocal( TidyNode tnod );
823 TIDY_EXPORT ctmbstr tidyNodeNsPrefix( TidyNode tnod );
824 TIDY_EXPORT ctmbstr tidyNodeNsUri( TidyNode tnod );
825 */
826 
827 /* Iterate over attribute values */
828 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrFirst( TidyNode tnod );
829 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrNext( TidyAttr tattr );
830 
831 TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrName( TidyAttr tattr );
832 TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrValue( TidyAttr tattr );
833 
834 /* Null for pure HTML
835 TIDY_EXPORT ctmbstr tidyAttrNsLocal( TidyAttr tattr );
836 TIDY_EXPORT ctmbstr tidyAttrNsPrefix( TidyAttr tattr );
837 TIDY_EXPORT ctmbstr tidyAttrNsUri( TidyAttr tattr );
838 */
839 
840 /** @} end Tree group */
841 
842 
843 /** @defgroup NodeAsk Node Interrogation
844 **
845 ** Get information about any givent node.
846 ** @{
847 */
848 
849 /* Node info */
850 TIDY_EXPORT TidyNodeType TIDY_CALL tidyNodeGetType( TidyNode tnod );
851 TIDY_EXPORT ctmbstr TIDY_CALL tidyNodeGetName( TidyNode tnod );
852 
853 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsText( TidyNode tnod );
854 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsProp( TidyDoc tdoc, TidyNode tnod );
855 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHeader( TidyNode tnod ); /* h1, h2, ... */
856 
857 TIDY_EXPORT Bool TIDY_CALL tidyNodeHasText( TidyDoc tdoc, TidyNode tnod );
858 TIDY_EXPORT Bool TIDY_CALL tidyNodeGetText( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf );
859 
860 /* Copy the unescaped value of this node into the given TidyBuffer as UTF-8 */
861 TIDY_EXPORT Bool TIDY_CALL tidyNodeGetValue( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf );
862 
863 TIDY_EXPORT TidyTagId TIDY_CALL tidyNodeGetId( TidyNode tnod );
864 
865 TIDY_EXPORT uint TIDY_CALL tidyNodeLine( TidyNode tnod );
866 TIDY_EXPORT uint TIDY_CALL tidyNodeColumn( TidyNode tnod );
867 
868 /** @defgroup NodeIsElementName Deprecated node interrogation per TagId
869 **
870 ** @deprecated The functions tidyNodeIs{ElementName} are deprecated and
871 ** should be replaced by tidyNodeGetId.
872 ** @{
873 */
874 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHTML( TidyNode tnod );
875 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHEAD( TidyNode tnod );
876 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTITLE( TidyNode tnod );
877 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASE( TidyNode tnod );
878 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMETA( TidyNode tnod );
879 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBODY( TidyNode tnod );
880 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAMESET( TidyNode tnod );
881 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAME( TidyNode tnod );
882 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIFRAME( TidyNode tnod );
883 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOFRAMES( TidyNode tnod );
884 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHR( TidyNode tnod );
885 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH1( TidyNode tnod );
886 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH2( TidyNode tnod );
887 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPRE( TidyNode tnod );
888 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLISTING( TidyNode tnod );
889 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsP( TidyNode tnod );
890 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsUL( TidyNode tnod );
891 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOL( TidyNode tnod );
892 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDL( TidyNode tnod );
893 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIR( TidyNode tnod );
894 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLI( TidyNode tnod );
895 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDT( TidyNode tnod );
896 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDD( TidyNode tnod );
897 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTABLE( TidyNode tnod );
898 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCAPTION( TidyNode tnod );
899 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTD( TidyNode tnod );
900 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTH( TidyNode tnod );
901 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTR( TidyNode tnod );
902 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOL( TidyNode tnod );
903 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOLGROUP( TidyNode tnod );
904 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBR( TidyNode tnod );
905 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsA( TidyNode tnod );
906 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLINK( TidyNode tnod );
907 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsB( TidyNode tnod );
908 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsI( TidyNode tnod );
909 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRONG( TidyNode tnod );
910 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEM( TidyNode tnod );
911 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBIG( TidyNode tnod );
912 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSMALL( TidyNode tnod );
913 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPARAM( TidyNode tnod );
914 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTION( TidyNode tnod );
915 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTGROUP( TidyNode tnod );
916 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIMG( TidyNode tnod );
917 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMAP( TidyNode tnod );
918 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAREA( TidyNode tnod );
919 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOBR( TidyNode tnod );
920 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsWBR( TidyNode tnod );
921 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFONT( TidyNode tnod );
922 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLAYER( TidyNode tnod );
923 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPACER( TidyNode tnod );
924 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCENTER( TidyNode tnod );
925 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTYLE( TidyNode tnod );
926 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSCRIPT( TidyNode tnod );
927 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOSCRIPT( TidyNode tnod );
928 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFORM( TidyNode tnod );
929 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTEXTAREA( TidyNode tnod );
930 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLOCKQUOTE( TidyNode tnod );
931 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAPPLET( TidyNode tnod );
932 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOBJECT( TidyNode tnod );
933 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIV( TidyNode tnod );
934 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPAN( TidyNode tnod );
935 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsINPUT( TidyNode tnod );
936 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsQ( TidyNode tnod );
937 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLABEL( TidyNode tnod );
938 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH3( TidyNode tnod );
939 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH4( TidyNode tnod );
940 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH5( TidyNode tnod );
941 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH6( TidyNode tnod );
942 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsADDRESS( TidyNode tnod );
943 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsXMP( TidyNode tnod );
944 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSELECT( TidyNode tnod );
945 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLINK( TidyNode tnod );
946 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMARQUEE( TidyNode tnod );
947 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEMBED( TidyNode tnod );
948 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASEFONT( TidyNode tnod );
949 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsISINDEX( TidyNode tnod );
950 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsS( TidyNode tnod );
951 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRIKE( TidyNode tnod );
952 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsU( TidyNode tnod );
953 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMENU( TidyNode tnod );
954 
955 /* HTML5 */
956 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDATALIST( TidyNode tnod ); // bit like OPTIONS
957 
958 
959 /** @} End NodeIsElementName group */
960 
961 /** @} End NodeAsk group */
962 
963 
964 /** @defgroup Attribute Attribute Interrogation
965 **
966 ** Get information about any given attribute.
967 ** @{
968 */
969 
970 TIDY_EXPORT TidyAttrId TIDY_CALL tidyAttrGetId( TidyAttr tattr );
971 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsEvent( TidyAttr tattr );
972 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsProp( TidyAttr tattr );
973 
974 /** @defgroup AttrIsAttributeName Deprecated attribute interrogation per AttrId
975 **
976 ** @deprecated The functions tidyAttrIs{AttributeName} are deprecated and
977 ** should be replaced by tidyAttrGetId.
978 ** @{
979 */
980 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHREF( TidyAttr tattr );
981 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSRC( TidyAttr tattr );
982 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsID( TidyAttr tattr );
983 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsNAME( TidyAttr tattr );
984 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSUMMARY( TidyAttr tattr );
985 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALT( TidyAttr tattr );
986 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLONGDESC( TidyAttr tattr );
987 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsUSEMAP( TidyAttr tattr );
988 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsISMAP( TidyAttr tattr );
989 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANGUAGE( TidyAttr tattr );
990 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTYPE( TidyAttr tattr );
991 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVALUE( TidyAttr tattr );
992 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCONTENT( TidyAttr tattr );
993 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTITLE( TidyAttr tattr );
994 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsXMLNS( TidyAttr tattr );
995 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsDATAFLD( TidyAttr tattr );
996 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsWIDTH( TidyAttr tattr );
997 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHEIGHT( TidyAttr tattr );
998 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsFOR( TidyAttr tattr );
999 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSELECTED( TidyAttr tattr );
1000 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCHECKED( TidyAttr tattr );
1001 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANG( TidyAttr tattr );
1002 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTARGET( TidyAttr tattr );
1003 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHTTP_EQUIV( TidyAttr tattr );
1004 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsREL( TidyAttr tattr );
1005 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEMOVE( TidyAttr tattr );
1006 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEDOWN( TidyAttr tattr );
1007 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEUP( TidyAttr tattr );
1008 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnCLICK( TidyAttr tattr );
1009 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOVER( TidyAttr tattr );
1010 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOUT( TidyAttr tattr );
1011 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYDOWN( TidyAttr tattr );
1012 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYUP( TidyAttr tattr );
1013 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYPRESS( TidyAttr tattr );
1014 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnFOCUS( TidyAttr tattr );
1015 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnBLUR( TidyAttr tattr );
1016 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsBGCOLOR( TidyAttr tattr );
1017 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLINK( TidyAttr tattr );
1018 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALINK( TidyAttr tattr );
1019 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVLINK( TidyAttr tattr );
1020 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTEXT( TidyAttr tattr );
1021 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSTYLE( TidyAttr tattr );
1022 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsABBR( TidyAttr tattr );
1023 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCOLSPAN( TidyAttr tattr );
1024 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsROWSPAN( TidyAttr tattr );
1025 
1026 /** @} End AttrIsAttributeName group */
1027 
1028 /** @} end AttrAsk group */
1029 
1030 
1031 /** @defgroup AttrGet Attribute Retrieval
1032 **
1033 ** Lookup an attribute from a given node
1034 ** @{
1035 */
1036 
1037 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetById( TidyNode tnod, TidyAttrId attId );
1038 
1039 /** @defgroup AttrGetAttributeName Deprecated attribute retrieval per AttrId
1040 **
1041 ** @deprecated The functions tidyAttrGet{AttributeName} are deprecated and
1042 ** should be replaced by tidyAttrGetById.
1043 ** For instance, tidyAttrGetID( TidyNode tnod ) can be replaced by
1044 ** tidyAttrGetById( TidyNode tnod, TidyAttr_ID ). This avoids a potential
1045 ** name clash with tidyAttrGetId for case-insensitive languages.
1046 ** @{
1047 */
1048 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHREF( TidyNode tnod );
1049 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSRC( TidyNode tnod );
1050 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetID( TidyNode tnod );
1051 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetNAME( TidyNode tnod );
1052 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSUMMARY( TidyNode tnod );
1053 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALT( TidyNode tnod );
1054 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLONGDESC( TidyNode tnod );
1055 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetUSEMAP( TidyNode tnod );
1056 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetISMAP( TidyNode tnod );
1057 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANGUAGE( TidyNode tnod );
1058 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTYPE( TidyNode tnod );
1059 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVALUE( TidyNode tnod );
1060 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCONTENT( TidyNode tnod );
1061 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTITLE( TidyNode tnod );
1062 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetXMLNS( TidyNode tnod );
1063 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetDATAFLD( TidyNode tnod );
1064 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetWIDTH( TidyNode tnod );
1065 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHEIGHT( TidyNode tnod );
1066 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetFOR( TidyNode tnod );
1067 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSELECTED( TidyNode tnod );
1068 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCHECKED( TidyNode tnod );
1069 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANG( TidyNode tnod );
1070 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTARGET( TidyNode tnod );
1071 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHTTP_EQUIV( TidyNode tnod );
1072 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetREL( TidyNode tnod );
1073 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEMOVE( TidyNode tnod );
1074 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEDOWN( TidyNode tnod );
1075 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEUP( TidyNode tnod );
1076 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnCLICK( TidyNode tnod );
1077 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOVER( TidyNode tnod );
1078 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOUT( TidyNode tnod );
1079 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYDOWN( TidyNode tnod );
1080 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYUP( TidyNode tnod );
1081 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYPRESS( TidyNode tnod );
1082 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnFOCUS( TidyNode tnod );
1083 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnBLUR( TidyNode tnod );
1084 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetBGCOLOR( TidyNode tnod );
1085 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLINK( TidyNode tnod );
1086 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALINK( TidyNode tnod );
1087 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVLINK( TidyNode tnod );
1088 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTEXT( TidyNode tnod );
1089 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSTYLE( TidyNode tnod );
1090 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetABBR( TidyNode tnod );
1091 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCOLSPAN( TidyNode tnod );
1092 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetROWSPAN( TidyNode tnod );
1093 
1094 /** @} End AttrGetAttributeName group */
1095 
1096 /** @} end AttrGet group */
1097 
1098 #ifdef __cplusplus
1099 } /* extern "C" */
1100 #endif
1101 #endif /* __TIDY_H__ */
1102 
1103 /*
1104  * local variables:
1105  * mode: c
1106  * indent-tabs-mode: nil
1107  * c-basic-offset: 4
1108  * eval: (c-set-offset 'substatement-open 0)
1109  * end:
1110  */
Definition: tidy.h:600
int TIDY_CALL tidyParseSource(TidyDoc tdoc, TidyInputSource *source)
TidyIterator TIDY_CALL tidyOptGetDeclTagList(TidyDoc tdoc)
Bool TIDY_CALL tidyOptResetToDefault(TidyDoc tdoc, TidyOptionId opt)
void(TIDY_CALL *free)(TidyAllocator *self
uint TIDY_CALL tidyAccessWarningCount(TidyDoc tdoc)
TidyOptionType TIDY_CALL tidyOptGetType(TidyOption opt)
int TIDY_CALL tidyRunDiagnostics(TidyDoc tdoc)
TidyUngetByteFunc ungetByte
Definition: tidy.h:566
void TIDY_CALL tidyUngetByte(TidyInputSource *source, uint byteValue)
int TIDY_CALL tidyDetectedHtmlVersion(TidyDoc tdoc)
ctmbstr TIDY_CALL tidyOptGetDefault(TidyOption opt)
Bool(TIDY_CALL * TidyReportFilter)(TidyDoc tdoc, TidyReportLevel lvl, uint line, uint col, ctmbstr mssg)
Definition: tidy.h:626
int TIDY_CALL tidySaveString(TidyDoc tdoc, tmbstr buffer, uint *buflen)
Definition: buffio.h:23
int TIDY_CALL tidySaveSink(TidyDoc tdoc, TidyOutputSink *sink)
TidyOption TIDY_CALL tidyGetNextOption(TidyDoc tdoc, TidyIterator *pos)
int TIDY_CALL tidySetErrorSink(TidyDoc tdoc, TidyOutputSink *sink)
Definition: tidy.h:224
int TIDY_CALL tidySaveStdout(TidyDoc tdoc)
Bool TIDY_CALL tidyDetectedXhtml(TidyDoc tdoc)
uint TIDY_CALL tidyGetByte(TidyInputSource *source)
TidyIterator TIDY_CALL tidyOptGetDocLinksList(TidyDoc tdoc, TidyOption opt)
void TIDY_CALL tidySetAppData(TidyDoc tdoc, void *appData)
TidyIterator TIDY_CALL tidyOptGetPickList(TidyOption opt)
Bool TIDY_CALL tidySetReportFilter(TidyDoc tdoc, TidyReportFilter filtCallback)
int TIDY_CALL tidyStatus(TidyDoc tdoc)
Bool TIDY_CALL tidyOptSetBool(TidyDoc tdoc, TidyOptionId optId, Bool val)
TidyOption TIDY_CALL tidyGetOptionByName(TidyDoc tdoc, ctmbstr optnam)
int TIDY_CALL tidySetInCharEncoding(TidyDoc tdoc, ctmbstr encnam)
ctmbstr TIDY_CALL tidyOptGetEncName(TidyDoc tdoc, TidyOptionId optId)
Bool TIDY_CALL tidyOptDiffThanSnapshot(TidyDoc tdoc)
Bool TIDY_CALL tidyOptResetToSnapshot(TidyDoc tdoc)
int(TIDY_CALL * TidyGetByteFunc)(void *sourceData)
Definition: tidy.h:545
void *TIDY_CALL tidyGetAppData(TidyDoc tdoc)
void *(TIDY_CALL * TidyRealloc)(void *buf, size_t len)
Definition: tidy.h:231
Bool TIDY_CALL tidyInitSource(TidyInputSource *source, void *srcData, TidyGetByteFunc gbFunc, TidyUngetByteFunc ugbFunc, TidyEOFFunc endFunc)
int TIDY_CALL tidyParseString(TidyDoc tdoc, ctmbstr content)
void *(TIDY_CALL * TidyMalloc)(size_t len)
Definition: tidy.h:229
Bool TIDY_CALL tidyOptSnapshot(TidyDoc tdoc)
TidyOptionId TIDY_CALL tidyOptGetIdForName(ctmbstr optnam)
FILE *TIDY_CALL tidySetErrorFile(TidyDoc tdoc, ctmbstr errfilnam)
Bool TIDY_CALL tidyOptGetDefaultBool(TidyOption opt)
Bool TIDY_CALL tidySetReallocCall(TidyRealloc frealloc)
TidyEOFFunc eof
Definition: tidy.h:567
ctmbstr TIDY_CALL tidyOptGetNextPick(TidyOption opt, TidyIterator *pos)
TidyGetByteFunc getByte
Definition: tidy.h:565
Bool TIDY_CALL tidyDetectedGenericXml(TidyDoc tdoc)
TidyPutByteFunc putByte
Definition: tidy.h:606
int TIDY_CALL tidySetErrorBuffer(TidyDoc tdoc, TidyBuffer *errbuf)
Bool TIDY_CALL tidyOptResetAllToDefault(TidyDoc tdoc)
ctmbstr TIDY_CALL tidyOptGetNextDeclTag(TidyDoc tdoc, TidyOptionId optId, TidyIterator *iter)
int TIDY_CALL tidyParseBuffer(TidyDoc tdoc, TidyBuffer *buf)
Definition: tidy.h:559
Bool TIDY_CALL tidyOptGetBool(TidyDoc tdoc, TidyOptionId optId)
ulong TIDY_CALL tidyOptGetDefaultInt(TidyOption opt)
int TIDY_CALL tidySetOutCharEncoding(TidyDoc tdoc, ctmbstr encnam)
Bool TIDY_CALL tidyOptIsReadOnly(TidyOption opt)
void * sourceData
Definition: tidy.h:562
TidyOption TIDY_CALL tidyOptGetNextDocLinks(TidyDoc tdoc, TidyIterator *pos)
ctmbstr tidyLibraryVersion(void)
int TIDY_CALL tidyLoadConfigEnc(TidyDoc tdoc, ctmbstr configFile, ctmbstr charenc)
void(TIDY_CALL * TidyUngetByteFunc)(void *sourceData, byte bt)
Definition: tidy.h:548
Bool TIDY_CALL tidyOptDiffThanDefault(TidyDoc tdoc)
void(TIDY_CALL * TidyFree)(void *buf)
Definition: tidy.h:233
Bool TIDY_CALL tidyOptSetValue(TidyDoc tdoc, TidyOptionId optId, ctmbstr val)
ctmbstr TIDY_CALL tidyOptGetName(TidyOption opt)
Bool TIDY_CALL tidySetMallocCall(TidyMalloc fmalloc)
Bool TIDY_CALL tidyIsEOF(TidyInputSource *source)
void *TIDY_CALL * alloc(TidyAllocator *self, size_t nBytes)
void *TIDY_CALL * realloc(TidyAllocator *self, void *block, size_t nBytes)
int TIDY_CALL tidyLoadConfig(TidyDoc tdoc, ctmbstr configFile)
Bool(TIDY_CALL * TidyEOFFunc)(void *sourceData)
Definition: tidy.h:551
int TIDY_CALL tidyOptSaveSink(TidyDoc tdoc, TidyOutputSink *sink)
void(TIDY_CALL * TidyPanic)(ctmbstr mssg)
Definition: tidy.h:235
int TIDY_CALL tidySaveBuffer(TidyDoc tdoc, TidyBuffer *buf)
TidyConfigCategory TIDY_CALL tidyOptGetCategory(TidyOption opt)
Bool TIDY_CALL tidySetFreeCall(TidyFree ffree)
ctmbstr TIDY_CALL tidyOptGetDoc(TidyDoc tdoc, TidyOption opt)
void * sinkData
Definition: tidy.h:603
int TIDY_CALL tidyCleanAndRepair(TidyDoc tdoc)
Bool TIDY_CALL tidyOptSetInt(TidyDoc tdoc, TidyOptionId optId, ulong val)
int TIDY_CALL tidyParseFile(TidyDoc tdoc, ctmbstr filename)
uint TIDY_CALL tidyConfigErrorCount(TidyDoc tdoc)
void(TIDY_CALL * TidyPutByteFunc)(void *sinkData, byte bt)
Definition: tidy.h:594
uint TIDY_CALL tidyErrorCount(TidyDoc tdoc)
TidyIterator TIDY_CALL tidyGetOptionList(TidyDoc tdoc)
uint TIDY_CALL tidyWarningCount(TidyDoc tdoc)
int TIDY_CALL tidyParseStdin(TidyDoc tdoc)
ulong TIDY_CALL tidyOptGetInt(TidyDoc tdoc, TidyOptionId optId)
Definition: tidy.h:166
Bool(TIDY_CALL * TidyOptCallback)(ctmbstr option, ctmbstr value)
Definition: tidy.h:408
TIDY_STRUCT struct _TidyInputSource TidyInputSource
ctmbstr TIDY_CALL tidyOptGetCurrPick(TidyDoc tdoc, TidyOptionId optId)
void TIDY_CALL tidyGeneralInfo(TidyDoc tdoc)
void TIDY_CALL tidyErrorSummary(TidyDoc tdoc)
Bool TIDY_CALL tidyOptCopyConfig(TidyDoc tdocTo, TidyDoc tdocFrom)
Bool TIDY_CALL tidyInitSink(TidyOutputSink *sink, void *snkData, TidyPutByteFunc pbFunc)
ctmbstr TIDY_CALL tidyReleaseDate(void)
int TIDY_CALL tidySaveFile(TidyDoc tdoc, ctmbstr filename)
Bool TIDY_CALL tidySetPanicCall(TidyPanic fpanic)
TidyOption TIDY_CALL tidyGetOption(TidyDoc tdoc, TidyOptionId optId)
void TIDY_CALL tidyPutByte(TidyOutputSink *sink, uint byteValue)
TidyOptionId TIDY_CALL tidyOptGetId(TidyOption opt)
int TIDY_CALL tidySetCharEncoding(TidyDoc tdoc, ctmbstr encnam)
Bool TIDY_CALL tidyOptParseValue(TidyDoc tdoc, ctmbstr optnam, ctmbstr val)
int TIDY_CALL tidyOptSaveFile(TidyDoc tdoc, ctmbstr cfgfil)
TIDY_STRUCT struct _TidyOutputSink TidyOutputSink
ctmbstr TIDY_CALL tidyOptGetValue(TidyDoc tdoc, TidyOptionId optId)