xml_tree_view: HTML/XML tree viewer

Description Usage Arguments Note References Examples

Description

This uses the xml-viewer JavaScript module to provide a simple collapsible tree viewer for HTML/XML documents, nodes, node sets and plain character HTML/XML in an htmlwidget pane.

Usage

1
2
3
4
5
xml_tree_view(doc = NULL, scroll = FALSE, elementId = NULL,
  width = "100%", height = NULL)

html_tree_view(doc = NULL, scroll = FALSE, elementId = NULL,
  width = "100%", height = NULL)

Arguments

doc

xml2 document/node/nodeset, an HTMLInternalDocument/ XMLInternalDocument or atomic character vector of HTML/XML content

scroll

should the <div> holding the HTML/XML content scroll (TRUE) or take up the full viewer/browser window (FALSE). Default is FALSE (take up the full viewer/browser window). If this is set to TRUE, height should be set to a value other than NULL.

elementId

element id

width

widget div width

height

widget div height

Note

Large HTML or XML content may take some time to render properly. It is suggested that this function be used on as minimal of a subset of HTML/XML as possible or used in a browser context vs an IDE viewer context.

References

xml-viewer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
if (interactive()) {

# from ?xml2::read_xml
cd <- xml2::read_xml("http://www.xmlfiles.com/examples/cd_catalog.xml")

xml_tree_view(cd)

htmltools::browsable(
  htmltools::tagList(
    xml_tree_view(cd, width = "100%", height = "300px"),
    xml_view(cd)
  )
)
}


Search within the htmltidy package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.