Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

State of XML support in Scala 2.9.x

I'm currently starting to look into using Scala's XML support for business critical processes. In that regard I would like to know what the current state of the standard XML library in Scala is.

I have read some "old" articles relating to Scala 2.7 and the 2.8 trunk, where it was stated that the XML handling would be threadsafe for scala 2.8, and that there was several bugs in version 2.7.x. Some critique has also been giving on the XML class hierachy, but I guess that's a matter of taste.

So I would like if somebody could answer the question, what is the current state of the Scala XML library for version 2.9.x?

Thanks in advance.

like image 961
StefanE Avatar asked Sep 27 '11 12:09

StefanE


4 Answers

There is an alternative library available for XML in Scala, Anti-XML. From the home page:

Anti-XML is a proposed replacement for the scala.xml package in the Scala standard library. The standard package is outdated and beyond fixing. We need to start over, on solid foundations and unburdened by backward compatibility. Anti-XML aims for quality in three major areas: Usability, Reliability, Performance

If you're looking at using XML seriously, then it's worth looking at Anti-XML.

The source is available here: https://github.com/djspiewak/anti-xml

like image 79
Matthew Farwell Avatar answered Sep 19 '22 16:09

Matthew Farwell


Let me answer this way:

  • Open XML issues (those assigned to the XML Team -- there might be others)
  • Alternative XML libraries in Scala

Or, putting it into words, many people are not satisfied. After all, people are writing full blown alternatives instead of trying to "fix" the library. And, speaking of fixing, I had a fix which turned an operation from O(n^2) to O(n) submitted for so long that, when someone opened the very same issue again, I didn't even remember having opened it before.

Mind you, Lift uses standard library XML, and, as far as I know, so do most of the other web frameworks (I suspect Play doesn't), so it's not like it's unusable.

like image 23
Daniel C. Sobral Avatar answered Sep 18 '22 16:09

Daniel C. Sobral


Scala XML is stable, supported and won’t go away for a very long time.

Nonetheless, there are some design criticisms made and a few people sat down and decided to write a better alternative from scratch, Anti-XML.

If everything works out, you will have an additional choice in the future.

like image 24
soc Avatar answered Sep 17 '22 16:09

soc


Scales Xml is my answer to that question. Its not that I had found the quirks of Scala XML to be bad, but the approach itself didn't sit with me well and prompted the question "what if you separated the content from the tree and unified push and pull".

After much playing I discovered many cool ways to leverage the type system in order to make XML usage simpler for a number of activities, more correct and faster than Scala XML.

You very quickly realise, when writing an alternative library, just how much thought and effort went into Scala XML. Its killer features are:

  1. Provided with the default library
  2. In built XML syntax

for simple out of the box usage its hard to beat (although I'm confident I've done that ^_^).

Its important that other younger alternatives like Anti-XML have appeared as choice is often what drives innovation. I'd just advise users to look at what they really need rather than assuming the alternatives automatically provide the best choice.

like image 38
Chris Avatar answered Sep 17 '22 16:09

Chris