block by timelyportfolio 5fdffcc9b90b007c41e7

quick example of xml_tree_view in xmlview htlmwidget

Full Screen

Built with blockbuilder.org

Julian Gruber made a nice simple collapsible XML viewer xml-viewer. I thought it would fit nicely in @hrbrmstr’s new htmlwidget xmlview. Here is how it looks in its first iteration.

# need newest htmlwidgets
#devtools::install_github("ramnathv/htmlwidgets")
#devtools::install_github("hrbrmstr/xmlview")

library(xmlview)

# 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)
  )
)

index.html

xmltreeview.js