catalogLoad(XML)
catalogLoad()所属R语言包:XML
Manipulate XML catalog contents
操作XML目录内容
译者:生物统计家园网 机器人LoveR
描述----------Description----------
These functions allow the R user to programmatically control the XML catalog table used in the XML parsing tools in the C-level libxml2 library and hence in R packages that use these, e.g. the XML and Sxslt packages. Catalogs are consulted whenever an external document needs to be loaded. XML catalogs allow one to influence how such a document is loaded by mapping document identifiers to alternative locations, for example to refer to locally available versions. They support mapping URI prefixes to local file directories/files, resolving both SYSTEM and PUBLIC identifiers used in DOCTYPE declarations at the top of an XML/HTML document, and delegating resolution to other catalog files. Catalogs are written using an XML format.
这些功能允许R用户以编程方式控制XML目录C-libxml2库,因此在R包,使用这些表中使用的XML解析工具,例如的XML和Sxslt的程序包。目录征询意见时需要加载外部文件。 XML目录允许这样一份文件是加载的文件标识符映射替代的位置,例如指本地版本的影响如何。他们支持映射到本地文件目录/文件的URI前缀,解决系统和公共标识符使用DOCTYPE声明的XML / HTML文档的顶部,并委派到其他目录文件的分辨率。使用XML格式编写的目录。
Catalogs allow resources used in XInclude nodes and XSL templates to refer to generic network URLs and have these be mapped to local files and so avoid potentially slow network retrieval. Catalog files are written in XML We might have a catalog file that contains the XML In the XDynDocs package, we refer to OmegahatXSL files and DocBook XSL files have a catalog file of the form
目录允许XInclude的节点和XSL模板中使用通用的网络网址,这些被映射到本地文件,从而避免潜在的缓慢的网络检索的资源。目录都写在XML文件,我们可能有一个目录的文件,其中包含的XML在XDynDocs包,我们指的OmegahatXSL文件和DocBook XSL文件有一个目录文件的形式
The functions provided here allow the R programmer to empty the current contents of the global catalog table and so start from scratch ( catalogClearTable ), load the contents of a catalog file into the global catalog table ( catalogLoad ), and to add individual entries programmatically without the need for a catalog table.
这里提供的功能允许的R程序员清空当前的全球目录表的内容,从头开始(catalogClearTable),目录文件的内容加载到全局编录表(catalogLoad)添加单个项目目录表,而不需要编程。
In addition to controlling the catalogs via these functions, we can use catalogResolve to use the catalog to resolve the name of a resource and map it to a local resource.
在除控制目录,通过这些功能,我们可以使用catalogResolve使用目录来解析该名称的资源,并把它映射到本地的资源。
catalogDump allows us to retrieve an XML document representing the current contents of the in-memory catalog .
catalogDump让我们能够获取一个XML文档来表示的当前内容在内存中的目录。
More information can be found at http://xmlsoft.org/catalog.html and http://www.sagehill.net/docbookxsl/Catalogs.html among many resources and the specification for the catalog format at http://www.oasis-open.org/committees/entity/spec-2001-08-06.html.
更多的信息可以发现,在http://xmlsoft.org/catalog.html和http://www.sagehill.net/docbookxsl/Catalogs.html在许多资源和规范的目录格式位于http://www。 oasis-open.org/committees/entity/spec-2001-08-06.html。
用法----------Usage----------
catalogLoad(fileNames)
catalogClearTable()
catalogAdd(orig, replace, type = "rewriteURI")
catalogDump(fileName = tempfile(), asText = TRUE)
参数----------Arguments----------
参数:orig
a character vector of identifiers, e.g. URIs, that are to be mapped to a different name via the catalog. This can be a named character vector where the names are the original URIs and the values are the corresponding rewritten values.
字符向量的标识符,例如URIs,它们是被映射到一个不同的名称,通过该目录。这可以是一个指定的字符向量,其中的名称是原始的URI和值相应的改写值。
参数:replace
a character vector of the rewritten or resolved values for the identifiers given in orig. Often this omitted and the original-rewrite pairs are given as a named vector via orig.
字符向量的改写或解决的在原价的标识符值。这通常省略,并且原始重写对作为命名原价矢量,通过给定的。
参数:type
a character vector with the same length as orig (or recycled to have the same length) which specifies the type of the resources in the elements of orig. Valid values are rewriteURI, rewriteSystem, system, public.
一个字符矢量作为原代(或再循环到具有相同的长度),它指定在原价的元素的资源的类型具有相同的长度。有效的的值是rewriteURI,rewriteSystem,系统,公共。
参数:fileNames
a character vector giving the names of the catalog files to load.
提供的目录的名称字符矢量文件加载。
参数:fileName
the name of the file in which to place the contents of the current catalog
要在其中放置当前目录的内容的文件的文件名
参数:asText
a logical value which indicates whether to write the catalog as a character string if filename is not specified.
一个逻辑值,该值指示是否写入filename如果未指定目录作为一个字符串。
值----------Value----------
These functions are used for their side effects on the global catalog table maintained in C by libxml2. Their return values are logical values/vectors indicating whether the particular operation were successful or not.
使用这些函数的全局编录表在C中的libxml2其副作用。它们的返回值是逻辑值/向量的具体操作是否成功或失败。
参考文献----------References----------
made available in libxml2.
参见----------See Also----------
catalogResolve
catalogResolve
XInclude, XSL and import/include directives.
XInclude的,XSL和进口的/ include指令。
In addition to these functions, there is an un-exported, undocumented function named catalogDump that can be used to get the contents of the (first) catalog table.
除了这些功能外,还有未出口的,未公开的函数命名catalogDump,可以被用来获取的内容(第一)目录表。
实例----------Examples----------
# Add a rewrite rule[添加重写规则]
# []
# []
catalogAdd(c("http://www.omegahat.org/XML" = system.file("XML", package = "XML")))
catalogAdd("http://www.omegahat.org/XML", system.file("XML", package = "XML"))
catalogAdd("http://www.r-project.org/doc/", paste(R.home(), "doc", "", sep = .Platform$file.sep))
# []
# This shows how we can load a catalog and then resolve a system identifier [这表明我们如何能够加载一个目录,然后解析系统标识符]
# that it maps.[它映射。]
# []
catalogLoad(system.file("exampleData", "catalog.xml", package = "XML"))
catalogResolve("docbook4.4.dtd", "system")
catalogResolve("-//OASIS//DTD DocBook XML V4.4//EN", "public")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|