ScalesXml 0.3-RC6
This is a feature release, adding a the full set of useful XPath Axe, string based XPath evaluation - via a popular open source XPath library, useful equality testing, a lot of new documentation and many smaller improvements in syntax and usability.
This version has been built with xsbt 0.11.x and migrated to github. This releases documentation can be found here and provides many examples on how to use Scales Xml.
All the Axe you'll ever need
Scales 0.3 adds the following axe:
- preceding-sibling (preceding_sibling_::)
- following-sibling (following_sibling_::)
- descendant (descendant_::)
- following (following_::)
- preceding (preceding_::)
- ancestor (ancestor_::)
- ancestor-or-self (ancestor_or_self_::)
- descendant-or-self (descendant_or_self_::)
This provides all of the XPath 1 and 2 axe (namespace axis excluded).
Enhanced internal XPath queries
position() (pos)
pos\_<, pos\_==, pos\_>
last() (last)
last\_<, last\_==, last\_>
- position() == last() (pos_eq_last)
Easier to extend and re-use queries and axe
xfilter, xmap, xflatMap
String base XPath evaluation
- Evaluate normal XPath 1.0 strings to XmlPaths
- Evaluates to an Iterable[Either[AttributePath, XmlPath]] or,
- get[T] a value directly from XPath 1.0 (e.g. get[String]("normalize(//*)"))
- Allows querying for the few predicates and XPaths that Scales cannot process (and dynamic queries of course)
- Optional dependency
New xpath.Functions
- Unified interface for XPath function handling
- text, QName and Boolean typeclasses
Implementations for all relevant Scales Xml types
- string( attribute ) makes sense whilst string( QName ) does not
New XmlComparison framework (2.9.x only)
- Compare Xml structures and types
- Customisable comparison rules
- Default Scalaz === Equal type classes
XmlComparison type classes provide full details of differences:
- A QName based path to the difference
- The objects which are different
Extra Fun
- Forwards and Backwards Path Iterators (used by following and preceding)
- DuplicateFilter now works with the Scalaz Equal typeclass
- Using AttributeQNames with the tuple arrow now creates QNames as you'd expect
- DslBuilder allows direct manipulation of trees via folding
- Simplify the Builder usage why /(<(Elem(... ) when you can just /(Elem)?
- Java 1.7 JAXP implementation checks - Schema validation is optimised (no serialization)
How To Use
Scales 0.3 moves to Sonatype under the organisation org.scalesxml, with support for 2.8.1, 2.8.2, 2.9.1 and 2.9.2. As such add:
libraryDependencies ++= Seq( // just for the core library "org.scalesxml" %% "scales-xml" % "0.3-RC6" // or, use this instead for String based XPaths (Jaxen, also includes the core) "org.scalesxml" %% "scales-jaxen" % "0.3-RC6" )
to your xsbt builds or use scales-xml_2.9.2 as the id when using Maven.
Scales Xml is an alternate xml library for Scala providing a coherent model, querying and manipulation via an XPath like syntax, better performance, highly customisable equality framework and an Iteratee based pull api.
