in scala/xml/parsing
class MarkupParser

abstract class MarkupParser()
extends Object
with ScalaObject
with TokenTests
Implementing classes or objects:
class ConstructingParser(inp: Source, presWS: Boolean)

An XML parser. Parses XML 1.0, 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. While XML elements are returned, DTD declarations - if handled - are collected using side-effects.

Field Summary
protected val cbuf: StringBuffer
     character buffer, for names
abstract val input: Source
abstract val preserveWS: Boolean
     if true, does not remove surplus whitespace

Method Summary
  def appendText(pos: Int, ts: NodeBuffer, txt: String): Unit
  def attrDecl(): Unit
     <! attlist := ATTLIST
  var ch: Char
     holds the next character
  def content(pscope: NamespaceBinding): NodeSeq
     content1 ::= '<' content1 | '&' charref ...
  def content1(pscope: NamespaceBinding, ts: NodeBuffer): Unit
     '<' content1 ::= ...
  var curInput: Source
  def document(): Document
     [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>' [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"') [25] Eq ::= S? '=' S? [26] VersionNum ::= '1.0' [27] Misc ::= Comment | PI | S
  var dtd: DTD
  def element(pscope: NamespaceBinding): NodeSeq
  def element1(pscope: NamespaceBinding): NodeSeq
     '<' element ::= xmlTag1 '>' { xmlExpr | '{' simpleExpr '}' } ETag | xmlTag1 '/' '>'
  def elementDecl(): Unit
     <! element := ELEMENT
  def entityDecl(): Unit
     <! element := ELEMENT
  var eof: Boolean
  var extIndex: Int
  def extSubset(): Unit
  def externalID(): ExternalID
     externalID ::= SYSTEM S syslit PUBLIC S pubid S syslit
abstract def externalSource(systemLiteral: String): Source
  var inpStack: List[Source]
     stack of inputs
  def intSubset(): Unit
     "rec-xml/#ExtSubset" pe references may not occur within markup declarations
  def markupDecl(): Unit
  def markupDecl1(): Any
  def nextch: Unit
     this method assign the next character to ch and advances in input
  def notationDecl(): Unit
     'N' notationDecl ::= "OTATION"
  def parseDTD(): Unit
     parses document type declaration and assigns it to instance variable dtd.
  def pop(): Unit
  var pos: Int
     holds the position in the source file
  def prolog(): Tuple3[Option[String],Option[String],Option[Boolean]]
     <? prolog ::= xml S
  def pubidLiteral(): String
  def push(entityName: String): Unit
  def pushExternal(systemId: String): Unit
protected def putChar(c: Char): StringBuffer
     append Unicode character to name buffer
  def reportSyntaxError(pos: Int, str: String): Unit
     report a syntax error
  def reportSyntaxError(str: String): Unit
  def reportValidationError(pos: Int, str: String): Unit
     report a syntax error
  def systemLiteral(): String
     attribute value, terminated by either ' or ".
  def textDecl(): Tuple2[Option[String],Option[String]]
     prolog, but without standalone
  var tmppos: Int
     holds temporary values of pos
  def xAttributeValue(): String
     attribute value, terminated by either ' or ".
  def xAttributes(pscope: NamespaceBinding): Tuple2[MetaData,NamespaceBinding]
     parse attribute and create namespace scope, metadata [41] Attributes ::= { S Name Eq AttValue }
  def xCharData: NodeSeq
     '<! 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: NodeSeq
     Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->' see [15]
  def xEQ: Unit
     scan [S] '=' [S]
  def xEndTag(n: String): Unit
     [42] '<' xmlEndTag ::= '<' '/' Name S? '>'
  def xEntityValue(): String
     entity value, terminated by either ' or ".
  def xName: String
     Name ::= (Letter | '_' | ':') (NameChar)* see [5] of XML 1.0 specification
  def xProcInstr: NodeSeq
     '<?' 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(pscope: NamespaceBinding): Tuple3[String,MetaData,NamespaceBinding]
     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
  def xToken(that: Seq[Char]): Unit
  def xmlProcInstr(): MetaData
     <? prolog ::= xml S ...

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

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

Methods inherited from scala/ScalaObject-class
getScalaType

Methods inherited from scala/util/logging/Logged-class
log

