Learn R Programming

XML (version 3.1-1)

getLineNumber: Determine the line number of an (internal) XML node

Description

This function is used to query the location of an internal/C-level XML node within its original "file". This gives us the line number. It can be combined with docName to determine the name of the file and so identify the node location.

This is useful when we identify a node with a particular charactestic and want to view/edit the original document, e.g. when authoring an Docbook article.

Usage

getLineNumber(node, ...)

Arguments

Value

  • An integer.

concept

XML

References

libxml2

See Also

xmlParse getNodeSet xpathApply

Examples

Run this code
f = system.file("exampleData", "xysize.svg", package = "XML")
doc = xmlParse(f)
e = getNodeSet(doc, "//ellipse")
sapply(e, getLineNumber)

Run the code above in your browser using DataLab