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
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xml_structure.R
\name{xml_structure}
\alias{xml_structure}
\alias{html_structure}
\title{Show the structure of an html/xml document.}
\usage{
xml_structure(x, indent = 2, file = "")
html_structure(x, indent = 2, file = "")
}
\arguments{
\item{x}{HTML/XML document (or part there of)}
\item{indent}{Number of spaces to ident}
\item{file}{A \link[base]{connection}, or a character string naming the file
to print to. If \code{""} (the default), \code{cat} prints to the
standard output connection, the console unless redirected by
\code{\link[base]{sink}}.
If it is \code{"|cmd"}, the output is piped to the command given
by \file{cmd}, by opening a pipe connection.
}
}
\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 \code{xml_structure},
\code{html_structure} prints the id and class attributes.
}
\examples{
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)
}
|