1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
\name{dtdValidElement}
\alias{dtdValidElement}
\title{Determines whether an XML tag is valid within another.}
\description{
This tests whether \code{name} is a legitimate tag
to use as a direct sub-element of the \code{within} tag
according to the definition of the \code{within}
element in the specified DTD.
}
\usage{
dtdValidElement(name, within, dtd, pos=NULL)
}
\arguments{
\item{name}{The name of the tag which is to be inserted inside the
\code{within} tag.}
\item{within}{The name of the parent tag the definition of which we are checking
to determine if it contains \code{name}.}
\item{dtd}{The DTD in which the elements \code{name} and \code{within} are defined. }
\item{pos}{ An optional position at which we might add the
\code{name} element inside \code{within}. If this is specified, we have a stricter
test that accounds for sequences in which elements must appear in order.
These are comma-separated entries in the element definition.}
}
\details{
This applies to direct sub-elements
or children of the \code{within} tag and not tags nested
within children of that tag, i.e. descendants.
}
\value{
Returns a logical value.
TRUE indicates that a \code{name} element
can be used inside a \code{within} element.
FALSE indicates that it cannot.
}
\references{\url{https://www.w3.org/XML/}, \url{http://www.jclark.com/xml/},
\url{https://www.omegahat.net} }
\author{ Duncan Temple Lang }
\seealso{
\code{\link{parseDTD}},
\code{\link{dtdElement}},
\code{\link{dtdElementValidEntry}},
}
\examples{
dtdFile <- system.file("exampleData", "foo.dtd", package="XML")
foo.dtd <- parseDTD(dtdFile)
# The following are true.
dtdValidElement("variable","variables", dtd = foo.dtd)
dtdValidElement("record","dataset", dtd = foo.dtd)
# This is false.
dtdValidElement("variable","dataset", dtd = foo.dtd)
}
\keyword{file}
|