xmlNode(XML)
xmlNode()所属R语言包:XML
Create an XML node
创建一个XML节点
译者:生物统计家园网 机器人LoveR
描述----------Description----------
These functions allow one to create XML nodes as are created in C code when reading XML documents. Trees of XML nodes can be constructed and integrated with other trees generated manually or with via the parser.
这些功能允许创建XML节点时读取XML文件在C代码中创建。手动或通过解析器与其他树木,树的XML节点可以构造和集成。
用法----------Usage----------
xmlNode(name, ..., attrs=NULL, namespace="", namespaceDefinitions = NULL, .children = list(...))
xmlTextNode(value, namespace="", entities = XMLEntities, cdata = FALSE)
xmlPINode(sys, value, namespace="")
xmlCDataNode(...)
xmlCommentNode(text)
参数----------Arguments----------
参数:name
The tag or element name of the XML node. This is what appears in the elements as <name> .. </name>
标签或元素名称的XML节点。这是出现在元素<name> .. </name>
参数:...
The children nodes of this XML node. These can be objects of class XMLNode or arbitrary values that will be converted to a string to form an XMLTextNode object.
这个XML节点的子节点。这些都可以成为对象的类XMLNode或任意值将被转换为一个字符串,形成XMLTextNode对象。
参数:.children
an alternative mechanism to specifying the children which is useful for programmatic use when one has the children in an existing list. The ... mechanism is for use when the children are specified directly and individually.
一种替代机制,指定的儿童,这是非常有用的程序中使用时,有孩子在一个现有的列表上。该...当孩子们直接指定单独的机制是使用。
参数:attrs
A named character vector giving the name, value pairs of attributes for this XML node.
指定的字符向量,给出名字,这个XML节点的属性值对。
参数:value
This is the text that is to be used when forming an XMLTextNode.
这是形成XMLTextNode时要使用的文本是。
参数:cdata
a logical value which controls whether the text being used for the child node is to be first enclosed within a CDATA node to escape special characters such as > and &.
一逻辑值,它控制正在使用的子节点的文本是否是第一次封闭在一个CDATA节点转义特殊字符,如>和&。
参数:namespace
The XML namespace identifier for this node.
这个节点的XML命名空间标识符。
参数:namespaceDefinitions
a collection of name space definitions, containing the prefixes and the corresponding URIs. This is most conveniently specified as a character vector whose names attribute is the vector of prefixes and whose values are the URIs. Alternatively, one can provide a list of name space definition objects such as those returned
名称空间定义的集合的,包含的前缀和相应的URI。这是最方便的指定字符向量,其名称属性是矢量的前缀和其值的URI。或者,用户可以提供一个名称空间中定义的对象,如那些返回列表
参数:sys
the name of the system for which the processing instruction is targeted. This is the value that appears in the <?sys value?>
的目标的处理指令所针对的系统的名称。这是值出现在<?sys value?>
参数:text
character string giving the contents of the comment.
字符串给注释的内容。
参数:entities
a character vector giving the mapping from special characters to their entity equivalent. This provides the character-expanded entity pairings of 'character = entity' , e.g. '<' = "lt" which are used to make the content valid XML so that it can be used within a text node. The text searched sequentially for instances of each character in the names and each instance is replaced with the corresponding '&entity;'
特殊字符的字符向量的映射到它们的实体相当于。这提供了扩展字符实体配对的“性格”,例如=实体<=“<”,这是用来使内容,以便它可以使用一个文本节点内的有效的XML。的文字顺序搜索名称中的每个字符的实例,每个实例都被替换为相应的“&entity;”
值----------Value----------
An object of class XMLNode. In the case of xmlTextNode, this also inherits from XMLTextNode. The fields or slots that objects of these classes have include name, attributes, children and namespace. However, one should the accessor functions xmlName, xmlAttrs, xmlChildren and xmlNamespace
对象的类XMLNode。在的情况下,xmlTextNode,这也是继承自XMLTextNode。的字段或槽,这些类的对象包括name,attributes,children和namespace。但是,一个人的访问函数xmlName,xmlAttrs,xmlChildren和xmlNamespace
(作者)----------Author(s)----------
Duncan Temple Lang
参考文献----------References----------
参见----------See Also----------
addChildren xmlTreeParse asXMLNode newXMLNode newXMLPINode newXMLCDataNode newXMLCommentNode
addChildrenxmlTreeParseasXMLNodenewXMLNodenewXMLPINodenewXMLCDataNodenewXMLCommentNode
实例----------Examples----------
# node named arg with two children: name and defaultValue[节点名为arg的名称和默认值有两个孩子:]
# Both of these have a text node as their child.[这些都作为他们的孩子有一个文本节点。]
n <- xmlNode("arg", attrs = c(default="TRUE"),
xmlNode("name", "foo"), xmlNode("defaultValue","1:10"))
# internal C-level node.[内部C-级节点。]
a = newXMLNode("arg", attrs = c(default = "TRUE"),
newXMLNode("name", "foo"),
newXMLNode("defaultValue", "1:10"))
xmlAttrs(a) = c(a = 1, b = "a string")
xmlAttrs(a) = c(a = 1, b = "a string", append = FALSE)
newXMLNamespace(a, c("r" = "http://www.r-project.org"))
xmlAttrs(a) = c("r:class" = "character")
xmlAttrs(a[[1]]) = c("r:class" = "character")
# Using a character vector as a namespace definitions[使用一个命名空间中定义的字符向量]
x = xmlNode("bob",
namespaceDefinitions = c(r = "http://www.r-project.org",
omg = "http://www.omegahat.org"))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|