defineClasses: Define R classes corresponding to XML schema types

Description Usage Arguments Value Author(s)


This function maps SchemaType-class objects describing XML schema types to R class definitions within the existing R session.


defineClasses(types, where = globalenv(), namespaceDefs = list(),
               verbose = FALSE, baseClass = BaseClassName, force = FALSE,
               opts = new("CodeGenOpts"),
                pending = new.env(hash = TRUE, emptyenv()),
                classes = new.env(hash = TRUE, emptyenv()))



a list of SchemaType-class objects describing the XML schema types.


the environment in which the new R class definitions should be defined and assigned. This is passed as the value of the where parameter in the call to setClass.


a character vector giving the prefix = URI pairs which are used to compare the namespaces in the SchemaType-class objects with those in the standard schema, i.e. XSD.


a logical value indicating whether to emit messages on the console as classes are defined.


the name of the base class which is added to the contains vector for each new class. This allows all the newly defined classes to have a common base class, perhaps with multiple inheritance. This can be used to define methods for all these classes and instances. For example, we might provide a documentation method that provides the help from the XML schema's annotation nodes.


a logical value. By default, if there is an existing R class with a name corresponding to a SchemaType-class object, this function does not redefine it. This means that when one runs the function a second time, the classes are not redefined. To override this, use force = TRUE.


an instance of CodeGenOpts that controls how the sub-functions generate code. This class can be sub-classed/derived and new options introduced.


environments which are updated by the different functions and methods we call to register the names of the classes that are being processed and defined. We allow these to be specified by the caller so that she can control and monitor some of the processing.


additional parameters passed on to defClass. For example, defineEnumVars can be TRUE and then string values from RestrictedStringDefinition types are also assigned to variables with the same name as the value. This can be beneficial as typos are caught because the variables aren't found. However, non-matching values are also caught at run time too.


A list with the class definitions. This function is run more for its side-effect of defining new classes.


Duncan Temple Lang

sckott/XMLSchema documentation built on May 29, 2019, 3:46 p.m.