XML (version 3.1-1)

xmlValue: Extract or set the contents of a leaf XML node

Description

Some types of XML nodes have no children nodes, but are leaf nodes and simply contain text. Examples are XMLTextMode, XMLProcessingInstruction. This function provides access to their raw contents. This has been extended to operate recursivel on arbitrary XML nodes that contain a single text node.

Usage

xmlValue(x, ignoreComments = FALSE, recursive = TRUE, encoding = CE_NATIVE)

Arguments

Value

  • The object stored in the value slot of the XMLNode object. This is typically a string.

References

http://www.w3.org/XML, http://www.jclark.com/xml, http://www.omegahat.org

See Also

xmlChildren xmlName xmlAttrs xmlNamespace

Examples

Run this code
node <- xmlNode("foo", "Some text")
 xmlValue(node)

 xmlValue(xmlTextNode("some more raw text"))

  # Setting the xmlValue().
 a = newXMLNode("a")
 xmlValue(a) = "the text"
 xmlValue(a) = "different text"

 a = newXMLNode("x", "bob")
 xmlValue(a) = "joe"

 b = xmlNode("bob")
 xmlValue(b) = "Foo"
 xmlValue(b) = "again"

 b = newXMLNode("bob", "some text")
 xmlValue(b[[1]]) = "change"
 b

Run the code above in your browser using DataLab