Implicit conversions to make using the XOM XML library easier from Scala, and to make using Saxon's XPath 2 support easier
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Scala implicits to make using the XOM XML library easier in Scala, and
to make using Saxon's XPath 2 support easier.


    import net.surguy.xom.Implicits._
    import scala.xml._

    // Create Scala XML objects as normal
    val scalaXml = <root>Some text about <b>XML</b> and <b>other things</b></root>

    // Convert them to XOM
    val xomXml = scalaXml.toXom
    // Use XPath 2 from Saxon against them
    val foundNodes = xomXml.selectNodes("//b[matches(.,'X.*')]") 

    // Use Scala iterators with XOM
    xomXml.elements.foreach( _.addAttribute(new nu.xom.Attribute("new","value")) )

    // Convert XOM to Scala

Note that the conversion from Scala XML to XOM, and from XOM to Saxon's OM, is
not hugely inefficient but any process that converts XML between formats multiple
times is not going to be particularly performant.

Build and dependencies

This library depends on XOM and on Saxon-B. It should also be compatible with 
Saxon-SA.  It is not compatible with the latest version of Saxon, Saxon-HE, 
which has removed support for models like XOM. 

This library can be built with Maven or with SBT. 


This code is under the Apache software license, version 2. See for the full license.

This code uses the XOM XML library from Elliotte Rusty Harold, available at, and licensed under the LGPL.

It also uses the SAXON XSLT Processor from Michael Kay, available at, licensed under the MPL 1.0.