XMLgenerators | R Documentation |
Takes an object of class XiMpLe.validity
and turns it into a character vector of generator functions for each XML node that
was defined.
XMLgenerators(
validity,
prefix = "XML",
checkValidity = TRUE,
indent.by = getOption("XiMpLe_indent", "\t"),
roxygenDocs = FALSE,
valParam = "validity",
replaceChar = "_",
dir = NULL,
overwrite = FALSE,
oneFile = NULL
)
## S4 method for signature 'XiMpLe.validity'
XMLgenerators(
validity,
prefix = "XML",
checkValidity = TRUE,
indent.by = "\t",
roxygenDocs = FALSE,
valParam = "validity",
replaceChar = "_",
dir = NULL,
overwrite = FALSE,
oneFile = NULL
)
validity |
An dobject of class |
prefix |
A character string to be used as a prefix for the resulting function names. |
checkValidity |
Logical, whether all functions should include a check for valid XML. |
indent.by |
A charachter string defining how indentation should be done. |
roxygenDocs |
Logical, whether a skeleton for roxygen2-ish documentation should be added. |
valParam |
A charachter string,
name of the additional parameter to use for validation if
|
replaceChar |
A (single) character to be used as an replacement for invalid characters for
|
dir |
A charachter string, path to write files to. If |
overwrite |
Logical,
whether existing files should be replaced when |
oneFile |
A charachter string. If set, all functions are to be documented in one single *.Rd file, named like the string. |
The resulting code follows these rules:
Each child node gets its own argument, except if there is only one valid child node. It will use the dots element instead then.
Each attribute will also get its own argument.
If CheckValidity=TRUE
,
one extra argument named after the value of valParam
will be added.
All arguments are set to NULL
by default.
Only the main level of "allAttrs"
will be taken into account,
there's no recursion for this slot.
If dir=NULL
a named vector of character strings. Otherwise one or more files are
written do the location specified via dir
.
XMLValidity
and
XiMpLe.validity
HTMLish <- XMLValidity(
children=list(
body=c("a", "p", "ol", "ul", "strong"),
head=c("title"),
html=c("head", "body"),
li=c("a", "br", "strong"),
ol=c("li"),
p=c("a", "br", "ol", "ul", "strong"),
ul=c("li")
),
attrs=list(
a=c("href", "name"),
p=c("align")
),
allChildren=c("!--"),
allAttrs=c("id", "class"),
empty=c("br")
)
XMLgenerators(HTMLish)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.