Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Scala implicits to make using the XOM XML library easier in Scala, and
to make using Saxon's XPath 2 support easier.
Usage
-----
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
xomXml.toScalaXml
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.
Licensing
---------
This code is under the Apache software license, version 2. See
http://www.apache.org/licenses/LICENSE-2.0 for the full license.
This code uses the XOM XML library from Elliotte Rusty Harold, available at
http://www.xom.nu/, and licensed under the LGPL.
It also uses the SAXON XSLT Processor from Michael Kay, available at
http://saxon.sourceforge.net/, licensed under the MPL 1.0.