File: parseDTD.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 (24 lines) | stat: -rw-r--r-- 730 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
parseDTD <- 
function(extId, asText = FALSE, name = "", isURL = FALSE, error = xmlErrorCumulator())
{
  extId <- as.character(extId)
  if(!asText && missing(isURL)) {
    isURL <- length(grep("(http|ftp)://", extId, useBytes = TRUE))  > 0 
  }

  if(missing(name))
     name <- extId

  .oldErrorHandler = setXMLErrorHandler(error)
  on.exit(.Call("RS_XML_setStructuredErrorHandler", .oldErrorHandler, PACKAGE = "XML"), add = TRUE)

  if(asText) {
    f <- gsub("\\", "/", tempfile(), fixed=TRUE)    
    cat(extId, "\n", file = f)
    extId = f
    asText = FALSE
  }
  
 .Call("RS_XML_getDTD", as.character(name), as.character(extId),  
                          as.logical(asText), as.logical(isURL), error, PACKAGE = "XML")
}