HTML Tidy
0.1
|
00001 #ifndef __TIDY_H__ 00002 #define __TIDY_H__ 00003 00004 /** @file tidy.h - Defines HTML Tidy API implemented by tidy library. 00005 00006 Public interface is const-correct and doesn't explicitly depend 00007 on any globals. Thus, thread-safety may be introduced w/out 00008 changing the interface. 00009 00010 Looking ahead to a C++ wrapper, C functions always pass 00011 this-equivalent as 1st arg. 00012 00013 00014 Copyright (c) 1998-2008 World Wide Web Consortium 00015 (Massachusetts Institute of Technology, European Research 00016 Consortium for Informatics and Mathematics, Keio University). 00017 All Rights Reserved. 00018 00019 Contributing Author(s): 00020 00021 Dave Raggett <dsr@w3.org> 00022 00023 The contributing author(s) would like to thank all those who 00024 helped with testing, bug fixes and suggestions for improvements. 00025 This wouldn't have been possible without your help. 00026 00027 COPYRIGHT NOTICE: 00028 00029 This software and documentation is provided "as is," and 00030 the copyright holders and contributing author(s) make no 00031 representations or warranties, express or implied, including 00032 but not limited to, warranties of merchantability or fitness 00033 for any particular purpose or that the use of the software or 00034 documentation will not infringe any third party patents, 00035 copyrights, trademarks or other rights. 00036 00037 The copyright holders and contributing author(s) will not be held 00038 liable for any direct, indirect, special or consequential damages 00039 arising out of any use of the software or documentation, even if 00040 advised of the possibility of such damage. 00041 00042 Permission is hereby granted to use, copy, modify, and distribute 00043 this source code, or portions hereof, documentation and executables, 00044 for any purpose, without fee, subject to the following restrictions: 00045 00046 1. The origin of this source code must not be misrepresented. 00047 2. Altered versions must be plainly marked as such and must 00048 not be misrepresented as being the original source. 00049 3. This Copyright notice may not be removed or altered from any 00050 source or altered source distribution. 00051 00052 The copyright holders and contributing author(s) specifically 00053 permit, without fee, and encourage the use of this source code 00054 as a component for supporting the Hypertext Markup Language in 00055 commercial products. If you use this source code in a product, 00056 acknowledgment is not required but would be appreciated. 00057 00058 00059 Created 2001-05-20 by Charles Reitzel 00060 Updated 2002-07-01 by Charles Reitzel - 1st Implementation 00061 00062 */ 00063 00064 #include "platform.h" 00065 #include "tidyenum.h" 00066 00067 #ifdef __cplusplus 00068 extern "C" { 00069 #endif 00070 00071 /** @defgroup Opaque Opaque Types 00072 ** 00073 ** Cast to implementation types within lib. 00074 ** Reduces inter-dependencies/conflicts w/ application code. 00075 ** @{ 00076 */ 00077 00078 /** @struct TidyDoc 00079 ** Opaque document datatype 00080 */ 00081 opaque_type( TidyDoc ); 00082 00083 /** @struct TidyOption 00084 ** Opaque option datatype 00085 */ 00086 opaque_type( TidyOption ); 00087 00088 /** @struct TidyNode 00089 ** Opaque node datatype 00090 */ 00091 opaque_type( TidyNode ); 00092 00093 /** @struct TidyAttr 00094 ** Opaque attribute datatype 00095 */ 00096 opaque_type( TidyAttr ); 00097 00098 /** @} end Opaque group */ 00099 00100 TIDY_STRUCT struct _TidyBuffer; 00101 typedef struct _TidyBuffer TidyBuffer; 00102 00103 00104 /** @defgroup Memory Memory Allocation 00105 ** 00106 ** Tidy uses a user provided allocator for all 00107 ** memory allocations. If this allocator is 00108 ** not provided, then a default allocator is 00109 ** used which simply wraps standard C malloc/free 00110 ** calls. These wrappers call the panic function 00111 ** upon any failure. The default panic function 00112 ** prints an out of memory message to stderr, and 00113 ** calls exit(2). 00114 ** 00115 ** For applications in which it is unacceptable to 00116 ** abort in the case of memory allocation, then the 00117 ** panic function can be replaced with one which 00118 ** longjmps() out of the tidy code. For this to 00119 ** clean up completely, you should be careful not 00120 ** to use any tidy methods that open files as these 00121 ** will not be closed before panic() is called. 00122 ** 00123 ** TODO: associate file handles with tidyDoc and 00124 ** ensure that tidyDocRelease() can close them all. 00125 ** 00126 ** Calling the withAllocator() family ( 00127 ** tidyCreateWithAllocator, tidyBufInitWithAllocator, 00128 ** tidyBufAllocWithAllocator) allow settings custom 00129 ** allocators). 00130 ** 00131 ** All parts of the document use the same allocator. 00132 ** Calls that require a user provided buffer can 00133 ** optionally use a different allocator. 00134 ** 00135 ** For reference in designing a plug-in allocator, 00136 ** most allocations made by tidy are less than 100 00137 ** bytes, corresponding to attribute names/values, etc. 00138 ** 00139 ** There is also an additional class of much larger 00140 ** allocations which are where most of the data from 00141 ** the lexer is stored. (It is not currently possible 00142 ** to use a separate allocator for the lexer, this 00143 ** would be a useful extension). 00144 ** 00145 ** In general, approximately 1/3rd of the memory 00146 ** used by tidy is freed during the parse, so if 00147 ** memory usage is an issue then an allocator that 00148 ** can reuse this memory is a good idea. 00149 ** 00150 ** @{ 00151 */ 00152 00153 /** Prototype for the allocator's function table */ 00154 struct _TidyAllocatorVtbl; 00155 /** The allocators function table */ 00156 typedef struct _TidyAllocatorVtbl TidyAllocatorVtbl; 00157 00158 /** Prototype for the allocator */ 00159 struct _TidyAllocator; 00160 /** The allocator **/ 00161 typedef struct _TidyAllocator TidyAllocator; 00162 00163 /** An allocator's function table. All functions here must 00164 be provided. 00165 */ 00166 struct _TidyAllocatorVtbl { 00167 /** Called to allocate a block of nBytes of memory */ 00168 void* (TIDY_CALL *alloc)( TidyAllocator *self, size_t nBytes ); 00169 /** Called to resize (grow, in general) a block of memory. 00170 Must support being called with NULL. 00171 */ 00172 void* (TIDY_CALL *realloc)( TidyAllocator *self, void *block, size_t nBytes ); 00173 /** Called to free a previously allocated block of memory */ 00174 void (TIDY_CALL *free)( TidyAllocator *self, void *block); 00175 /** Called when a panic condition is detected. Must support 00176 block == NULL. This function is not called if either alloc 00177 or realloc fails; it is up to the allocator to do this. 00178 Currently this function can only be called if an error is 00179 detected in the tree integrity via the internal function 00180 CheckNodeIntegrity(). This is a situation that can 00181 only arise in the case of a programming error in tidylib. 00182 You can turn off node integrity checking by defining 00183 the constant NO_NODE_INTEGRITY_CHECK during the build. 00184 **/ 00185 void (TIDY_CALL *panic)( TidyAllocator *self, ctmbstr msg ); 00186 }; 00187 00188 /** An allocator. To create your own allocator, do something like 00189 the following: 00190 00191 typedef struct _MyAllocator { 00192 TidyAllocator base; 00193 ...other custom allocator state... 00194 } MyAllocator; 00195 00196 void* MyAllocator_alloc(TidyAllocator *base, void *block, size_t nBytes) 00197 { 00198 MyAllocator *self = (MyAllocator*)base; 00199 ... 00200 } 00201 (etc) 00202 00203 static const TidyAllocatorVtbl MyAllocatorVtbl = { 00204 MyAllocator_alloc, 00205 MyAllocator_realloc, 00206 MyAllocator_free, 00207 MyAllocator_panic 00208 }; 00209 00210 myAllocator allocator; 00211 TidyDoc doc; 00212 00213 allocator.base.vtbl = &MyAllocatorVtbl; 00214 ...initialise allocator specific state... 00215 doc = tidyCreateWithAllocator(&allocator); 00216 ... 00217 00218 Although this looks slightly long winded, the advantage is that to create 00219 a custom allocator you simply need to set the vtbl pointer correctly. 00220 The vtbl itself can reside in static/global data, and hence does not 00221 need to be initialised each time an allocator is created, and furthermore 00222 the memory is shared amongst all created allocators. 00223 */ 00224 struct _TidyAllocator { 00225 const TidyAllocatorVtbl *vtbl; 00226 }; 00227 00228 /** Callback for "malloc" replacement */ 00229 typedef void* (TIDY_CALL *TidyMalloc)( size_t len ); 00230 /** Callback for "realloc" replacement */ 00231 typedef void* (TIDY_CALL *TidyRealloc)( void* buf, size_t len ); 00232 /** Callback for "free" replacement */ 00233 typedef void (TIDY_CALL *TidyFree)( void* buf ); 00234 /** Callback for "out of memory" panic state */ 00235 typedef void (TIDY_CALL *TidyPanic)( ctmbstr mssg ); 00236 00237 00238 /** Give Tidy a malloc() replacement */ 00239 TIDY_EXPORT Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc ); 00240 /** Give Tidy a realloc() replacement */ 00241 TIDY_EXPORT Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc ); 00242 /** Give Tidy a free() replacement */ 00243 TIDY_EXPORT Bool TIDY_CALL tidySetFreeCall( TidyFree ffree ); 00244 /** Give Tidy an "out of memory" handler */ 00245 TIDY_EXPORT Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic ); 00246 00247 /** @} end Memory group */ 00248 00249 /** @defgroup Basic Basic Operations 00250 ** 00251 ** Tidy public interface 00252 ** 00253 ** Several functions return an integer document status: 00254 ** 00255 ** <pre> 00256 ** 0 -> SUCCESS 00257 ** >0 -> 1 == TIDY WARNING, 2 == TIDY ERROR 00258 ** <0 -> SEVERE ERROR 00259 ** </pre> 00260 ** 00261 The following is a short example program. 00262 00263 <pre> 00264 #include <tidy.h> 00265 #include <buffio.h> 00266 #include <stdio.h> 00267 #include <errno.h> 00268 00269 00270 int main(int argc, char **argv ) 00271 { 00272 const char* input = "<title>Foo</title><p>Foo!"; 00273 TidyBuffer output; 00274 TidyBuffer errbuf; 00275 int rc = -1; 00276 Bool ok; 00277 00278 TidyDoc tdoc = tidyCreate(); // Initialize "document" 00279 tidyBufInit( &output ); 00280 tidyBufInit( &errbuf ); 00281 printf( "Tidying:\t\%s\\n", input ); 00282 00283 ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes ); // Convert to XHTML 00284 if ( ok ) 00285 rc = tidySetErrorBuffer( tdoc, &errbuf ); // Capture diagnostics 00286 if ( rc >= 0 ) 00287 rc = tidyParseString( tdoc, input ); // Parse the input 00288 if ( rc >= 0 ) 00289 rc = tidyCleanAndRepair( tdoc ); // Tidy it up! 00290 if ( rc >= 0 ) 00291 rc = tidyRunDiagnostics( tdoc ); // Kvetch 00292 if ( rc > 1 ) // If error, force output. 00293 rc = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? rc : -1 ); 00294 if ( rc >= 0 ) 00295 rc = tidySaveBuffer( tdoc, &output ); // Pretty Print 00296 00297 if ( rc >= 0 ) 00298 { 00299 if ( rc > 0 ) 00300 printf( "\\nDiagnostics:\\n\\n\%s", errbuf.bp ); 00301 printf( "\\nAnd here is the result:\\n\\n\%s", output.bp ); 00302 } 00303 else 00304 printf( "A severe error (\%d) occurred.\\n", rc ); 00305 00306 tidyBufFree( &output ); 00307 tidyBufFree( &errbuf ); 00308 tidyRelease( tdoc ); 00309 return rc; 00310 } 00311 </pre> 00312 ** @{ 00313 */ 00314 00315 TIDY_EXPORT TidyDoc TIDY_CALL tidyCreate(void); 00316 TIDY_EXPORT TidyDoc TIDY_CALL tidyCreateWithAllocator( TidyAllocator *allocator ); 00317 TIDY_EXPORT void TIDY_CALL tidyRelease( TidyDoc tdoc ); 00318 00319 /** Let application store a chunk of data w/ each Tidy instance. 00320 ** Useful for callbacks. 00321 */ 00322 TIDY_EXPORT void TIDY_CALL tidySetAppData( TidyDoc tdoc, void* appData ); 00323 00324 /** Get application data set previously */ 00325 TIDY_EXPORT void* TIDY_CALL tidyGetAppData( TidyDoc tdoc ); 00326 00327 /** Get release date (version) for current library */ 00328 TIDY_EXPORT ctmbstr TIDY_CALL tidyReleaseDate(void); 00329 00330 /* Diagnostics and Repair 00331 */ 00332 00333 /** Get status of current document. */ 00334 TIDY_EXPORT int TIDY_CALL tidyStatus( TidyDoc tdoc ); 00335 00336 /** Detected HTML version: 0, 2, 3 or 4 */ 00337 TIDY_EXPORT int TIDY_CALL tidyDetectedHtmlVersion( TidyDoc tdoc ); 00338 00339 /** Input is XHTML? */ 00340 TIDY_EXPORT Bool TIDY_CALL tidyDetectedXhtml( TidyDoc tdoc ); 00341 00342 /** Input is generic XML (not HTML or XHTML)? */ 00343 TIDY_EXPORT Bool TIDY_CALL tidyDetectedGenericXml( TidyDoc tdoc ); 00344 00345 /** Number of Tidy errors encountered. If > 0, output is suppressed 00346 ** unless TidyForceOutput is set. 00347 */ 00348 TIDY_EXPORT uint TIDY_CALL tidyErrorCount( TidyDoc tdoc ); 00349 00350 /** Number of Tidy warnings encountered. */ 00351 TIDY_EXPORT uint TIDY_CALL tidyWarningCount( TidyDoc tdoc ); 00352 00353 /** Number of Tidy accessibility warnings encountered. */ 00354 TIDY_EXPORT uint TIDY_CALL tidyAccessWarningCount( TidyDoc tdoc ); 00355 00356 /** Number of Tidy configuration errors encountered. */ 00357 TIDY_EXPORT uint TIDY_CALL tidyConfigErrorCount( TidyDoc tdoc ); 00358 00359 /* Get/Set configuration options 00360 */ 00361 /** Load an ASCII Tidy configuration file */ 00362 TIDY_EXPORT int TIDY_CALL tidyLoadConfig( TidyDoc tdoc, ctmbstr configFile ); 00363 00364 /** Load a Tidy configuration file with the specified character encoding */ 00365 TIDY_EXPORT int TIDY_CALL tidyLoadConfigEnc( TidyDoc tdoc, ctmbstr configFile, 00366 ctmbstr charenc ); 00367 00368 TIDY_EXPORT Bool TIDY_CALL tidyFileExists( TidyDoc tdoc, ctmbstr filename ); 00369 00370 00371 /** Set the input/output character encoding for parsing markup. 00372 ** Values include: ascii, latin1, raw, utf8, iso2022, mac, 00373 ** win1252, utf16le, utf16be, utf16, big5 and shiftjis. Case in-sensitive. 00374 */ 00375 TIDY_EXPORT int TIDY_CALL tidySetCharEncoding( TidyDoc tdoc, ctmbstr encnam ); 00376 00377 /** Set the input encoding for parsing markup. 00378 ** As for tidySetCharEncoding but only affects the input encoding 00379 **/ 00380 TIDY_EXPORT int TIDY_CALL tidySetInCharEncoding( TidyDoc tdoc, ctmbstr encnam ); 00381 00382 /** Set the output encoding. 00383 **/ 00384 TIDY_EXPORT int TIDY_CALL tidySetOutCharEncoding( TidyDoc tdoc, ctmbstr encnam ); 00385 00386 /** @} end Basic group */ 00387 00388 00389 /** @defgroup Configuration Configuration Options 00390 ** 00391 ** Functions for getting and setting Tidy configuration options. 00392 ** @{ 00393 */ 00394 00395 /** Applications using TidyLib may want to augment command-line and 00396 ** configuration file options. Setting this callback allows an application 00397 ** developer to examine command-line and configuration file options after 00398 ** TidyLib has examined them and failed to recognize them. 00399 **/ 00400 00401 typedef Bool (TIDY_CALL *TidyOptCallback)( ctmbstr option, ctmbstr value ); 00402 00403 TIDY_EXPORT Bool TIDY_CALL tidySetOptionCallback( TidyDoc tdoc, TidyOptCallback pOptCallback ); 00404 00405 /** Get option ID by name */ 00406 TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetIdForName( ctmbstr optnam ); 00407 00408 /** Get iterator for list of option */ 00409 /** 00410 Example: 00411 <pre> 00412 TidyIterator itOpt = tidyGetOptionList( tdoc ); 00413 while ( itOpt ) 00414 { 00415 TidyOption opt = tidyGetNextOption( tdoc, &itOpt ); 00416 .. get/set option values .. 00417 } 00418 </pre> 00419 */ 00420 00421 TIDY_EXPORT TidyIterator TIDY_CALL tidyGetOptionList( TidyDoc tdoc ); 00422 /** Get next Option */ 00423 TIDY_EXPORT TidyOption TIDY_CALL tidyGetNextOption( TidyDoc tdoc, TidyIterator* pos ); 00424 00425 /** Lookup option by ID */ 00426 TIDY_EXPORT TidyOption TIDY_CALL tidyGetOption( TidyDoc tdoc, TidyOptionId optId ); 00427 /** Lookup option by name */ 00428 TIDY_EXPORT TidyOption TIDY_CALL tidyGetOptionByName( TidyDoc tdoc, ctmbstr optnam ); 00429 00430 /** Get ID of given Option */ 00431 TIDY_EXPORT TidyOptionId TIDY_CALL tidyOptGetId( TidyOption opt ); 00432 00433 /** Get name of given Option */ 00434 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetName( TidyOption opt ); 00435 00436 /** Get datatype of given Option */ 00437 TIDY_EXPORT TidyOptionType TIDY_CALL tidyOptGetType( TidyOption opt ); 00438 00439 /** Is Option read-only? */ 00440 TIDY_EXPORT Bool TIDY_CALL tidyOptIsReadOnly( TidyOption opt ); 00441 00442 /** Get category of given Option */ 00443 TIDY_EXPORT TidyConfigCategory TIDY_CALL tidyOptGetCategory( TidyOption opt ); 00444 00445 /** Get default value of given Option as a string */ 00446 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDefault( TidyOption opt ); 00447 00448 /** Get default value of given Option as an unsigned integer */ 00449 TIDY_EXPORT ulong TIDY_CALL tidyOptGetDefaultInt( TidyOption opt ); 00450 00451 /** Get default value of given Option as a Boolean value */ 00452 TIDY_EXPORT Bool TIDY_CALL tidyOptGetDefaultBool( TidyOption opt ); 00453 00454 /** Iterate over Option "pick list" */ 00455 TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetPickList( TidyOption opt ); 00456 /** Get next string value of Option "pick list" */ 00457 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextPick( TidyOption opt, TidyIterator* pos ); 00458 00459 /** Get current Option value as a string */ 00460 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetValue( TidyDoc tdoc, TidyOptionId optId ); 00461 /** Set Option value as a string */ 00462 TIDY_EXPORT Bool TIDY_CALL tidyOptSetValue( TidyDoc tdoc, TidyOptionId optId, ctmbstr val ); 00463 /** Set named Option value as a string. Good if not sure of type. */ 00464 TIDY_EXPORT Bool TIDY_CALL tidyOptParseValue( TidyDoc tdoc, ctmbstr optnam, ctmbstr val ); 00465 00466 /** Get current Option value as an integer */ 00467 TIDY_EXPORT ulong TIDY_CALL tidyOptGetInt( TidyDoc tdoc, TidyOptionId optId ); 00468 /** Set Option value as an integer */ 00469 TIDY_EXPORT Bool TIDY_CALL tidyOptSetInt( TidyDoc tdoc, TidyOptionId optId, ulong val ); 00470 00471 /** Get current Option value as a Boolean flag */ 00472 TIDY_EXPORT Bool TIDY_CALL tidyOptGetBool( TidyDoc tdoc, TidyOptionId optId ); 00473 /** Set Option value as a Boolean flag */ 00474 TIDY_EXPORT Bool TIDY_CALL tidyOptSetBool( TidyDoc tdoc, TidyOptionId optId, Bool val ); 00475 00476 /** Reset option to default value by ID */ 00477 TIDY_EXPORT Bool TIDY_CALL tidyOptResetToDefault( TidyDoc tdoc, TidyOptionId opt ); 00478 /** Reset all options to their default values */ 00479 TIDY_EXPORT Bool TIDY_CALL tidyOptResetAllToDefault( TidyDoc tdoc ); 00480 00481 /** Take a snapshot of current config settings */ 00482 TIDY_EXPORT Bool TIDY_CALL tidyOptSnapshot( TidyDoc tdoc ); 00483 /** Reset config settings to snapshot (after document processing) */ 00484 TIDY_EXPORT Bool TIDY_CALL tidyOptResetToSnapshot( TidyDoc tdoc ); 00485 00486 /** Any settings different than default? */ 00487 TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanDefault( TidyDoc tdoc ); 00488 /** Any settings different than snapshot? */ 00489 TIDY_EXPORT Bool TIDY_CALL tidyOptDiffThanSnapshot( TidyDoc tdoc ); 00490 00491 /** Copy current configuration settings from one document to another */ 00492 TIDY_EXPORT Bool TIDY_CALL tidyOptCopyConfig( TidyDoc tdocTo, TidyDoc tdocFrom ); 00493 00494 /** Get character encoding name. Used with TidyCharEncoding, 00495 ** TidyOutCharEncoding, TidyInCharEncoding */ 00496 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetEncName( TidyDoc tdoc, TidyOptionId optId ); 00497 00498 /** Get current pick list value for option by ID. Useful for enum types. */ 00499 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetCurrPick( TidyDoc tdoc, TidyOptionId optId); 00500 00501 /** Iterate over user declared tags */ 00502 TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDeclTagList( TidyDoc tdoc ); 00503 /** Get next declared tag of specified type: TidyInlineTags, TidyBlockTags, 00504 ** TidyEmptyTags, TidyPreTags */ 00505 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetNextDeclTag( TidyDoc tdoc, 00506 TidyOptionId optId, 00507 TidyIterator* iter ); 00508 /** Get option description */ 00509 TIDY_EXPORT ctmbstr TIDY_CALL tidyOptGetDoc( TidyDoc tdoc, TidyOption opt ); 00510 00511 /** Iterate over a list of related options */ 00512 TIDY_EXPORT TidyIterator TIDY_CALL tidyOptGetDocLinksList( TidyDoc tdoc, 00513 TidyOption opt ); 00514 /** Get next related option */ 00515 TIDY_EXPORT TidyOption TIDY_CALL tidyOptGetNextDocLinks( TidyDoc tdoc, 00516 TidyIterator* pos ); 00517 00518 /** @} end Configuration group */ 00519 00520 /** @defgroup IO I/O and Messages 00521 ** 00522 ** By default, Tidy will define, create and use 00523 ** instances of input and output handlers for 00524 ** standard C buffered I/O (i.e. FILE* stdin, 00525 ** FILE* stdout and FILE* stderr for content 00526 ** input, content output and diagnostic output, 00527 ** respectively. A FILE* cfgFile input handler 00528 ** will be used for config files. Command line 00529 ** options will just be set directly. 00530 ** 00531 ** @{ 00532 */ 00533 00534 /***************** 00535 Input Source 00536 *****************/ 00537 /** Input Callback: get next byte of input */ 00538 typedef int (TIDY_CALL *TidyGetByteFunc)( void* sourceData ); 00539 00540 /** Input Callback: unget a byte of input */ 00541 typedef void (TIDY_CALL *TidyUngetByteFunc)( void* sourceData, byte bt ); 00542 00543 /** Input Callback: is end of input? */ 00544 typedef Bool (TIDY_CALL *TidyEOFFunc)( void* sourceData ); 00545 00546 /** End of input "character" */ 00547 #define EndOfStream (~0u) 00548 00549 /** TidyInputSource - Delivers raw bytes of input 00550 */ 00551 TIDY_STRUCT 00552 typedef struct _TidyInputSource 00553 { 00554 /* Instance data */ 00555 void* sourceData; /**< Input context. Passed to callbacks */ 00556 00557 /* Methods */ 00558 TidyGetByteFunc getByte; /**< Pointer to "get byte" callback */ 00559 TidyUngetByteFunc ungetByte; /**< Pointer to "unget" callback */ 00560 TidyEOFFunc eof; /**< Pointer to "eof" callback */ 00561 } TidyInputSource; 00562 00563 /** Facilitates user defined source by providing 00564 ** an entry point to marshal pointers-to-functions. 00565 ** Needed by .NET and possibly other language bindings. 00566 */ 00567 TIDY_EXPORT Bool TIDY_CALL tidyInitSource( TidyInputSource* source, 00568 void* srcData, 00569 TidyGetByteFunc gbFunc, 00570 TidyUngetByteFunc ugbFunc, 00571 TidyEOFFunc endFunc ); 00572 00573 /** Helper: get next byte from input source */ 00574 TIDY_EXPORT uint TIDY_CALL tidyGetByte( TidyInputSource* source ); 00575 00576 /** Helper: unget byte back to input source */ 00577 TIDY_EXPORT void TIDY_CALL tidyUngetByte( TidyInputSource* source, uint byteValue ); 00578 00579 /** Helper: check if input source at end */ 00580 TIDY_EXPORT Bool TIDY_CALL tidyIsEOF( TidyInputSource* source ); 00581 00582 00583 /**************** 00584 Output Sink 00585 ****************/ 00586 /** Output callback: send a byte to output */ 00587 typedef void (TIDY_CALL *TidyPutByteFunc)( void* sinkData, byte bt ); 00588 00589 00590 /** TidyOutputSink - accepts raw bytes of output 00591 */ 00592 TIDY_STRUCT 00593 typedef struct _TidyOutputSink 00594 { 00595 /* Instance data */ 00596 void* sinkData; /**< Output context. Passed to callbacks */ 00597 00598 /* Methods */ 00599 TidyPutByteFunc putByte; /**< Pointer to "put byte" callback */ 00600 } TidyOutputSink; 00601 00602 /** Facilitates user defined sinks by providing 00603 ** an entry point to marshal pointers-to-functions. 00604 ** Needed by .NET and possibly other language bindings. 00605 */ 00606 TIDY_EXPORT Bool TIDY_CALL tidyInitSink( TidyOutputSink* sink, 00607 void* snkData, 00608 TidyPutByteFunc pbFunc ); 00609 00610 /** Helper: send a byte to output */ 00611 TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue ); 00612 00613 00614 /** Callback to filter messages by diagnostic level: 00615 ** info, warning, etc. Just set diagnostic output 00616 ** handler to redirect all diagnostics output. Return true 00617 ** to proceed with output, false to cancel. 00618 */ 00619 typedef Bool (TIDY_CALL *TidyReportFilter)( TidyDoc tdoc, TidyReportLevel lvl, 00620 uint line, uint col, ctmbstr mssg ); 00621 00622 /** Give Tidy a filter callback to use */ 00623 TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc, 00624 TidyReportFilter filtCallback ); 00625 00626 /** Set error sink to named file */ 00627 TIDY_EXPORT FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam ); 00628 /** Set error sink to given buffer */ 00629 TIDY_EXPORT int TIDY_CALL tidySetErrorBuffer( TidyDoc tdoc, TidyBuffer* errbuf ); 00630 /** Set error sink to given generic sink */ 00631 TIDY_EXPORT int TIDY_CALL tidySetErrorSink( TidyDoc tdoc, TidyOutputSink* sink ); 00632 00633 /** @} end IO group */ 00634 00635 /* TODO: Catalog all messages for easy translation 00636 TIDY_EXPORT ctmbstr tidyLookupMessage( int errorNo ); 00637 */ 00638 00639 00640 00641 /** @defgroup Parse Document Parse 00642 ** 00643 ** Parse markup from a given input source. String and filename 00644 ** functions added for convenience. HTML/XHTML version determined 00645 ** from input. 00646 ** @{ 00647 */ 00648 00649 /** Parse markup in named file */ 00650 TIDY_EXPORT int TIDY_CALL tidyParseFile( TidyDoc tdoc, ctmbstr filename ); 00651 00652 /** Parse markup from the standard input */ 00653 TIDY_EXPORT int TIDY_CALL tidyParseStdin( TidyDoc tdoc ); 00654 00655 /** Parse markup in given string */ 00656 TIDY_EXPORT int TIDY_CALL tidyParseString( TidyDoc tdoc, ctmbstr content ); 00657 00658 /** Parse markup in given buffer */ 00659 TIDY_EXPORT int TIDY_CALL tidyParseBuffer( TidyDoc tdoc, TidyBuffer* buf ); 00660 00661 /** Parse markup in given generic input source */ 00662 TIDY_EXPORT int TIDY_CALL tidyParseSource( TidyDoc tdoc, TidyInputSource* source); 00663 00664 /** @} End Parse group */ 00665 00666 00667 /** @defgroup Clean Diagnostics and Repair 00668 ** 00669 ** @{ 00670 */ 00671 /** Execute configured cleanup and repair operations on parsed markup */ 00672 TIDY_EXPORT int TIDY_CALL tidyCleanAndRepair( TidyDoc tdoc ); 00673 00674 /** Run configured diagnostics on parsed and repaired markup. 00675 ** Must call tidyCleanAndRepair() first. 00676 */ 00677 TIDY_EXPORT int TIDY_CALL tidyRunDiagnostics( TidyDoc tdoc ); 00678 00679 /** @} end Clean group */ 00680 00681 00682 /** @defgroup Save Document Save Functions 00683 ** 00684 ** Save currently parsed document to the given output sink. File name 00685 ** and string/buffer functions provided for convenience. 00686 ** @{ 00687 */ 00688 00689 /** Save to named file */ 00690 TIDY_EXPORT int TIDY_CALL tidySaveFile( TidyDoc tdoc, ctmbstr filename ); 00691 00692 /** Save to standard output (FILE*) */ 00693 TIDY_EXPORT int TIDY_CALL tidySaveStdout( TidyDoc tdoc ); 00694 00695 /** Save to given TidyBuffer object */ 00696 TIDY_EXPORT int TIDY_CALL tidySaveBuffer( TidyDoc tdoc, TidyBuffer* buf ); 00697 00698 /** Save document to application buffer. If buffer is not big enough, 00699 ** ENOMEM will be returned and the necessary buffer size will be placed 00700 ** in *buflen. 00701 */ 00702 TIDY_EXPORT int TIDY_CALL tidySaveString( TidyDoc tdoc, 00703 tmbstr buffer, uint* buflen ); 00704 00705 /** Save to given generic output sink */ 00706 TIDY_EXPORT int TIDY_CALL tidySaveSink( TidyDoc tdoc, TidyOutputSink* sink ); 00707 00708 /** @} end Save group */ 00709 00710 00711 /** @addtogroup Basic 00712 ** @{ 00713 */ 00714 /** Save current settings to named file. 00715 Only non-default values are written. */ 00716 TIDY_EXPORT int TIDY_CALL tidyOptSaveFile( TidyDoc tdoc, ctmbstr cfgfil ); 00717 00718 /** Save current settings to given output sink. 00719 Only non-default values are written. */ 00720 TIDY_EXPORT int TIDY_CALL tidyOptSaveSink( TidyDoc tdoc, TidyOutputSink* sink ); 00721 00722 00723 /* Error reporting functions 00724 */ 00725 00726 /** Write more complete information about errors to current error sink. */ 00727 TIDY_EXPORT void TIDY_CALL tidyErrorSummary( TidyDoc tdoc ); 00728 00729 /** Write more general information about markup to current error sink. */ 00730 TIDY_EXPORT void TIDY_CALL tidyGeneralInfo( TidyDoc tdoc ); 00731 00732 /** @} end Basic group (again) */ 00733 00734 00735 /** @defgroup Tree Document Tree 00736 ** 00737 ** A parsed and, optionally, repaired document is 00738 ** represented by Tidy as a Tree, much like a W3C DOM. 00739 ** This tree may be traversed using these functions. 00740 ** The following snippet gives a basic idea how these 00741 ** functions can be used. 00742 ** 00743 <pre> 00744 void dumpNode( TidyNode tnod, int indent ) 00745 { 00746 TidyNode child; 00747 00748 for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) ) 00749 { 00750 ctmbstr name; 00751 switch ( tidyNodeGetType(child) ) 00752 { 00753 case TidyNode_Root: name = "Root"; break; 00754 case TidyNode_DocType: name = "DOCTYPE"; break; 00755 case TidyNode_Comment: name = "Comment"; break; 00756 case TidyNode_ProcIns: name = "Processing Instruction"; break; 00757 case TidyNode_Text: name = "Text"; break; 00758 case TidyNode_CDATA: name = "CDATA"; break; 00759 case TidyNode_Section: name = "XML Section"; break; 00760 case TidyNode_Asp: name = "ASP"; break; 00761 case TidyNode_Jste: name = "JSTE"; break; 00762 case TidyNode_Php: name = "PHP"; break; 00763 case TidyNode_XmlDecl: name = "XML Declaration"; break; 00764 00765 case TidyNode_Start: 00766 case TidyNode_End: 00767 case TidyNode_StartEnd: 00768 default: 00769 name = tidyNodeGetName( child ); 00770 break; 00771 } 00772 assert( name != NULL ); 00773 printf( "\%*.*sNode: \%s\\n", indent, indent, " ", name ); 00774 dumpNode( child, indent + 4 ); 00775 } 00776 } 00777 00778 void dumpDoc( TidyDoc tdoc ) 00779 { 00780 dumpNode( tidyGetRoot(tdoc), 0 ); 00781 } 00782 00783 void dumpBody( TidyDoc tdoc ) 00784 { 00785 dumpNode( tidyGetBody(tdoc), 0 ); 00786 } 00787 </pre> 00788 00789 @{ 00790 00791 */ 00792 00793 TIDY_EXPORT TidyNode TIDY_CALL tidyGetRoot( TidyDoc tdoc ); 00794 TIDY_EXPORT TidyNode TIDY_CALL tidyGetHtml( TidyDoc tdoc ); 00795 TIDY_EXPORT TidyNode TIDY_CALL tidyGetHead( TidyDoc tdoc ); 00796 TIDY_EXPORT TidyNode TIDY_CALL tidyGetBody( TidyDoc tdoc ); 00797 00798 /* parent / child */ 00799 TIDY_EXPORT TidyNode TIDY_CALL tidyGetParent( TidyNode tnod ); 00800 TIDY_EXPORT TidyNode TIDY_CALL tidyGetChild( TidyNode tnod ); 00801 00802 /* siblings */ 00803 TIDY_EXPORT TidyNode TIDY_CALL tidyGetNext( TidyNode tnod ); 00804 TIDY_EXPORT TidyNode TIDY_CALL tidyGetPrev( TidyNode tnod ); 00805 00806 /* Null for non-element nodes and all pure HTML 00807 TIDY_EXPORT ctmbstr tidyNodeNsLocal( TidyNode tnod ); 00808 TIDY_EXPORT ctmbstr tidyNodeNsPrefix( TidyNode tnod ); 00809 TIDY_EXPORT ctmbstr tidyNodeNsUri( TidyNode tnod ); 00810 */ 00811 00812 /* Iterate over attribute values */ 00813 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrFirst( TidyNode tnod ); 00814 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrNext( TidyAttr tattr ); 00815 00816 TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrName( TidyAttr tattr ); 00817 TIDY_EXPORT ctmbstr TIDY_CALL tidyAttrValue( TidyAttr tattr ); 00818 00819 /* Null for pure HTML 00820 TIDY_EXPORT ctmbstr tidyAttrNsLocal( TidyAttr tattr ); 00821 TIDY_EXPORT ctmbstr tidyAttrNsPrefix( TidyAttr tattr ); 00822 TIDY_EXPORT ctmbstr tidyAttrNsUri( TidyAttr tattr ); 00823 */ 00824 00825 /** @} end Tree group */ 00826 00827 00828 /** @defgroup NodeAsk Node Interrogation 00829 ** 00830 ** Get information about any givent node. 00831 ** @{ 00832 */ 00833 00834 /* Node info */ 00835 TIDY_EXPORT TidyNodeType TIDY_CALL tidyNodeGetType( TidyNode tnod ); 00836 TIDY_EXPORT ctmbstr TIDY_CALL tidyNodeGetName( TidyNode tnod ); 00837 00838 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsText( TidyNode tnod ); 00839 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsProp( TidyDoc tdoc, TidyNode tnod ); 00840 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHeader( TidyNode tnod ); /* h1, h2, ... */ 00841 00842 TIDY_EXPORT Bool TIDY_CALL tidyNodeHasText( TidyDoc tdoc, TidyNode tnod ); 00843 TIDY_EXPORT Bool TIDY_CALL tidyNodeGetText( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf ); 00844 00845 /* Copy the unescaped value of this node into the given TidyBuffer as UTF-8 */ 00846 TIDY_EXPORT Bool TIDY_CALL tidyNodeGetValue( TidyDoc tdoc, TidyNode tnod, TidyBuffer* buf ); 00847 00848 TIDY_EXPORT TidyTagId TIDY_CALL tidyNodeGetId( TidyNode tnod ); 00849 00850 TIDY_EXPORT uint TIDY_CALL tidyNodeLine( TidyNode tnod ); 00851 TIDY_EXPORT uint TIDY_CALL tidyNodeColumn( TidyNode tnod ); 00852 00853 /** @defgroup NodeIsElementName Deprecated node interrogation per TagId 00854 ** 00855 ** @deprecated The functions tidyNodeIs{ElementName} are deprecated and 00856 ** should be replaced by tidyNodeGetId. 00857 ** @{ 00858 */ 00859 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHTML( TidyNode tnod ); 00860 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHEAD( TidyNode tnod ); 00861 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTITLE( TidyNode tnod ); 00862 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASE( TidyNode tnod ); 00863 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMETA( TidyNode tnod ); 00864 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBODY( TidyNode tnod ); 00865 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAMESET( TidyNode tnod ); 00866 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFRAME( TidyNode tnod ); 00867 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIFRAME( TidyNode tnod ); 00868 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOFRAMES( TidyNode tnod ); 00869 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsHR( TidyNode tnod ); 00870 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH1( TidyNode tnod ); 00871 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH2( TidyNode tnod ); 00872 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPRE( TidyNode tnod ); 00873 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLISTING( TidyNode tnod ); 00874 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsP( TidyNode tnod ); 00875 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsUL( TidyNode tnod ); 00876 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOL( TidyNode tnod ); 00877 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDL( TidyNode tnod ); 00878 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIR( TidyNode tnod ); 00879 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLI( TidyNode tnod ); 00880 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDT( TidyNode tnod ); 00881 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDD( TidyNode tnod ); 00882 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTABLE( TidyNode tnod ); 00883 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCAPTION( TidyNode tnod ); 00884 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTD( TidyNode tnod ); 00885 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTH( TidyNode tnod ); 00886 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTR( TidyNode tnod ); 00887 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOL( TidyNode tnod ); 00888 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCOLGROUP( TidyNode tnod ); 00889 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBR( TidyNode tnod ); 00890 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsA( TidyNode tnod ); 00891 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLINK( TidyNode tnod ); 00892 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsB( TidyNode tnod ); 00893 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsI( TidyNode tnod ); 00894 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRONG( TidyNode tnod ); 00895 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEM( TidyNode tnod ); 00896 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBIG( TidyNode tnod ); 00897 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSMALL( TidyNode tnod ); 00898 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsPARAM( TidyNode tnod ); 00899 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTION( TidyNode tnod ); 00900 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOPTGROUP( TidyNode tnod ); 00901 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsIMG( TidyNode tnod ); 00902 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMAP( TidyNode tnod ); 00903 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAREA( TidyNode tnod ); 00904 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOBR( TidyNode tnod ); 00905 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsWBR( TidyNode tnod ); 00906 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFONT( TidyNode tnod ); 00907 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLAYER( TidyNode tnod ); 00908 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPACER( TidyNode tnod ); 00909 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsCENTER( TidyNode tnod ); 00910 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTYLE( TidyNode tnod ); 00911 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSCRIPT( TidyNode tnod ); 00912 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsNOSCRIPT( TidyNode tnod ); 00913 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsFORM( TidyNode tnod ); 00914 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsTEXTAREA( TidyNode tnod ); 00915 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLOCKQUOTE( TidyNode tnod ); 00916 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsAPPLET( TidyNode tnod ); 00917 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsOBJECT( TidyNode tnod ); 00918 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsDIV( TidyNode tnod ); 00919 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSPAN( TidyNode tnod ); 00920 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsINPUT( TidyNode tnod ); 00921 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsQ( TidyNode tnod ); 00922 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsLABEL( TidyNode tnod ); 00923 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH3( TidyNode tnod ); 00924 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH4( TidyNode tnod ); 00925 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH5( TidyNode tnod ); 00926 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsH6( TidyNode tnod ); 00927 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsADDRESS( TidyNode tnod ); 00928 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsXMP( TidyNode tnod ); 00929 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSELECT( TidyNode tnod ); 00930 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBLINK( TidyNode tnod ); 00931 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMARQUEE( TidyNode tnod ); 00932 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsEMBED( TidyNode tnod ); 00933 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsBASEFONT( TidyNode tnod ); 00934 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsISINDEX( TidyNode tnod ); 00935 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsS( TidyNode tnod ); 00936 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsSTRIKE( TidyNode tnod ); 00937 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsU( TidyNode tnod ); 00938 TIDY_EXPORT Bool TIDY_CALL tidyNodeIsMENU( TidyNode tnod ); 00939 00940 /** @} End NodeIsElementName group */ 00941 00942 /** @} End NodeAsk group */ 00943 00944 00945 /** @defgroup Attribute Attribute Interrogation 00946 ** 00947 ** Get information about any given attribute. 00948 ** @{ 00949 */ 00950 00951 TIDY_EXPORT TidyAttrId TIDY_CALL tidyAttrGetId( TidyAttr tattr ); 00952 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsEvent( TidyAttr tattr ); 00953 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsProp( TidyAttr tattr ); 00954 00955 /** @defgroup AttrIsAttributeName Deprecated attribute interrogation per AttrId 00956 ** 00957 ** @deprecated The functions tidyAttrIs{AttributeName} are deprecated and 00958 ** should be replaced by tidyAttrGetId. 00959 ** @{ 00960 */ 00961 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHREF( TidyAttr tattr ); 00962 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSRC( TidyAttr tattr ); 00963 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsID( TidyAttr tattr ); 00964 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsNAME( TidyAttr tattr ); 00965 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSUMMARY( TidyAttr tattr ); 00966 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALT( TidyAttr tattr ); 00967 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLONGDESC( TidyAttr tattr ); 00968 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsUSEMAP( TidyAttr tattr ); 00969 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsISMAP( TidyAttr tattr ); 00970 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANGUAGE( TidyAttr tattr ); 00971 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTYPE( TidyAttr tattr ); 00972 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVALUE( TidyAttr tattr ); 00973 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCONTENT( TidyAttr tattr ); 00974 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTITLE( TidyAttr tattr ); 00975 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsXMLNS( TidyAttr tattr ); 00976 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsDATAFLD( TidyAttr tattr ); 00977 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsWIDTH( TidyAttr tattr ); 00978 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHEIGHT( TidyAttr tattr ); 00979 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsFOR( TidyAttr tattr ); 00980 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSELECTED( TidyAttr tattr ); 00981 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCHECKED( TidyAttr tattr ); 00982 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLANG( TidyAttr tattr ); 00983 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTARGET( TidyAttr tattr ); 00984 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsHTTP_EQUIV( TidyAttr tattr ); 00985 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsREL( TidyAttr tattr ); 00986 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEMOVE( TidyAttr tattr ); 00987 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEDOWN( TidyAttr tattr ); 00988 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEUP( TidyAttr tattr ); 00989 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnCLICK( TidyAttr tattr ); 00990 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOVER( TidyAttr tattr ); 00991 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnMOUSEOUT( TidyAttr tattr ); 00992 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYDOWN( TidyAttr tattr ); 00993 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYUP( TidyAttr tattr ); 00994 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnKEYPRESS( TidyAttr tattr ); 00995 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnFOCUS( TidyAttr tattr ); 00996 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsOnBLUR( TidyAttr tattr ); 00997 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsBGCOLOR( TidyAttr tattr ); 00998 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsLINK( TidyAttr tattr ); 00999 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsALINK( TidyAttr tattr ); 01000 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsVLINK( TidyAttr tattr ); 01001 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsTEXT( TidyAttr tattr ); 01002 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsSTYLE( TidyAttr tattr ); 01003 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsABBR( TidyAttr tattr ); 01004 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsCOLSPAN( TidyAttr tattr ); 01005 TIDY_EXPORT Bool TIDY_CALL tidyAttrIsROWSPAN( TidyAttr tattr ); 01006 01007 /** @} End AttrIsAttributeName group */ 01008 01009 /** @} end AttrAsk group */ 01010 01011 01012 /** @defgroup AttrGet Attribute Retrieval 01013 ** 01014 ** Lookup an attribute from a given node 01015 ** @{ 01016 */ 01017 01018 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetById( TidyNode tnod, TidyAttrId attId ); 01019 01020 /** @defgroup AttrGetAttributeName Deprecated attribute retrieval per AttrId 01021 ** 01022 ** @deprecated The functions tidyAttrGet{AttributeName} are deprecated and 01023 ** should be replaced by tidyAttrGetById. 01024 ** For instance, tidyAttrGetID( TidyNode tnod ) can be replaced by 01025 ** tidyAttrGetById( TidyNode tnod, TidyAttr_ID ). This avoids a potential 01026 ** name clash with tidyAttrGetId for case-insensitive languages. 01027 ** @{ 01028 */ 01029 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHREF( TidyNode tnod ); 01030 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSRC( TidyNode tnod ); 01031 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetID( TidyNode tnod ); 01032 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetNAME( TidyNode tnod ); 01033 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSUMMARY( TidyNode tnod ); 01034 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALT( TidyNode tnod ); 01035 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLONGDESC( TidyNode tnod ); 01036 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetUSEMAP( TidyNode tnod ); 01037 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetISMAP( TidyNode tnod ); 01038 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANGUAGE( TidyNode tnod ); 01039 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTYPE( TidyNode tnod ); 01040 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVALUE( TidyNode tnod ); 01041 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCONTENT( TidyNode tnod ); 01042 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTITLE( TidyNode tnod ); 01043 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetXMLNS( TidyNode tnod ); 01044 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetDATAFLD( TidyNode tnod ); 01045 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetWIDTH( TidyNode tnod ); 01046 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHEIGHT( TidyNode tnod ); 01047 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetFOR( TidyNode tnod ); 01048 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSELECTED( TidyNode tnod ); 01049 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCHECKED( TidyNode tnod ); 01050 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLANG( TidyNode tnod ); 01051 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTARGET( TidyNode tnod ); 01052 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetHTTP_EQUIV( TidyNode tnod ); 01053 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetREL( TidyNode tnod ); 01054 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEMOVE( TidyNode tnod ); 01055 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEDOWN( TidyNode tnod ); 01056 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEUP( TidyNode tnod ); 01057 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnCLICK( TidyNode tnod ); 01058 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOVER( TidyNode tnod ); 01059 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOUT( TidyNode tnod ); 01060 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYDOWN( TidyNode tnod ); 01061 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYUP( TidyNode tnod ); 01062 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnKEYPRESS( TidyNode tnod ); 01063 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnFOCUS( TidyNode tnod ); 01064 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetOnBLUR( TidyNode tnod ); 01065 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetBGCOLOR( TidyNode tnod ); 01066 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetLINK( TidyNode tnod ); 01067 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetALINK( TidyNode tnod ); 01068 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetVLINK( TidyNode tnod ); 01069 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetTEXT( TidyNode tnod ); 01070 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetSTYLE( TidyNode tnod ); 01071 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetABBR( TidyNode tnod ); 01072 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetCOLSPAN( TidyNode tnod ); 01073 TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetROWSPAN( TidyNode tnod ); 01074 01075 /** @} End AttrGetAttributeName group */ 01076 01077 /** @} end AttrGet group */ 01078 01079 #ifdef __cplusplus 01080 } /* extern "C" */ 01081 #endif 01082 #endif /* __TIDY_H__ */ 01083 01084 /* 01085 * local variables: 01086 * mode: c 01087 * indent-tabs-mode: nil 01088 * c-basic-offset: 4 01089 * eval: (c-set-offset 'substatement-open 0) 01090 * end: 01091 */