Rev 8141 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{catalogResolve}\alias{catalogResolve}\title{Look up an element via the XML catalog mechanism}\description{XML parsers use a catalog to map generic system and public addressesto actual local files or potentially different remote files.We can use a catalog to map a reference such as\code{https://www.omegahat.net/XSL/} to a particulardirectory on our local machine and then not have tomodify any of the documents if we move the local files to anotherdirectory, e.g. install a new version in an alternate directory.This function provides a mechanism to query the catalog toresolve a URI, PUBLIC or SYSTEM identifier.This is now vectorized, so accepts a character vector ofURIs and recycles \code{type} to have the same length.If an entry is not resolved via the catalog system,a \code{NA} is returned for that element.To leave the value unaltered in this case, use \code{asIs = TRUE} .}\usage{catalogResolve(id, type = "uri", asIs = FALSE, debug = FALSE)}%- maybe also 'usage' for other objects documented here.\arguments{\item{id}{the name of the (generic) element to be resolved}\item{type}{a string, specifying whether the lookup is for a uri,system or public element}\item{asIs}{a logical. If \code{TRUE} any element of \code{id} whichis not resolved by the catalog system will be left as given in thecall. If \code{FALSE}, such unresolved elements are identifiedby \code{NA}.}\item{debug}{logical value indicating whether to turn on debuggingoutput written to the console (\code{TRUE}) or not (\code{FALSE}).}}\value{A character vector. If the element was resolved,the single element is the resolved value.Otherwise, the character vector will contain no elements.}\references{\url{http://www.xmlsoft.org}%% \url{http://www.sagehill.net/docbookxsl/Catalogs.html} provides a short, succinct tutorial on catalogs.}\author{Duncan Temple Lang}\seealso{\code{\link{xmlTreeParse}}}\examples{if(!exists("Sys.setenv")) Sys.setenv = Sys.putenvSys.setenv("XML_CATALOG_FILES" = system.file("exampleData", "catalog.xml", package = "XML"))catalogResolve("-//OASIS//DTD DocBook XML V4.4//EN", "public")catalogResolve("https://www.omegahat.net/XSL/foo.xsl")catalogResolve("https://www.omegahat.net/XSL/article.xsl", "uri")catalogResolve("https://www.omegahat.net/XSL/math.xsl", "uri")# This one does not resolve anything, returning an empty value.catalogResolve("http://www.oasis-open.org/docbook/xml/4.1.2/foo.xsl", "uri")# Vectorized and returns NA for the first and /tmp/html.xsl# for the second.catalogAdd("http://made.up.domain", "/tmp")catalogResolve(c("ddas", "http://made.up.domain/html.xsl"), asIs = TRUE)}\keyword{IO}\concept{XML}