Skip to content

Commit

Permalink
unorthodox tag vignette example
Browse files Browse the repository at this point in the history
  • Loading branch information
robertzk committed Feb 20, 2015
1 parent d4ce34a commit 3bfd460
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions vignettes/rokogiri.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,17 @@ output <- rokogiri(output_type = 'list', {
names(output)
```

If you have unorthodox tags in your XML, you can take advantage of another quirk of R.
Any string surrounded in backticks or quotes can be used as a variable name.

```{r, eval = TRUE}
cat(rokogiri({
"what-if-we-need"({
"xml-tags"()
"like-this"(2)
})
}))
```

The above example also shows that we can leave the argument to the function blank if it is
an empty tag, and Rokogiri will produce the trailing slash.

0 comments on commit 3bfd460

Please sign in to comment.