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