Lately I have been thinking about writing a functional programming book, and if I decide to do that, I might include a variation of this Ward Cunningham example of how to parse HTML table tags recursively. His code is written in Java, and you can read about it here.
I’ve used HtmlCleaner many times before to read/parse HTML content, but jsoup worked well today as a way to modify HTML content using Scala.
Last week I wrote an Apache access log parser library in Scala to help me analyze my Apache HTTP access log file records using Apache Spark. The source code for that project is hosted here on Github. You can use this library to parse Apache access log “combined” records using Scala, Java, and other JVM-based programming languages.
I don't get to parse too much JSON code with Java because the biggest JSON source I work with is Twitter, and I always use the Twitter4J project to interact with their web services. But a few days ago while working on an Android project, I just wanted to access their "Twitter Trends" REST service, and I used Java and the json.org Java library that comes with Android to parse the Twitter Trends JSON feed like this:
While XML parsers work great for well-formed XML, out in the 'real world' internet, you can't count on HTML being XHTML, or even being well-formatted. As a result, various 'HTML cleaner' libraries for Java have appeared. They attempt to clean up the HTML so you can parse it.
Summary: A Scala YAML parsing example using the Snakeyaml parser.
If you need some Scala YAML parsing examples using Snakeyaml parser, you've come to the right place. I just worked through some Snakeyaml issues related to Scala, in particular converting YAML to JavaBean classes written in Scala, so I thought I'd share the source code here.
I just worked through some Scala Lift-JSON issues, and thought I'd share some source code here.
In particular, I'm trying to parse a JSON document into Scala objects, and I'm using Lift-JSON to do so. One of the things I'm doing here is to parse some of the JSON text into an array of objects, in this case an array of String objects.
First, here's the Scala source code for my example, and then a description will follow:
Scala JSON FAQ: How can I parse JSON text or a JSON document with Scala?
As I continue to plug away on my computer voice control application (SARAH), last night I started working with JSON, specifically the Lift-JSON library (part of the Lift Framework), which seems to be the preferred JSON library of the Scala community.