| writeWIxml {widgetInvoke} | R Documentation |
These functions are used to serialize object of class wFun to
and from XML files.
writeWIxml(wFun, file = paste(funName(wFun), "xml", sep = ".")) readWIxml(file)
wFun |
An object of class wFun to serialize. |
file |
The filename to use for reading or writing. |
The class wFun is used to create the user interface in
the widgetInvoke function. These wFun
objects must be precreated for any given function, and then stored in
XML format in the inst/wFun directory of the appropriate
package, and are then read in with readWIxml when the user
calls widgetInvoke for that function.
The XML format used first defines the primary tag of wFun,
which indicates the start of a wFun definition. There are two
main sub-fields in the wFun block: funName and
funArgList. The former simply contains a string indicating the
name of this function. The funArgList block itself contains a
series of smaller blocks, each representing an argument to the
function.
Within the funArgList are a series of funArg blocks.
Within each funArg are six tags. The first is argName,
detailing the argument's name. The second is argDefault, which
if not empty is the default value of the argument. Next is
argType, which describes the type of the argument
(e.g. character, numeric, logical, or ANY for an untyped argument).
The argLocation field specifies which tab this argument appears
on in the widgetInvoke notebook, and
argWidgetType describes the type of widget to use in displaying
this argument. Finally, the argRequired field is a logical
value specifying if this argument is required to be filled in by the
user (or a default) before evaluation of the function.
As an example, the following is an example for the function
apropos:
<?xml version="1.0"?>
<wFun xmlns:bt="http://www.bioconductor.org/WINVOKE">
<funName>apropos</funName>
<funArgList>
<funArg>
<argName>what</argName>
<argDefault></argDefault>
<argType>ANY</argType>
<argLocation>main</argLocation>
<argWidgetType>TypeIn</argWidgetType>
<argRequired>FALSE</argRequired>
</funArg>
<funArg>
<argName>where</argName>
<argDefault>FALSE</argDefault>
<argType>logical</argType>
<argLocation>main</argLocation>
<argWidgetType>Radio</argWidgetType>
<argRequired>FALSE</argRequired>
</funArg>
<funArg>
<argName>mode</argName>
<argDefault>"any"</argDefault>
<argType>character</argType>
<argLocation>main</argLocation>
<argWidgetType>TypeIn</argWidgetType>
<argRequired>FALSE</argRequired>
</funArg>
</funArgList>
</wFun>
The readWIxml will return an object of class wFun
representing the data stored in the specified XML file.
The writeWIxml function has no return value.
Jeff Gentry
z <- readWIxml(system.file("wFun-example", "apropos.xml",
package="widgetInvoke"))
writeWIxml(z, file=tempfile())