Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
scala中XML中的纯文本_Xml_Scala - Fatal编程技术网

scala中XML中的纯文本

scala中XML中的纯文本,xml,scala,Xml,Scala,如果我这样做一个变量: val x = <a>H<b>i</b>!</a> L(0): TextElement = TextElement("h") L(1): BElement = BElement(TextElement("i")) L(2): TextElement = TextElement("!") 但是我在任何文档中都看不到任何关于文本元素的内容(或者说,我真的没有看到太多关于它是如何工作的) 它是如何在Scala中实现的?它

如果我这样做一个变量:

val x = <a>H<b>i</b>!</a>
L(0): TextElement = TextElement("h")
L(1): BElement    = BElement(TextElement("i"))
L(2): TextElement = TextElement("!")
但是我在任何文档中都看不到任何关于
文本元素的内容(或者说,我真的没有看到太多关于它是如何工作的)


它是如何在Scala中实现的?

它是
xml.Text

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

它是
xml.Text

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

您所说的“表示文本对象”是什么意思?有一个scala.xml.Text类,我认为它满足了您的要求。您所说的“表示文本对象”是什么意思?有一个scala.xml.Text类,它满足了我的要求。