Learn R Programming

XiMpLe (version 0.03-21)

pasteXMLTag: Write an XML tag

Usage

pasteXMLTag(tag, attr = NULL, child = NULL, empty = TRUE,
    level = 1, allow.empty = FALSE, rename = NULL,
    shine = 2, indent.by = "", tidy = TRUE)
tag{Character string, name of the XML tag.}

attr{A list of attributes for the tag.}

child{If empty=FALSE, a character string to be pasted as a child node between start and end tag.}

empty{Logical, or }

level{Indentation level.}

allow.empty{Logical, if FALSE, tags without attributes will not be returned.}

rename{An optional named list if the attributes in XML need to be renamed from their list names in attr. This list must in turn have a list element named after tag, containing named character elements, where the names represent the element names in attr and their values the names the XML attribute should get.}

shine{Integer, controlling if the output should be formatted for better readability. Possible values: [object Object],[object Object],[object Object]}

indent.by{A charachter string defining how indentation should be done. Defaults to tab.}

tidy{Logical, if TRUE the special characters "<", "="">" and "&" will be replaced with the entities "<", ">" and "&" in attribute values. For comment or CDATA tags, if the text includes newline characters they will also be indented.}

A character string. Creates a whole XML tag with attributes and, if it is a pair of start and end tags, also one object as child. This can be used recursively to create whole XML tree structures with this one function. However, you will probably not want to use this function at all, as it is much more comfortable to create XML nodes or even nested trees with XMLNode and XMLTree, and then feed the result to pasteXML. sample.XML.tag <- pasteXMLTag("a", attr=list(href="http://example.com", target="_blank"), child="klick here!", empty=FALSE) XMLNode, XMLTree, pasteXML

Arguments