\name{xmlParamVal} \alias{xmlParamVal} \alias{xmlParamName} \title{Translates Parameter Name string to XML} \description{ The function \code{xmlParamName} converts a parameter name string into a \code{}, \code{} or \code{} XMLNode depending on the \code{pname} argument. The function \code{xmlParamVal} produces a a \code{}, \code{} or \code{} XMLNode depending on the \code{pname} argument. } \usage{ xmlParamVal(pname, pval) xmlParamName(pname) } \arguments{ \item{pname}{Name of the parameter, see details section.} \item{pval}{Value of the parameter} } \details{ Parameter names can in one of three forms: (a) \emph{name} --- A scaler parameter called \emph{name}. (b) \emph{name}(\emph{var}) --- A variable parameter called \emph{name} for variable \emph{var}. (c) \emph{name}(\emph{var},\emph{state}) --- A state parameter called \emph{name} for state \emph{state} of variable \emph{var}. The three have different XML representations. } \value{ An object of type \code{XMLNode}. } \references{ \url{http://research.ets.org/~ralmond/StatShop/dataFormats.html} } \author{Russell Almond} \seealso{ \code{\link[XML]{XMLNode}}, \code{\link{xmlDistribution}}, \code{\link{xmlParameterSet}} } \examples{ pnnode <- xmlParamName("Task Difficulty") vpnnode <- xmlParamName("Relative Importance(Reading)") spnnode <- xmlParamName("Level Difficulty Increment(Outcome_R,Good)") pvnode <- xmlParamVal("Task Difficulty",1.0) vpvnode <- xmlParamVal("Relative Importance(Reading)",0.0) spvnode <- xmlParamVal("Level Difficulty Increment(Outcome_R,Good)",0.5) ## Expected values. pn1 <- "Task Difficulty" vpn1 <- "Relative Importance" spn1 <- "Level Difficulty Increment" pv1 <- "1" vpv1 <- "0" spv1 <- "0.5" \dontshow{ pn1n <- xmlRoot(xmlTreeParse(pn1)) vpn1n <- xmlRoot(xmlTreeParse(vpn1)) spn1n <- xmlRoot(xmlTreeParse(spn1)) pv1n <- xmlRoot(xmlTreeParse(pv1)) vpv1n <- xmlRoot(xmlTreeParse(vpv1)) spv1n <- xmlRoot(xmlTreeParse(spv1)) allexp <- list(pn1n,vpn1n,spn1n,pv1n,vpv1n,spv1n) allact <- list(pnnode,vpnnode,spnnode,pvnode,vpvnode,spvnode) stopifnot( identical(sapply(allexp,xmlName),sapply(allact,xmlName)), identical(sapply(allexp,xmlValue),sapply(allact,xmlValue)), identical(sapply(allexp,function(x) xmlGetAttr(x,"varName")), sapply(allact,function(x) xmlGetAttr(x,"varName"))), identical(sapply(allexp,function(x) xmlGetAttr(x,"state")), sapply(allact,function(x) xmlGetAttr(x,"state"))), identical(sapply(allexp,function(x) xmlGetAttr(x,"parameterName")), sapply(allact,function(x) xmlGetAttr(x,"parameterName"))) ) } } \keyword{interface}