Skip to main content

Generating XML

  • Chapter
  • First Online:
XML and Web Technologies for Data Sciences with R

Part of the book series: Use R! ((USE R))

  • 12k Accesses

Abstract

In this chapter, we explore approaches to creating XML content within R. The primary approach is to create nodes and trees that are identical in nature to those returned by the XML parser via the xmlParse() and htmlParse() functions. Rather than generating an entire document in one step, we use functions to build individual nodes, add child nodes and attributes, and set namespaces. We discuss different approaches to building these trees—from top down or bottom up, or a hybrid of both approaches. In some circumstances, where the subtree is large and the nodes have a very regular structure, we can create the XML content more speedily via vectorized string manipulation and then parsing the content into a subtree, thus combining a string-based approach with operating on nodes and trees.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Elliotte Rusty Harold andW. Scott Means. XML in a Nutshell. O’Reilly Media, Inc., Sebastopol, CA, 2004.

    Google Scholar 

  2. David Hunter, Jeff Rafter, Joe Fawcett, Eric van der Vlist, Danny Ayers, Jon Duckett, Andrew Watt, and Linda McKinnon. Beginning XML. Wiley Publishing, Inc., Indianapolis, IN, fourth edition, 2007.

    Google Scholar 

  3. Eric Lecoutre. R2HTML: HTML exportation for R objects. http://cran.r-project.org/package=R2HTML, 2011. R package version 2.2.

  4. Deborah Nolan and Duncan Temple Lang. RKML: Simple tools for creating KML displays from R. http://www.omegahat.org/RKML/, 2011. R package version 0.7.

  5. Duncan Temple Lang. XML: Tools for parsing and generating XML within R and S-PLUS. http://www.omegahat.org/RSXML, 2011. R package version 3.4.

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer Science+Business Media New York

About this chapter

Cite this chapter

Nolan, D., Lang, D.T. (2014). Generating XML . In: XML and Web Technologies for Data Sciences with R. Use R!. Springer, New York, NY. https://doi.org/10.1007/978-1-4614-7900-0_6

Download citation

Publish with us

Policies and ethics