Skip to content

Instantly share code, notes, and snippets.

@jennybc
Created May 26, 2016 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jennybc/d0f27bdce2a2e54a8a1f6d2e2dd07590 to your computer and use it in GitHub Desktop.
Save jennybc/d0f27bdce2a2e54a8a1f6d2e2dd07590 to your computer and use it in GitHub Desktop.
xml printing to screen
> session_info("xml2")$packages
package * version date source
BH 1.60.0-2 2016-05-07 CRAN (R 3.2.5)
Rcpp 0.12.5 2016-05-14 cran (@0.12.5)
xml2 0.1.2.9000 2016-05-26 Github (jimhester/xml2@88150bc)
> library(xml2)
> x <- read_xml('
+ <catalog xmlns="http://www.edankert.com/examples/">
+ <cd>
+ <artist>Sufjan Stevens</artist>
+ <title>Illinois</title>
+ <src>http://www.sufjan.com/</src>
+ </cd>
+ <cd>
+ <artist>Stoat</artist>
+ <title>Future come and get me</title>
+ <src>http://www.stoatmusic.com/</src>
+ </cd>
+ <cd>
+ <artist>The White Stripes</artist>
+ <title>Get behind me satan</title>
+ <src>http://www.whitestripes.com/</src>
+ </cd>
+ </catalog>')
ELEMENT catalog
default namespace href=http://www.edankert.com/examples/
ELEMENT cd
ELEMENT artist
TEXT
content=Sufjan Stevens
ELEMENT title
TEXT
content=Illinois
ELEMENT src
TEXT
content=http://www.sufjan.com/
ELEMENT cd
ELEMENT artist
TEXT
content=Stoat
ELEMENT title
TEXT
content=Future come and get me
ELEMENT src
TEXT
content=http://www.stoatmusic.com/
ELEMENT cd
ELEMENT artist
TEXT
content=The White Stripes
ELEMENT title
TEXT
content=Get behind me satan
ELEMENT src
TEXT
content=http://www.whitestripes.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment