xmlStructuredStop(XML)
xmlStructuredStop()所属R语言包:XML
Condition/error handler functions for XML parsing
条件/ XML解析错误处理函数
译者:生物统计家园网 机器人LoveR
描述----------Description----------
These functions provide basic error handling for the XML parser in R. They also illustrate the basics which will allow others to provide customized error handlers that make more use of the information provided in each error reported.
这些功能提供了基本的错误处理的XML解析器,R.,他们也说明了基础,这将允许他人提供自定义的错误处理程序,使更多的使用在每个错误报道提供的信息。
The xmlStructuredStop function provides a simple R-level handler for errors raised by the XML parser. It collects the information provided by the XML parser and raises an R error. This is only used if NULL is specified for the error argument of xmlTreeParse, xmlTreeParse and htmlTreeParse.
xmlStructuredStop功能的XML解析器所引发的错误处理程序提供了一个简单的R-级。提供的XML解析器,它收集的信息,并提出了一个R错误。这是仅用于NULL指定为error参数xmlTreeParse,xmlTreeParse和htmlTreeParse。
The default is to use the function returned by a call to xmlErrorCumulator as the error handler. This, as the name suggests, cumulates errors. The idea is to catch each error and let the parser continue and then report them all. As each error is encountered, it is collected by the function. If immediate is TRUE, the error is also reported on the console. When the parsing is complete and has failed, this function is invoked again with a zero-length character vector as the message (first argument) and then it raises an error. This function will then raise an R condition of class class.
默认情况下是使用通过调用xmlErrorCumulator的错误处理程序返回的功能。这一点,顾名思义,累积的错误。这样做是为了捕捉每一个错误,让解析器继续,然后报告他们所有。由于每个遇到错误时,它收集由该函数。 immediate如果是TRUE,错误也被报告在控制台上。当分析完成和失败,再次调用这个函数消息(第一个参数)的长度为零的特征向量,然后它提出了一个错误。此功能将提高一个R类class条件。
用法----------Usage----------
xmlStructuredStop(msg, code, domain, line, col, level, filename,
class = "XMLError")
xmlErrorCumulator(class = "XMLParserErrorList", immediate = TRUE)
参数----------Arguments----------
参数:msg
character string, the text of the message being reported
字符串,文本的消息被报道
参数:code
an integer code giving an identifier for the error (see xmlerror.h) for the moment,
给予一个标识符暂时的错误(见xmlerror.h)的整数代码,
参数:domain
an integer domain indicating in which "module" or part of the parsing the error occurred, e.g. name space, parser, tree, xinclude, etc.
一个整数域表示中,“模块”或解析的一部分发生错误,如名称空间,分析器,树,XInclude的,等等。
参数:line
an integer giving the line number in the XML content being processed corresponding to the error,
一个整数,给出相应的错误正在处理的XML内容中的行号,
参数:col
an integer giving the column position of the error,
一个整数,给出错误的列位置,
参数:level
an integer giving the severity of the error ranging from 1 to 3 in increasing severity (warning, error, fatal),
一个整数,给出的范围从1到3的错误严重程度增加的严重程度(警告,错误,致命的),
参数:filename
character string, the name of the document being processed, i.e. its file name or URL.
字符串,正在处理的文档的名称,即它的文件名或URL。
参数:class
character vector, any classes to prepend to the class attribute to make the error/condition. These are prepended to those returned via simpleError.
特征向量,任何类,预先准备的阶级属性,使错误/状态。这些已预先通过simpleError返回。
参数:immediate
logical value, if TRUE errors are displayed on the R console as they are encountered. Otherwise, the errors are collected and displayed at the end of the XML parsing.
逻辑值,如果TRUE的R控制台上显示错误,因为它们遇到。否则,错误被收集和显示结束时的XML解析。
值----------Value----------
This calls stop and so does not return a value.
这就要求stop,所以不返回一个值。
(作者)----------Author(s)----------
Duncan Temple Lang
参考文献----------References----------
<h3>See Also</h3> <code>xmlTreeParse</code> <code>xmlInternalTreeParse</code> <code>htmlTreeParse</code>
实例----------Examples----------
tryCatch( xmlTreeParse("<a><b></a>", asText = TRUE, error = NULL),
XMLError = function(e) {
cat("There was an error in the XML at line",
e$line, "column", e$col, "\n",
e$message, "\n")
})
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|