summaryrefslogtreecommitdiff
path: root/src/library/scala/xml/Text.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/xml/Text.scala')
-rw-r--r--src/library/scala/xml/Text.scala32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/library/scala/xml/Text.scala b/src/library/scala/xml/Text.scala
new file mode 100644
index 0000000000..507239cc8b
--- /dev/null
+++ b/src/library/scala/xml/Text.scala
@@ -0,0 +1,32 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2004, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+** $Id$
+\* */
+
+package scala.xml;
+
+/** an XML node for text (PCDATA). Used in both non-bound and bound XML
+ * representations
+ * @author Burak Emir
+ * @param text the text contained in this node, may not be null.
+ */
+case class Text( _data: String ) extends Atom[String](_data) {
+
+ if(null == data)
+ throw new java.lang.NullPointerException("tried to construct Text with null");
+
+ final override def equals(x:Any) = x match {
+ case s:String => s.equals( data.toString() );
+ case s:Text => data == s.data ;
+ case _ => false;
+ }
+
+ /** returns text, with some characters escaped according to XML spec */
+ override def toString(sb:StringBuffer) =
+ Utility.escape( data.toString(), sb );
+
+}