Skip to content

inigo/scala-xom

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
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.

About

Implicit conversions to make using the XOM XML library easier from Scala, and to make using Saxon's XPath 2 support easier

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages