File: xmlHandler.Rd

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 (39 lines) | stat: -rw-r--r-- 1,109 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
\name{xmlHandler}
\alias{xmlHandler}
\title{ Example XML Event Parser Handler Functions}
\description{
 A closure containing simple functions for the different
 types of events potentially called by the \link{xmlEventParse},
 and some tag-specific functions to illustrate how one can
 add functions for specific DTDs and XML element types.
 Contains a local \link{list} which can be mutated
 by invocations of the closure's function. 
}
\usage{
xmlHandler()
}

\value{
 List containing the functions enumerated
 in the closure definition along with the
 \link{list}.

}
\author{Duncan Temple Lang}
\note{This is just an example.}

\seealso{\link{xmlEventParse}, \link{xmlTreeParse}}

\examples{
\dontrun{
xmlURL <- "https://www.omegahat.net/Scripts/Data/mtcars.xml"
xmlText <- paste(scan(xmlURL, what="", sep="\n"),"\n",collapse="\n")
}

xmlURL <- system.file("exampleData", "mtcars.xml", package="XML")
xmlText <- paste(readLines(xmlURL), "\n", collapse="")
xmlEventParse(xmlText, handlers = NULL, asText=TRUE)
xmlEventParse(xmlText, xmlHandler(), useTagName=TRUE, asText=TRUE)
}
\keyword{file}
\keyword{IO}