change read_xml to read_html + 2 xml_child
diff --git a/R/util.R b/R/util.R
index 9d4146e..40dab5e 100644
--- a/R/util.R
+++ b/R/util.R
@@ -74,8 +74,13 @@
 as_kable_xml <- function(x) {
   tmp <- tempfile(fileext = ".xml")
   write_xml(x, tmp, options = "no_declaration")
-  out <- readLines(tmp)
-  out <- paste(out, collapse = "\n ")
+  out <- readLines(tmp, warn = FALSE)
+  out <- paste(out, collapse = "\n")
   out <- structure(out, format = "html", class = "knitr_kable")
   return(out)
 }
+
+read_kable_as_xml <- function(x) {
+  kable_html <- read_html(as.character(x))
+  xml_child(xml_child(kable_html, 1), 1)
+}