1\name{xmlValue} 2\alias{xmlValue} 3\alias{xmlValue.XMLCDataNode} 4\alias{xmlValue.XMLNode} 5\alias{xmlValue.XMLProcessingInstruction} 6\alias{xmlValue.XMLTextNode} 7\alias{xmlValue.XMLComment} 8\alias{xmlValue<-} 9\alias{xmlValue<-,XMLAbstractNode-method} 10\alias{xmlValue<-,XMLInternalTextNode-method} 11\alias{xmlValue<-,XMLTextNode-method} 12\alias{coerce,XMLInternalTextNode,character-method} 13\title{Extract or set the contents of a leaf XML node} 14\description{ 15 Some types of XML nodes have no children nodes, but are leaf nodes and 16 simply contain text. Examples are \code{XMLTextMode}, \code{XMLProcessingInstruction}. 17 This function provides access to their raw contents. 18 This has been extended to operate recursivel on arbitrary XML nodes 19 that contain a single text node. 20} 21\usage{ 22xmlValue(x, ignoreComments = FALSE, recursive = TRUE, 23 encoding = getEncoding(x), trim = FALSE) 24} 25\arguments{ 26 \item{x}{the \code{XMLNode} object whose 27 contents are to be returned.} 28 \item{ignoreComments}{a logical value which, if \code{TRUE} 29 does not include the text in XML comment nodes. 30 If this is \code{FALSE}, the text in the comments is part 31 of the return value. 32 } 33 \item{recursive}{a logical value indicating whether to process all 34 sub-nodes (\code{TRUE}) or only the text nodes within the node \code{x}. 35 } 36%XXX 37 \item{encoding}{experimental functionality and parameter related to 38 encoding.} 39 \item{trim}{a logical value controlling whether we remove leading or 40 trailing white space when returning the string value} 41} 42\value{ 43 The object stored in the 44 \code{value} slot of the \code{XMLNode} object. 45 This is typically a string. 46} 47\references{\url{http://www.w3.org/XML}, \url{http://www.jclark.com/xml}, 48\url{http://www.omegahat.net} } 49\author{ Duncan Temple Lang } 50 51\seealso{ 52 \code{\link{xmlChildren}} 53 \code{\link{xmlName}} 54 \code{\link{xmlAttrs}} 55 \code{\link{xmlNamespace}} 56} 57 58\examples{ 59 node <- xmlNode("foo", "Some text") 60 xmlValue(node) 61 62 xmlValue(xmlTextNode("some more raw text")) 63 64 # Setting the xmlValue(). 65 a = newXMLNode("a") 66 xmlValue(a) = "the text" 67 xmlValue(a) = "different text" 68 69 a = newXMLNode("x", "bob") 70 xmlValue(a) = "joe" 71 72 b = xmlNode("bob") 73 xmlValue(b) = "Foo" 74 xmlValue(b) = "again" 75 76 b = newXMLNode("bob", "some text") 77 xmlValue(b[[1]]) = "change" 78 b 79} 80\keyword{file} 81