开发者

plain text in XML in scala

开发者 https://www.devze.com 2023-02-19 07:51 出处:网络
If I make a variable like this: val x = <a>H<b>i</b>!</a> how does Scala represent the text objects? If I were making the system, you\'d have some List of elements that look

If I make a variable like this:

val x = <a>H<b>i</b>!</a>

how does Scala represent the text objects? If I were making the system, you'd have some List of elements that looks something like this:

L(0): TextElement = TextElement("h")
L(1): BElement    = BElement(TextElement("i"))
L(2): TextElement = TextElement("!")

But I don't see anything about text elements in any documentation (or really very much about how this works at all.)

How is it implem开发者_如何学运维ented in Scala?


it is xml.Text :

scala> x.child.map(_.getClass).foreach(println)
class scala.xml.Text
class scala.xml.Elem
class scala.xml.Text

http://www.scala-lang.org/archives/downloads/distrib/files/nightly/docs/library/scala/xml/package.html

0

精彩评论

暂无评论...
验证码 换一张
取 消