libxml2

Loading...
Searching...
No Matches
Data Fields
_xmlSAXHandler Struct Reference

Callbacks for SAX parser. More...

`#include <parser.h>`

## Data Fields
internalSubsetSAXFunc | internalSubset
| Called after the start of the document type declaration was parsed.
isStandaloneSAXFunc | isStandalone
| Standalone status.
hasInternalSubsetSAXFunc | hasInternalSubset
| Internal subset availability.
hasExternalSubsetSAXFunc | hasExternalSubset
| External subset availability.
resolveEntitySAXFunc | resolveEntity
| Only called when loading external DTDs.
getEntitySAXFunc | getEntity
| Called when looking up general entities.
entityDeclSAXFunc | entityDecl
| Called after an entity declaration was parsed.
notationDeclSAXFunc | notationDecl
| Called after a notation declaration was parsed.
attributeDeclSAXFunc | attributeDecl
| Called after an attribute declaration was parsed.
elementDeclSAXFunc | elementDecl
| Called after an element declaration was parsed.
unparsedEntityDeclSAXFunc | unparsedEntityDecl
| Called after an unparsed entity declaration was parsed.
setDocumentLocatorSAXFunc | setDocumentLocator
| This callback receives the "document locator" at startup, which is always the global xmlDefaultSAXLocator.
startDocumentSAXFunc | startDocument
| Called after the XML declaration was parsed.
endDocumentSAXFunc | endDocument
| Called at the end of the document.
startElementSAXFunc | startElement
| Legacy start tag handler.
endElementSAXFunc | endElement
| See _xmlSAXHandler.startElement.
referenceSAXFunc | reference
| Called after an entity reference was parsed.
charactersSAXFunc | characters
| Called after a character data was parsed.
ignorableWhitespaceSAXFunc | ignorableWhitespace
| Called after "ignorable" whitespace was parsed.
processingInstructionSAXFunc | processingInstruction
| Called after a processing instruction was parsed.
commentSAXFunc | comment
| Called after a comment was parsed.
warningSAXFunc | warning
| Callback for warning messages.
errorSAXFunc | error
| Callback for error messages.
fatalErrorSAXFunc | fatalError
| Unused, all errors go to `error`.
getParameterEntitySAXFunc | getParameterEntity
| Called when looking up parameter entities.
cdataBlockSAXFunc | cdataBlock
| Called after a CDATA section was parsed.
externalSubsetSAXFunc | externalSubset
| Called to parse the external subset.
unsigned int | initialized
| Legacy magic value.
void * | _private
| Application data.
startElementNsSAX2Func | startElementNs
| Called after a start tag was parsed.
endElementNsSAX2Func | endElementNs
| Called after an end tag was parsed.
xmlStructuredErrorFunc | serror
| Structured error handler.

## Detailed Description

Callbacks for SAX parser.

For DTD-related handlers, it's recommended to either use the original libxml2 handler or set them to NULL if DTDs can be ignored.

## Field Documentation

## ◆ attributeDecl

attributeDeclSAXFunc attributeDecl

Called after an attribute declaration was parsed.

Should typically not be modified.

## ◆ elementDecl

elementDeclSAXFunc elementDecl

Called after an element declaration was parsed.

Should typically not be modified.

## ◆ entityDecl

entityDeclSAXFunc entityDecl

Called after an entity declaration was parsed.

Should typically not be modified.

## ◆ externalSubset

externalSubsetSAXFunc externalSubset

Called to parse the external subset.

Should typically not be modified.

## ◆ getEntity

getEntitySAXFunc getEntity

Called when looking up general entities.

Should typically not be modified.

## ◆ getParameterEntity

getParameterEntitySAXFunc getParameterEntity

Called when looking up parameter entities.

Should typically not be modified.

## ◆ hasExternalSubset

hasExternalSubsetSAXFunc hasExternalSubset

External subset availability.

Not invoked by the parser. Not supposed to be changed by applications.

## ◆ hasInternalSubset

hasInternalSubsetSAXFunc hasInternalSubset

Internal subset availability.

Not invoked by the parser. Not supposed to be changed by applications.

## ◆ ignorableWhitespace

ignorableWhitespaceSAXFunc ignorableWhitespace

Called after "ignorable" whitespace was parsed.

`ignorableWhitespace` should always be set to the same value as `characters`. Otherwise, the parser will try to detect whitespace which is unreliable.

## ◆ initialized

unsigned int initialized

Legacy magic value.

`initialized` should always be set to XML_SAX2_MAGIC to enable the modern SAX2 interface.

## ◆ internalSubset

internalSubsetSAXFunc internalSubset

Called after the start of the document type declaration was parsed.

Should typically not be modified.

## ◆ isStandalone

isStandaloneSAXFunc isStandalone

Standalone status.

Not invoked by the parser. Not supposed to be changed by applications.

## ◆ notationDecl

notationDeclSAXFunc notationDecl

Called after a notation declaration was parsed.

Should typically not be modified.

## ◆ resolveEntity

resolveEntitySAXFunc resolveEntity

Only called when loading external DTDs.

Not called to load external entities.

Should typically not be modified.

## ◆ serror

xmlStructuredErrorFunc serror

Structured error handler.

Takes precedence over `error` or `warning`, but modern code should use xmlCtxtSetErrorHandler().

## ◆ setDocumentLocator

setDocumentLocatorSAXFunc setDocumentLocator

This callback receives the "document locator" at startup, which is always the global xmlDefaultSAXLocator.

Everything is available on the context, so this is useless in our case.

## ◆ startDocument

startDocumentSAXFunc startDocument

Called after the XML declaration was parsed.

Use xmlCtxtGetVersion(), xmlCtxtGetDeclaredEncoding() and xmlCtxtGetStandalone() to get data from the XML declaration.

## ◆ startElement

startElementSAXFunc startElement

Legacy start tag handler.

`startElement` and `endElement` are only used by the legacy SAX1 interface and should not be used in new software. If you really have to enable SAX1, the preferred way is set the `initialized` member to 1 instead of XML_SAX2_MAGIC.

For backward compatibility, it's also possible to set the `startElementNs` and `endElementNs` handlers to NULL.

You can also set the XML_PARSE_SAX1 parser option, but versions older than 2.12.0 will probably crash if this option is provided together with custom SAX callbacks.

## ◆ unparsedEntityDecl

unparsedEntityDeclSAXFunc unparsedEntityDecl

Called after an unparsed entity declaration was parsed.

Should typically not be modified.

The documentation for this struct was generated from the following file:

- parser.h