fromBFXML: Convert an XML object into S4 object.

Description Usage Arguments Details Methods Author(s) References See Also

Description

Methods for function fromBFXML.

Usage

1
fromBFXML(node, obj, type = NULL, converters = list(), forceList = FALSE)

Arguments

node

XML node (as one returned by bfRequest)

obj

See details

type

betfair type (equivalently S4 class name) of the output

converters

a list of functions to be used to convert undefined classes (see the object defaultStructBFConverters)

forceList

TRUE for recursive list mirroring the node

Details

The function fromBFXML is used internally to convert xml nodes resulted from betfair API requests into valid S4 objects as specified by betfair service WSDL description. Methods are dispatched only for the second argument obj.

S4 equivalents for betfair types are not provided with the package. You need to initialize them with

bfInitClasses()

You need XMLSchema package for this.

Once installed, you can use str(getClass(foo)) to view the strucutre of class 'foo'.

Methods

signature(obj = "ANY")

obj should be a valid S4 object with the same structure as node. It is usually created with new(objClass), where objClass is the class generated with the defineClasses function from XMLSchema package, or 'SSOAP' package function genSOAPClientInterface.

The function ties hard to find and install all the "as" methods. In rare cases it will fail. To make it work you have to define the specific conversion yourself.

'type' argument is ignored in this method.

signature(obj = "list")

All elements of the node are converted in corresponding elements of a list. 'type' argument is ignored.

signature(obj = "missing")

Target S4 class is taken from 'type' argument, or if missing is inferred from the node itself.

signature(obj = "vector")

Like the list method but unlist it's argument, to make it a vector.

Author(s)

Vitalie Spinu

References

https://docs.developer.betfair.com/betfair/

See Also

'betfairly-package' 'bfInitClasses'


vspinu/betfairly documentation built on May 3, 2019, 7:08 p.m.