xml_structure: Show the structure of an html/xml document.

Description Usage Arguments Examples

View source: R/xml_structure.R

Description

Show the structure of an html/xml document without displaying any of the values. This is useful if you want to get a high level view of the way a document is organised. Compared to xml_structure, html_structure prints the id and class attributes.

Usage

1
2
3
xml_structure(x, indent = 2)

html_structure(x, indent = 2)

Arguments

x

HTML/XML document (or part there of)

indent

Number of spaces to ident

Examples

1
2
3
4
5
6
7
8
xml_structure(read_xml("<a><b><c/><c/></b><d/></a>"))

rproj <- read_html(system.file("extdata","r-project.html", package = "xml2"))
xml_structure(rproj)
xml_structure(xml_find_all(rproj, ".//p"))

h <- read_html("<body><p id = 'a'></p><p class = 'c d'></p></body>")
html_structure(h)

xml2 documentation built on Jan. 24, 2018, 5:21 p.m.