Currently the main classes of the XML handling package xml2 are only S3 classes and thus cannot be used in slots for S4 classes. To remedy this, classes can be registered with setOldClass(..). This is done within this package, but should really be part of xml2, see https://github.com/r-lib/xml2/issues/248