summaryrefslogtreecommitdiff
path: root/src/library/scala/xml/PCData.scala
blob: 330ad897f90170c7fec3372e78432f0ba7507e98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package scala.xml

/** This class (which is not used by all XML parsers, but always used by the XHTML one)
 *  represents parseable character data, which appeared as CDATA sections in the input
 *  and is to be preserved as CDATA section in the output.
 */
case class PCData(_data: String) extends Atom[String](_data) {
  if (null == data)
    throw new IllegalArgumentException("tried to construct PCData with null")

  /** Returns text, with some characters escaped according to the XML
   *  specification.
   *
   *  @param  sb ...
   *  @return ...
   */
  override def buildString(sb: StringBuilder) =
    sb append "<![CDATA[%s]]>".format(data)
}