in scala/xml/parsing
class MarkupParser

abstract class MarkupParser[MarkupType]()
extends Object
with ScalaObject
Implementing classes or objects:
class ConstructingParser()

an xml parser. parses XML, invokes callback methods of a MarkupHandler and returns whatever the markup handler returns. Use ConstructingParser if you just want to parse XML to construct instances of scala.xml.Node.

Field Summary
protected val cbuf: StringBuffer
     character buffer, for names
abstract val handle: MarkupHandler[MarkupType]
     the handler of the markup
  val lookupURI: Map[String,String]
final val noAttribs: HashMap[String,AttribValue]
final val noChildren: ListBuffer[MarkupType]
abstract val preserveWS: Boolean
     if true, does not remove surplus whitespace

Method Summary
protected var aMap: Map[String,AttribValue]
  def appendText(pos: Int, ts: Buffer[MarkupType], txt: String): Unit
  var ch: Char
     holds the next character
  def content: Buffer[MarkupType]
  var defaultURI: String
  def element: Iterable[MarkupType]
  def element1: Iterable[MarkupType]
     '<' element ::= xmlTag1 '>' { xmlExpr | '{' simpleExpr '}' } ETag | xmlTag1 '/' '>'
abstract def init: Unit
     this method should assign the first character of the input to ch
abstract def nextch: Unit
     this method assign the next character to ch and advances in input
  var pos: Int
     holds the position in the source file
protected def putChar(c: Char): StringBuffer
     append Unicode character to name buffer
abstract def reportSyntaxError(str: String): Unit
     report a syntax error
  var tmppos: Int
     holds temporary values of pos
  def xAttributeValue(endch: Char): String
     attribute value, terminated by either ' or ".
  def xAttributes: HashMap[String,AttribValue]
     parse attribute and add it to listmap [41] Attributes ::= { S Name Eq AttValue } AttValue ::= `'` { _ } `'` | `"` { _ } `"` | `{` scalablock `}`
  def xCharData: Iterable[MarkupType]
     '<! CharData ::= [CDATA[ ( {char} - {char}"]]>"{char} ) ']]>' see [15]
  def xCharRef: String
     CharRef ::= "&#" '0'..'9' {'0'..'9'} ";" | "&#x" '0'..'9'|'A'..'F'|'a'..'f' { hexdigit } ";" see [66]
  def xComment: Iterable[MarkupType]
     Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->' see [15]
  def xEQ: Unit
     scan [S] '=' [S]
  def xEndTag(n: String): Unit
     [42] '<' xmlEndTag ::= '<' '/' Name S? '>'
  def xName: String
     Name ::= (Letter | '_' | ':') (NameChar)* see [5] of XML 1.0 specification
  def xProcInstr: Iterable[MarkupType]
     '<?' ProcInstr ::= Name [S ({Char} - ({Char}'>?' {Char})]'?>' see [15]
  def xSpace: Unit
     scan [3] S ::= (#x20 | #x9 | #xD | #xA)+
  def xSpaceOpt: Unit
     skip optional space S?
protected def xTag: Tuple2[String,Map[String,AttribValue]]
     parse a start or empty tag.
  def xText: String
     parse character data.
  def xToken(that: Char): Unit
     munch expected XML token, report syntax error for unexpected

Methods inherited from java/lang/Object-class
clone, eq, equals, finalize, getClass, hashCode, notify, notifyAll, synchronized, toString, wait, wait, wait

Methods inherited from scala/Any-class
!=, ==, asInstanceOf, isInstanceOf, match

Field Detail

handle

  abstract val handle: MarkupHandler[MarkupType]
the handler of the markup

preserveWS

  abstract val preserveWS: Boolean
if true, does not remove surplus whitespace

cbuf

  protected val cbuf: StringBuffer
character buffer, for names

noChildren

  final val noChildren: ListBuffer[MarkupType]

noAttribs

  final val noAttribs: HashMap[String,AttribValue]

lookupURI

  val lookupURI: Map[String,String]
Method Detail

pos

  var pos: Int
holds the position in the source file

tmppos

  var tmppos: Int
holds temporary values of pos

ch

  var ch: Char
holds the next character

putChar

  protected def putChar(c: Char): StringBuffer
append Unicode character to name buffer

aMap

  protected var aMap: Map[String,AttribValue]

defaultURI

  var defaultURI: String

nextch

  abstract def nextch: Unit
this method assign the next character to ch and advances in input

init

  abstract def init: Unit
this method should assign the first character of the input to ch

reportSyntaxError

  abstract def reportSyntaxError(str: String): Unit
report a syntax error

xToken

  def xToken(that: Char): Unit
munch expected XML token, report syntax error for unexpected

xAttributes

  def xAttributes: HashMap[String,AttribValue]
parse attribute and add it to listmap [41] Attributes ::= { S Name Eq AttValue } AttValue ::= `'` { _ } `'` | `"` { _ } `"` | `{` scalablock `}`

xAttributeValue

  def xAttributeValue(endch: Char): String
attribute value, terminated by either ' or ". value may not contain <.
Parameters:
endch - either ' or "

xTag

  protected def xTag: Tuple2[String,Map[String,AttribValue]]
parse a start or empty tag. [40] STag ::= '<' Name { S Attribute } [S] [44] EmptyElemTag ::= '<' Name { S Attribute } [S]

xEndTag

  def xEndTag(n: String): Unit
[42] '<' xmlEndTag ::= '<' '/' Name S? '>'

xCharData

  def xCharData: Iterable[MarkupType]
'<! CharData ::= [CDATA[ ( {char} - {char}"]]>"{char} ) ']]>' see [15]

xCharRef

  def xCharRef: String
CharRef ::= "&#" '0'..'9' {'0'..'9'} ";" | "&#x" '0'..'9'|'A'..'F'|'a'..'f' { hexdigit } ";" see [66]

xComment

  def xComment: Iterable[MarkupType]
Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->' see [15]

appendText

  def appendText(pos: Int, ts: Buffer[MarkupType], txt: String): Unit

content

  def content: Buffer[MarkupType]

element

  def element: Iterable[MarkupType]

element1

  def element1: Iterable[MarkupType]
'<' element ::= xmlTag1 '>' { xmlExpr | '{' simpleExpr '}' } ETag | xmlTag1 '/' '>'

xName

  def xName: String
Name ::= (Letter | '_' | ':') (NameChar)* see [5] of XML 1.0 specification

xEQ

  def xEQ: Unit
scan [S] '=' [S]

xSpaceOpt

  def xSpaceOpt: Unit
skip optional space S?

xSpace

  def xSpace: Unit
scan [3] S ::= (#x20 | #x9 | #xD | #xA)+

xProcInstr

  def xProcInstr: Iterable[MarkupType]
'<?' ProcInstr ::= Name [S ({Char} - ({Char}'>?' {Char})]'?>' see [15]

xText

  def xText: String
parse character data. precondition: xEmbeddedBlock == false (we are not in a scala block)