SethTisue on master
Update scalajs-junit-test-plugi… (compare)
NthPortal on master
Update sbt to 1.4.6 Merge pull request #479 from sc… (compare)
SethTisue on master
Make RuleTranformer fully recur… Merge pull request #421 from dc… (compare)
CanBuildFrom
is already gone in Scala 2.13, so CanBuildFrom
isn't a Scala 2 vs 3 difference
CanBuildFrom
is still present. but they expect to switch to the 2.13 stdlib quite soon
scala.xml.pull
, but it's deprecated, for good reasons.) I'd suggest looking into what Java XML libraries support streaming, and use one of those from Scala
Hello, @all I would like to write an xml Elem to a file, but I want to set the line separator between each node of the elem, so when opening the file under windows or ubuntu I have the correct format. for example :
val lineSep = System.getProperty("line.separator")
val xmlData : Elem = <person>
<firstName>John</firstName>
<lastName>Doe</lastName>
<emails>
<email type=”primary”>john.doe@noone.com</email>
<email type=”secondary”>john.doe@noone.com</email>
</emails>
<address>
<street>595 Market Street</street>
<city>San Francisco</city>
<zip>94105</zip>
</address>
</person>
How to write it into a file and considering the lineSep?
I see the following change in behavior between scala 2.12 and 2.13:
scala 2.12:
scala> import scala.xml._
import scala.xml._
scala> val a: NodeSeq = <a>Hello</a>
a: scala.xml.NodeSeq = <a>Hello</a>
scala> a ++ <b>hi</b>
res0: scala.xml.NodeSeq = NodeSeq(<a>Hello</a>, <b>hi</b>)
Scala 2.13:
scala> a ++ <b>hi</b>
res0: Seq[scala.xml.Node] = List(<a>Hello</a>, <b>hi</b>)
That change has a very deep reach for us, because Lift doesn't interpret both type in the same way: it applies template transformation one time for a NodeSeq
(it's only one template), and N times for List[Node]
(it's a list of template). Our web application is totally broken, and it's almost impossible to find all places which would need a type ascription (and it would bloat a lot the resulting code.
Is there a way to get back the old behavior? Perhaps we are missing a new implicit? Perhaps the implicit precedence in NodeSeq
changed and it could be adpated?
Any insight would be appreciated.
Hi guys, i have a question for you. I'm trying to map Elem
children but the result is not what i expected.
val elem: Elem =
<a>
<b>1</b>
<b>2</b>
<b>3</b>
</a>
val result = elem.child.map(k => <c>{k.text}</c>)
Returns
ArrayBuffer(
<c></c>,
<c>1</c>,
<c></c>,
<c>2</c>,
<c></c>,
<c>3</c>,
<c></c>
)
Can someone explain me why this happend ? why empty nodes ?
elem.child.map {
case e: Elem => <c>k.text</c>
case n => n
}
res0: Seq[scala.xml.Node] = List( , <c>k.text</c>, , <c>k.text</c>, , <c>k.text</c>, )
encoding
setting , but that won't help. The XML declaration could have an encoding attribute, or not, but I don't think that's tracked either. Parts of the code look like there was an effort to try and capture the encoding, but it was abandoned and never completed.