Example scala project to demontrate scala’s built-in support for XML and its more concise syntax for dealing with iterables and collections. Read the full accompanying blog post
Assumes you have jdk, scala and sbt installed. Clone and run sbt test from the root directory below.
Main.scala - simple main method to load an asset xml, allocate the correct asset from the AssetFactory and print the xml representation for this asset.
The structure of this project:
Application directory (scala-xml-parsing-example.root)
- src
- main
- scala
- com
- cookybear
- content
- asset
- test
-resources
- xml
- scala
- com
- cookybear
- content
- asset
- util
Here's a brief rundown of each directory and its contents.
Contains domain classes implemented with toXML fromXML methods, equivalent of java POJO's.
Represents xml fixtures used in unit tests, snippets of xml.
Unit test classes implemented using scalatest and junit runner
Utility classes used by unit test, for example fixture loader