Main Page Modules Namespace List Data Structures File List Data Fields Examples

# SGML Parser

## Modules

HTML Extension
XML Extension

## Defines

#define | sgmlParserGetExtensionContext(parser) parser->internal.extensionContext
#define | sgmlParserGetUserContext(parser) parser->internal.userContext

## Functions

SGML_PARSER * | sgmlParserNew ()
unsigned long | sgmlParserInitialize (SGML_PARSER *parser, enum SgmlExtensionType type, SGML_HANDLERS *handlers, void *userContext)
void | sgmlParserDestroy (SGML_PARSER *parser, unsigned char destroyParser)
unsigned long | sgmlParserParseString (SGML_PARSER *parser, const char *string, const unsigned long stringLength)
unsigned long | sgmlParserParseFile (SGML_PARSER *parser, const char *file)
void | sgmlParserExtensionSetParam (SGML_PARSER *parser, unsigned long param, void *value)
void | sgmlParserExtensionGetParam (SGML_PARSER *parser, unsigned long param, void *value)

## Detailed Description

The SGML parser.

## Function Documentation

void sgmlParserDestroy | ( | SGML_PARSER * | parser,
|  | unsigned char | destroyParser
| ) |

Destroys and deinitializes an SGML_PARSER. If the destroyParser parameter is 1, the pointer passed in is deallocated by free().

Parameters:

  parser | [in] The parser context.
  destroyParser | [in] 1 if the parser should be destroyed by free(), 0 if not.

Examples:
  test.c, testhtml.c, and testxml.c.

void sgmlParserExtensionGetParam | ( | SGML_PARSER * | parser,
|  | unsigned long | param,
|  | void * | value
| ) |

Gets a parameter on a given SGML parser extension.

If the type passed to initialize was...

- SGML_PARSER_TYPE_XML Look at sgmlExtensionXmlSetParam
- SGML_PARSER_TYPE_HTML Look at sgmlExtensionHtmlSetParam
- SGML_PARSER_TYPE_CUSTOM This method has no use.

void sgmlParserExtensionSetParam | ( | SGML_PARSER * | parser,
|  | unsigned long | param,
|  | void * | value
| ) |

Sets a parameter on a given SGML parser extension.

If the type passed to initialize was...

- SGML_PARSER_TYPE_XML Look at sgmlExtensionXmlSetParam
- SGML_PARSER_TYPE_HTML Look at sgmlExtensionHtmlSetParam
- SGML_PARSER_TYPE_CUSTOM This method has no use.

Examples:
  testhtml.c.

unsigned long sgmlParserInitialize | ( | SGML_PARSER * | parser,
|  | enum SgmlExtensionType | type,
|  | SGML_HANDLERS * | handlers,
|  | void * | userContext
| ) |

Initializes an SGML_PARSER.

The type parameter can be one of the following:

- SGML_EXTENSION_TYPE_XML Use the XML parser.
- SGML_EXTENSION_TYPE_HTML Use the HTML parser.
- SGML_EXTENSION_TYPE_CUSTOM Use a custom parser.

Parameters:

  parser | [in] The parser context.
  type | [in] The type of parser to use.
  handlers | [in] User defined handlers. These should only be set if the type is SGML_EXTENSION_TYPE_CUSTOM.
  userContext | [in] The arbitrary user context that is passed into the handlers.

Returns:
  On success, one is returned.

Examples:
  test.c, testhtml.c, and testxml.c.

SGML_PARSER* sgmlParserNew | ( |  | ) |

Constructs and initializes a new SGML_PARSER instance.

Returns:
  On success, an initialized SGML_PARSER instance is returned. Otherwise, NULL is returned.

unsigned long sgmlParserParseFile | ( | SGML_PARSER * | parser,
|  | const char * | file
| ) |

Parser a given file.

Parameters:

  parser | [in] The parser context.
  file | [in] The name of the file to parse.

Returns:
  On success, one is returned. Otherwise, 0 is returned.

Examples:
  test.c, testhtml.c, and testxml.c.

unsigned long sgmlParserParseString | ( | SGML_PARSER * | parser,
|  | const char * | string,
|  | const unsigned long | stringLength
| ) |

Parses a given string.

Parameters:

  parser | [in] The parser context.
  string | [in] The string to parser.
  stringLength | [in] The length of the string to be parsed.

Returns:
  On success, one is returned. Otherwise, 0 is returned.