All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala.xml.ProcInstr.scala Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2003-2013, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

package scala
package xml

/**
 * an XML node for processing instructions (PI)
 *
 * @author Burak Emir
 * @param  target     target name of this PI
 * @param  proctext   text contained in this node, may not contain "?>"
 */
case class ProcInstr(target: String, proctext: String) extends SpecialNode {
  if (!Utility.isName(target))
    throw new IllegalArgumentException(target + " must be an XML Name")
  if (proctext contains "?>")
    throw new IllegalArgumentException(proctext + " may not contain \"?>\"")
  if (target.toLowerCase == "xml")
    throw new IllegalArgumentException(target + " is reserved")

  final override def doCollectNamespaces = false
  final override def doTransform = false

  final def label = "#PI"
  override def text = ""

  /**
   * appends "<?" target (" "+text)?+"?>"
   *  to this stringbuffer.
   */
  override def buildString(sb: StringBuilder) =
    sb append "".format(target, (if (proctext == "") "" else " " + proctext))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy