https://github.com/cran/XML
Raw File
Tip revision: 6528a2cbc49cedadece8b9f24931e0b8427009ee authored by Duncan Temple Lang on 27 November 2000, 00:00:00 UTC
version 0.6-2
Tip revision: 6528a2c
xmlAttributeType.Rd
\name{xmlAttributeType}
\alias{xmlAttributeType}
\title{The type of an XML attribute for element from the DTD}
\description{
This examines the definition of the 
attribute, usually returned by parsing the DTD with
\code{\link{parseDTD}} and determines 
its type from the possible values:
Fixed, string data, implied, 
required,  an identifier, 
an identifier reference, a list of identifier references,
an entity, a list of entities, 
a name, a list of names, an element of enumerated set, 
a notation entity.
}
\usage{
xmlAttributeType(def, defaultType=F)
}
\arguments{
  \item{def}{the attribute definition object, usually retrieved from
the DTD via \code{\link{parseDTD}}.}
  \item{defaultType}{whether to return the default value
if this attribute is defined as being a value from an enumerated set.}
}
\value{
  A string identifying the type for the sspecified attributed.
}
\references{\url{http://www.w3.org/XML}, \url{http://www.omegahat.org/RSXML}}
\author{Duncan Temple Lang}

\seealso{
\code{\link{parseDTD}}
}

\examples{
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	     or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (def, defaultType = F) 
{
    if (defaultType == F & names(def$type)[1] == "Enumeration") {
        return(paste("(", paste(def$defaultValue, collapse = " | "), 
            ")", sep = " ", collapse = ""))
    }
    switch(ifelse(defaultType, names(def$defaultType)[1], names(def$type)[1]), 
        Fixed = "#FIXED", CDATA = "CDATA", Implied = "#IMPLIED", 
        Required = "#REQUIRED", Id = "#ID", IDRef = "#IDREF", 
        IDRefs = "#IDREFS", Entity = "#ENTITY", Entities = "ENTITIES", 
        NMToken = "#NMTOKEN", NMTokens = "#NMTOKENS", Enumeration = "", 
        Notation = "", "<BROKEN>")
  }
}
\keyword{file}

back to top