implicit.ly

Scala software, hot off the presses

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.

via herald

Filed under  //   ScalesXml  
Posted May 7, 2012 by scales-xml 

Scales Xml 0.2.1

Matching and JAXP compatibility fixes

Scales 0.2.1 is bug fix release. Source compatibility is maintained but a recompile is likely necessary.

Barring further bug fixes this is probably the last release before migrating to the new xsbt (which also includes migrating all of the plugins) and introduction of various subprojects.

Fixes include:

  • JAXP TrAX compatible with both the Saxon and Sun JDK approach to StAX reading (see issue 1)
  • Matching on QName alone (Attribute or Elem) requires calling the .m or .matcher function.

Known issues:

  1. Using TrAX for serializing or transforming will not, in the JDK - due to the JDK ignoring them, process PROLOG and end misc items. Saxon does process this correctly. Use the scales.traxSourceShouldSerialize system property (set to true) if these events are important to you, its simply much faster. When left as its non Xalan defaul - false - no extra serialization is required and transformations will be faster (but loose wrapping misc items).
  2. Xalan users don't really have choice here as it doesn't support StAX readers for transformations (no StAXStream2SAX)

Scales Xml is an alternate xml library for Scala providing a coherent model, querying and manipulation via an XPath like syntax and an Iteratee based pull api.

Filed under  //   Scala 2.8.1   Scala 2.9.0-1   Scala 2.9.1   Scales Xml   scales  

Scales Xml 0.2

Performance, Flexibility and Correctness Improvements

Scales 0.2 is an incremental release aimed at improved overall performance for the Xml Pull api and correctness.

It now reaches my correctness, usability and performance aims from almost 2 years ago when I started the project.

Additional functionality includes:

  • XPath union
  • Path sorting now allows sorting tuples of (T, Path)

Performance Improvements

  • Iteratee based parsing with onDone (onQNames) is now 40-50% faster and allocates even less memory
  • Deep XPath searches (\\) are 20-25% faster
  • XPath non-sorted / duplicate filtered results can be >30% faster (due to evaluation choice)
  • Document order sorting and filtering only when required (15-20% faster for exact or non matching XPaths)
  • XPath general performance gains of 5-10% and lower memory allocations

Additional Flexibility For XPath Evaluation Choices

  • The developer can now choose to lazily evaluate XPaths
  • The resulting Iterable[XPath] can be lazily traversed
  • The raw unfiltered and unsorted paths can be traversed

Correctness Improvements

  • Attribute axis results are now typed
  • Document order results from Attribute Axis
  • XPath union (|) maintains ordering

Release Improvements

  • Reduced dependencies (now only Scalaz, slf4j and commons-codec)
  • Removed JUnit test helpers
  • Scalaz version upped to 6.0.3

See the release site for the docs including performance information and many examples.

Scales Xml is an alternate xml library for Scala providing a coherent model, querying and manipulation via an XPath like syntax and an Iteratee based pull api.

Filed under  //   Scala 2.8.1   Scala 2.9.0-1   Scala 2.9.1   Scales Xml   scales  

Scales Xml 0.1.0

Initial Release

Scales Xml is an alternative XML library, providing correctness first, a unified model for push and pull, Scalaz Iteratee based pulls, performance gains and possible customisations for parsing, serializing and transformations.

The content of the DOM is separated from the structure itself. This lends itself to space savings in both parsing and the resulting DOM, but doesn't sacrifice performance in doing so.

Manipulation and querying is based on tree Zippers (Path), with the XPath like querying system based directly upon them. A DSL provides simple construction and aids in transformations, which can be performed via paths across the tree.

See the release site for the docs including performance information and many examples.

Scales Xml is an alternate xml library for Scala providing a coherent model, querying and manipulation via an XPath like syntax and an Iteratee based pull api.

Filed under  //   Scala 2.8.1   Scala 2.9.0-1   Scala 2.9.1   Scales Xml   scales