- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
inconsistency (?) in xml handling
Mon, 2010-09-27, 21:55
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