Description Usage Arguments References Examples
This uses vkbeautify
and highlight.js
to format and
"pretty print" HTML/XML documents, nodes, node sets and plain character
HTML/XML in an htmlwidget
pane.
1 2 |
doc |
|
style |
CSS stylesheet to use (see |
scroll |
should the |
add_filter |
show an XPath input box to enable live filtering?
(default: |
apply_xpath |
Add and apply an XPath query string to the view. If
|
elementId |
element id |
width |
widget width (best to keep it at 100%) |
height |
widget height (kinda only useful for knitting since this is meant to be an interactive tool). |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | library(xml2)
# plain text
txt <- paste0("<note><to>Tove</to><from>Jani</from><heading>Reminder</heading>",
"<body>Don't forget me this weekend!</body></note>")
xml_view(txt)
# xml object
doc <- read_xml(txt)
xml_view(doc, style="obsidian")
# different style
xml_view(xml_find_all(doc, ".//to"), style="github-gist")
# some more complex daata
xml_view(read_xml(system.file("extdata/dwml.xml", package="xmlview")))
xml_view(read_xml(system.file("extdata/getHistory.xml", package="xmlview")),
"androidstudio")
xml_view(read_xml(system.file("extdata/input.xml", package="xmlview")),
"sunburst")
# filter + apply an initial XPath query string
xml_view(read_xml(system.file("extdata/dwml.xml", package="xmlview")),
add_filter=TRUE, apply_xpath=".//temperature")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.