File: event.R

package info (click to toggle)
r-cran-xml 3.99-0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,688 kB
  • sloc: ansic: 6,659; xml: 2,890; asm: 486; sh: 12; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 863 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
h =
  list(.text = function(content) cat("text:", content, "\n"),
       .comment = function(content) cat("##", content, "\n"),
       .processingInstruction = function(target, content) cat("PI: [", target, "]", content, "\n"),
       .startElement = function(node, attrs) { cat("New node:", node, paste(names(attrs), collapse = ", "), "\n")},
       .endElement = function(node) { cat("end node:", node, "\n")},
       .startDocument = function(...) cat("start of document\n"),
       .endDocument = function(...) cat("end of document\n"),
       .cdata = function(content) cat("CDATA:", content, "\n"),
       .entityDeclaration = function(...) {cat("Defining an entity\n"); print(list(...))},
       .getEntity = function(name) { cat("Getting entity", name, "\n") ; "x"}
       #entity, isStandalone
      )


xmlEventParse("test.xml", h, useDotNames = TRUE)