In Chapter 3, Building Klips that Monitor XML Source, we covered Klipfolio Dashboard's CSS-based <style>, which lets you easily parse simple XML that has repeating blocks of data. However, some XML is very complex and the data you want to extract is nested inside other XML elements.
Klipfolio Dashboard can parse very complex XML. In Chapter 3, Building Klips that Monitor XML Source, we introduced CSS selectors to instruct Klipfolio Dashboard's XML parser how to handle them. The example was based on simple XML. Klipfolio Dashboard implements a subset of CSS Level 3 pattern matching rules, which enables you to specify exactly what data Klipfolio Dashboard's XML parser should extract, so you can instruct Klipfolio Dashboard's XML parser to pull data from very complex XML. In CSS lingo, this extraction involves matching specific elements based on their hierarchy and siblings.
![]() | Note |
|---|---|
To see the W3C specification we used to create CSS-based matching in Klipfolio Dashboard, check out the CSS selector specifications. | |
As always, the best way to learn how CSS selectors work is to try simple examples, by cutting and pasting our sample code into a file in your myklips folder.
![]() | Note |
|---|---|
If you are an XML guru you may be thinking "Why use CSS selectors and not XPATH?" We chose the CSS approach because, in addition to being familiar to a larger group of developers, Klipfolio Dashboard's XML parser needs to scan documents only once. By design, Klipfolio Dashboard does not create a DOM of the entire XML; rather, it parses on-the-fly. This lets you monitor very, very big XML files using a Klip. | |