File: SDMXSchema-methods.R

package info (click to toggle)
r-cran-rsdmx 1%3A0.6-5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,024 kB
  • sloc: sh: 14; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 915 bytes parent folder | download
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
#' @name SDMXSchema
#' @rdname SDMXSchema
#' @aliases SDMXSchema,SDMXSchema-method
#' 
#' @usage
#' SDMXSchema(xmlObj, namespaces)
#' 
#' @param xmlObj object of class "XMLInternalDocument derived from XML package
#' @param namespaces object of class "data.frame" given the list of namespace URIs
#' @return an object of class "SDMXSchema"
#' 
#' @seealso \link{readSDMX}
#' @export
#' 

SDMXSchema <- function(xmlObj, namespaces) {
        new("SDMXSchema", version = version.SDMXSchema(xmlObj, namespaces));
}

#default functions
version.SDMXSchema <- function(xmlObj, namespaces){
	schemaVersion <- NULL
  for(i in 1:nrow(namespaces)){
    parsed <- strsplit(namespaces$uri[i],"/")[[1]];
    if(tolower(parsed[3]) == "www.sdmx.org"){
	    schemaVersion <-  gsub("_",".",substr(parsed[substr(parsed,0,1)=="v"],2,nchar(parsed,"w")));
      break;
    }
  }
	return(schemaVersion);
}