This page is no longer maintained — Please continue to the home page at www.scala-lang.org

inconsistency (?) in xml handling

No replies
Ittay Dror 2
Joined: 2010-05-05,
User offline. Last seen 42 years 45 weeks ago.

XML handling sometimes creates an Atom and sometime a Text for an XML that is otherwise the same. This causes inconsistencies when serializing the XML (with an Atom) and deserializing (which will create a Text) and is IMHO generally confusing.

Welcome to Scala version 2.8.0.final (Java HotSpot(TM) Client VM, Java 1.6.0_21).

Type in expressions to have them evaluated.
Type :help for more information.

scala> val c = "1"
c: java.lang.String = 1

scala> {c}
res0: scala.xml.Elem = 1

scala> res0.child(0).getClass
res1: java.lang.Class[_] = class scala.xml.Atom

scala> 1
res2: scala.xml.Elem = 1

scala> res2.child(0).getClass
res3: java.lang.Class[_] = class scala.xml.Text

Ittay

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland