O'Reilly logo

Professional F# 2.0 by Richard Minerich, Talbott Crowell, Aaron C. Erickson, Ted Neward

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 20. XML

WHAT'S IN THIS CHAPTER?

  • Making F# work with XML

  • Using Linq to XML with F#

  • Understanding how F# and DOM work together

  • Applying active patterns for XML parsing

XML is a fact of life for most software developers, regardless of language. It is found everywhere, from configuration files holding nothing but a small number of settings, to the giant stores of weather data provided in XML format by the National Oceanic and Atmospheric Administration of the United States. Although history will judge whether having all this XML was a good idea, the fact remains that it's there. Love it or hate it, developers have to deal with it.

In this chapter, you learn how to use F# with XML processing tools such as those found in the System.Xml namespace in the .NET framework. This chapter covers techniques that simplify most XML processing tasks. Special attention is provided to demonstrate how you can use things such as XPath and active patterns to simplify the task of processing and transforming XML.

OVERVIEW

Boiled down to its essence, most things that deal with XML do the following:

  • Read XML, typically to store it in some sort of language representation

  • Query the XML, often again to extract parts of it into some sort of language representation

  • Process the XML, sometimes to produce more XML or to generate some side effect

  • Persist the XML, so that other programs can join in the fun of working with XML

For more details on the various W3C standards that make up the XML grammar and suite of specifications, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required