Methods inherited from scala/xml/parsing/MarkupHandler-class
attListDecl, comment, decls, elem, elemDecl, elemEnd, elemStart, endDTD, ent, entityRef, isValidating, lookupElemDecl, notationDecl, parameterEntityDecl, parsedEntityDecl, peReference, procInstr, replacementText, text, unparsedEntityDecl

Methods inherited from scala/xml/parsing/TokenTests-class
checkPubID, checkSysID, isName, isNameChar, isNameStart, isPubIDChar, isSpace, isSpace, isValidIANAEncoding

Field Detail

input

  abstract val input: Source

preserveWS

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

cbuf

  protected val cbuf: StringBuffer
character buffer, for names
Method Detail

externalSource

  abstract def externalSource(systemLiteral: String): Source

curInput

  var curInput: Source

inpStack

  var inpStack: List[Source]
stack of inputs

pos

  var pos: Int
holds the position in the source file

extIndex

  var extIndex: Int

tmppos

  var tmppos: Int
holds temporary values of pos

ch

  var ch: Char
holds the next character

dtd

  var dtd: DTD

eof

  var eof: Boolean

xmlProcInstr

  def xmlProcInstr(): MetaData
<? prolog ::= xml S ... ?>

prolog

  def prolog(): Tuple3[Option[String],Option[String],Option[Boolean]]
<? prolog ::= xml S

textDecl

  def textDecl(): Tuple2[Option[String],Option[String]]
prolog, but without standalone

document

  def document(): Document
[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>' [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"') [25] Eq ::= S? '=' S? [26] VersionNum ::= '1.0' [27] Misc ::= Comment | PI | S

putChar

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

nextch

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

xToken

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

xToken

  def xToken(that: Seq[Char]): Unit

xAttributes

  def xAttributes(pscope: NamespaceBinding): Tuple2[MetaData,NamespaceBinding]
parse attribute and create namespace scope, metadata [41] Attributes ::= { S Name Eq AttValue }

xAttributeValue

  def xAttributeValue(): String
attribute value, terminated by either ' or ". value may not contain <. AttValue ::= `'` { _ } `'` | `"` { _ } `"`

xEntityValue

  def xEntityValue(): String
entity value, terminated by either ' or ". value may not contain <. AttValue ::= `'` { _ } `'` | `"` { _ } `"`

xTag

  protected def xTag(pscope: NamespaceBinding): Tuple3[String,MetaData,NamespaceBinding]
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: NodeSeq
'<! 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: NodeSeq
Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->' see [15]

appendText

  def appendText(pos: Int, ts: NodeBuffer, txt: String): Unit

content1

  def content1(pscope: NamespaceBinding, ts: NodeBuffer): Unit
'<' content1 ::= ...

content

  def content(pscope: NamespaceBinding): NodeSeq
content1 ::= '<' content1 | '&' charref ...

externalID

  def externalID(): ExternalID
externalID ::= SYSTEM S syslit PUBLIC S pubid S syslit

parseDTD

  def parseDTD(): Unit
parses document type declaration and assigns it to instance variable dtd. <! parseDTD ::= DOCTYPE name ... >

element

  def element(pscope: NamespaceBinding): NodeSeq

element1

  def element1(pscope: NamespaceBinding): NodeSeq
'<' 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: NodeSeq
'<?' 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)

systemLiteral

  def systemLiteral(): String
attribute value, terminated by either ' or ". value may not contain <. AttValue ::= `'` { _ } `'` | `"` { _ } `"`

pubidLiteral

  def pubidLiteral(): String

extSubset

  def extSubset(): Unit

markupDecl1

  def markupDecl1(): Any

markupDecl

  def markupDecl(): Unit

intSubset

  def intSubset(): Unit
"rec-xml/#ExtSubset" pe references may not occur within markup declarations

elementDecl

  def elementDecl(): Unit
<! element := ELEMENT

attrDecl

  def attrDecl(): Unit
<! attlist := ATTLIST

entityDecl

  def entityDecl(): Unit
<! element := ELEMENT

notationDecl

  def notationDecl(): Unit
'N' notationDecl ::= "OTATION"

reportSyntaxError

  def reportSyntaxError(pos: Int, str: String): Unit
report a syntax error

reportSyntaxError

  def reportSyntaxError(str: String): Unit

reportValidationError

  def reportValidationError(pos: Int, str: String): Unit
report a syntax error

push

  def push(entityName: String): Unit

pushExternal

  def pushExternal(systemId: String): Unit

pop

  def pop(): Unit