File: xmlSearchNs.Rd

package info (click to toggle)
r-cran-xml 3.99-0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,688 kB
  • sloc: ansic: 6,659; xml: 2,890; asm: 486; sh: 12; makefile: 2
file content (45 lines) | stat: -rw-r--r-- 1,329 bytes parent folder | download | duplicates (7)
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
\name{xmlSearchNs}
\alias{xmlSearchNs}
\alias{coerce,XMLNamespaceRef,character-method}
\title{Find a namespace definition object by searching ancestor nodes}
\description{
  This function allows one to search an XML tree from a particular node
  and find the namespace definition for a given namespace prefix or URL.
  This namespace definition can then be used to set it on a node to
  make it the effective namespace for that node.
}
\usage{
xmlSearchNs(node, ns, asPrefix = TRUE, doc = as(node, "XMLInternalDocument"))
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{node}{an \code{XMLInternaElementNode}}
  \item{ns}{a character string (vector of length 1).
    If \code{asPrefix} is \code{TRUE}, this is the namespace
    alias/prefix.
   If \code{asPrefix} is \code{FALSE}, this is the URL of the namespace definition}
  \item{asPrefix}{a logical value. See \code{ns}.}
  \item{doc}{the XML document in which the node(s) are located}
}
\value{
 An object of class XMLNamespaceRef.
}
\references{
  libxml2
}
\author{
Duncan Temple Lang
}
\seealso{
 \code{\link{newXMLNode}}
}
\examples{
 txt = '<top xmlns:r="http://www.r-project.org"><section><bottom/></section></top>'

 doc = xmlParse(txt)
 bottom = xmlRoot(doc)[[1]][[1]]
 xmlSearchNs(bottom, "r")
}
\keyword{programming}
\keyword{data}