\name{parseVar} \alias{parseVar} \alias{xmlDiscreteVariable} \alias{xmlReportingVar} \alias{xmlObservable} \title{Translates varDescription objects to/from StatShop XML} \usage{ parseVar(xNode) xmlDiscreteVariable(var) xmlReportingVar(var) xmlObservable(obs) } \arguments{ \item{xNode}{\code{XMLNode} corresponding to a \code{} element.} \item{var}{A \code{varDescription} object to be output.} \item{obs}{A \code{varDescription} object to be output.} } \description{ The function \code{parseVar} decodes an \code{} XMLNode and produces a \code{varDescription} object. The function \code{xmlDiscreteVariable} does the opposite. The function \code{xmlReportingVar} creates a reference to the reporting variable for use in student models. The function \code{xmlObservable} creates the reference for evidence/link models. } \value{ A \code{varDescription} or \code{XMLNode} object containing the same information as the argument. } \details{ The \code{parseVar} and \code{xmlVarDescription} functions are for use in reading/constructing GM files. The others are for use with AMD files. The function \code{xmlObservable} actually writes out one of three elements according to the following rules: \itemize{ \item{}{If the \code{isOrdered} field has the value \code{TRUE}, then the tag used is \code{}.} \item{}{If the \code{isOrdered} field has the value \code{FALSE}, and the variable has exactly two states then the tag used is \code{}.} \item{}{Otherwise, the tag used is \code{}.} } } \section{Under Construction}{ Currently the true state information is ignored. On output it is assumed that all but the last state in the list is \dQuote{true}. } \references{ \url{http://research.ets.org/~ralmond/StatShop/dataFormats.html} } \seealso{ \code{\link[XML]{XMLNode}}, \code{\link{varDescription}}, \code{\link{getEMParametersForAMD}},\code{\link{getLMParametersForAMD}} \code{\link{amdToPD}}, \code{\link{xmlStudentModel}}, \code{\link{xmlEvidenceModelSet}} } \examples{ skill1 <- varDescription("Skill1","Skill 1", "SM", c("High","Medium","Low"),TRUE) sk1node <- xmlDiscreteVariable(skill1) sk1vd <- parseVar(sk1node) \dontshow{ stopifnot(identical(skill1,sk1vd)) } sk1rv <- xmlReportingVar(skill1) \dontshow{ stopifnot(identical(sk1rv[["name"]],sk1node[["externalName"]]), identical(sk1rv[["varName"]],sk1node[["nodeName"]]), identical(xmlName(sk1rv),"ReportingVar")) } oo1 <- varDescription("Grade","Grade", "Observable", c("A","B","C","D","E"),TRUE) oonode <- xmlObservable(oo1) lo1 <- varDescription("isCorrect","is Correct", "Observable", c("Correct","Incorrect"),FALSE) lonode <- xmlObservable(lo1) uo1 <- varDescription("Approach","Approach", "Observable", c("MethodA","MethodB","Other"),FALSE) uonode <- xmlObservable(uo1) \dontshow{ stopifnot( identical(xmlName(oonode),"OrderedObservable"), identical(xmlName(lonode),"LogicalObservable"), identical(xmlName(uonode),"UnorderedObservable"), all(sapply(xmlElementsByTagName(oonode,"State"),xmlValue) == oo1$levels), all(sapply(xmlElementsByTagName(lonode,"State"),xmlValue) == lo1$levels), all(sapply(xmlElementsByTagName(uonode,"State"),xmlValue) == uo1$levels) ) } } \keyword{interface}