https://github.com/cran/XML
Raw File
Tip revision: d0326028ad3f323de6f8d7a148ebf4ce90abc87b authored by Duncan Temple Lang on 07 May 2010, 00:00:00 UTC
version 3.1-0
Tip revision: d032602
xmlValue.Rd
\name{xmlValue}
\alias{xmlValue}
\alias{xmlValue.XMLCDataNode}
\alias{xmlValue.XMLNode}
\alias{xmlValue.XMLProcessingInstruction}
\alias{xmlValue.XMLTextNode}
\alias{xmlValue.XMLComment}
\alias{xmlValue<-}
\alias{xmlValue<-,XMLAbstractNode-method}
\alias{xmlValue<-,XMLInternalTextNode-method}
\alias{xmlValue<-,XMLTextNode-method}
\alias{coerce,XMLInternalTextNode,character-method}
\title{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 \code{XMLTextMode}, \code{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{
  \item{x}{the \code{XMLNode} object whose
    contents are to be  returned.}
  \item{ignoreComments}{a logical value which, if \code{TRUE}
    does not include the text in XML comment nodes.
    If this is \code{FALSE}, the text in the comments is part
    of the return value.
  }
  \item{recursive}{a logical value indicating whether to process all
    sub-nodes (\code{TRUE}) or only the text nodes within the node \code{x}.
  }
%XXX
 \item{encoding}{experimental functionality and parameter related to encoding.}
}
\value{
 The object stored in the 
 \code{value} slot of the \code{XMLNode} object.
 This is typically a string.
}
\references{\url{http://www.w3.org/XML}, \url{http://www.jclark.com/xml},
\url{http://www.omegahat.org}  }
\author{ Duncan Temple Lang }

\seealso{
 \code{\link{xmlChildren}}
 \code{\link{xmlName}}
 \code{\link{xmlAttrs}}
 \code{\link{xmlNamespace}}
}

\examples{
 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
}
\keyword{file}
back to top