xmlEventHandler.RdThis is a function that returns a closure instance
containing the default handlers for use with
xmlEventParse for parsing XML documents
via the SAX-style parsing.
xmlEventHandler()These handlers simply build up the DOM tree and thus
perform the same job as xmlTreeParse.
It is here more as an example, reference and a base
that users can extend.
The return value is a list of functions which are used as callbacks by the internal XML parser when it encounters certain XML elements/structures. These include items such as the start of an element, end of an element, processing instruction, text node, comment, entity references and definitions, etc.
xmlEventParse(system.file("exampleData", "mtcars.xml", package="XML"),
handlers=xmlEventHandler())
#> $startElement
#> function (name, atts, ...)
#> {
#> con$addTag(name, attrs = atts, close = FALSE)
#> }
#> <bytecode: 0x5631324ca8d8>
#> <environment: 0x56312ef09ec0>
#>
#> $endElement
#> function (name)
#> {
#> con$closeTag(name)
#> }
#> <bytecode: 0x5631324ce388>
#> <environment: 0x56312ef09ec0>
#>
#> $processingInstruction
#> function (sys, value)
#> {
#> con$addNode(xmlPINode(sys, value))
#> }
#> <bytecode: 0x5631324cce50>
#> <environment: 0x56312ef09ec0>
#>
#> $text
#> function (x, ...)
#> {
#> con$addNode(xmlTextNode(x))
#> }
#> <bytecode: 0x5631324ce0b0>
#> <environment: 0x56312ef09ec0>
#>
#> $comment
#> function (x, ...)
#> {
#> xmlCommentNode(x)
#> }
#> <bytecode: 0x5631324cdcc0>
#> <environment: 0x56312ef09ec0>
#>
#> $externalEntity
#> function (ctxt, baseURI, sysId, publicId, ...)
#> {
#> cat("externalEntity", ctxt, baseURI, sysId, publicId, "\n")
#> }
#> <bytecode: 0x5631324cd9e8>
#> <environment: 0x56312ef09ec0>
#>
#> $entityDeclaration
#> function (name, baseURI, sysId, publicId, notation, ...)
#> {
#> cat("externalEntity", name, baseURI, sysId, publicId, notation,
#> "\n")
#> }
#> <bytecode: 0x5631324cd390>
#> <environment: 0x56312ef09ec0>
#>
#> $dom
#> function ()
#> {
#> con
#> }
#> <bytecode: 0x5631324cca60>
#> <environment: 0x56312ef09ec0>
#>