scala.xml.parsing
trait MarkupParser

[source: `scala/xml/parsing/MarkupParser.scala`]

`` `trait` MarkupParser
  `extends` TokenTests

  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.

Author
  Burak Emir
Version
  1.0

Direct Known Subclasses:
  ConstructingParser, XMLEventReader.Parser

Value Summary
`protected val` | cbuf : StringBuilder character buffer, for names
`var` | ch : Char holds the next character
`var` | curInput : Source
`protected var` | doc : Document
`var` | dtd : DTD
`var` | eof : Boolean
`var` | extIndex : Int
`var` | inpStack : List[Source] stack of inputs
`abstract val` | input : Source
`var` | pos : Int holds the position in the source file
`abstract val` | preserveWS : Boolean if true, does not remove surplus whitespace
`var` | tmppos : Int holds temporary values of pos

Method Summary
`def` | appendText (pos : Int, ts : NodeBuffer, txt : String) : Unit
`def` | attrDecl : Unit <! attlist := ATTLIST
`def` | content (pscope : NamespaceBinding) : NodeSeq content1 ::= '<' content1 | '&' charref ...
`def` | content1 (pscope : NamespaceBinding, ts : NodeBuffer) : Unit '<' content1 ::= ...
`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
`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
`def` | extSubset : Unit
`def` | externalID : ExternalID externalID ::= SYSTEM S syslit PUBLIC S pubid S syslit
`abstract def` | externalSource (systemLiteral : String) : Source
`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` | normalizeAttributeValue (attval : String) : String for the moment, replace only character references see spec 3.3.3 precond: cbuf empty
`def` | notationDecl : Unit 'N' notationDecl ::= "OTATION"
`def` | parseDTD : Unit parses document type declaration and assigns it to instance variable dtd. <! parseDTD ::= DOCTYPE name ... >
`def` | pop : Unit
`def` | prolog : (Option[String], Option[String], Option[Boolean]) <? prolog ::= xml S // this is a bit more lenient than necessary...
`def` | pubidLiteral : String
`def` | push (entityName : String) : Unit
`def` | pushExternal (systemId : String) : Unit
`protected def` | putChar (c : Char) : StringBuilder 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 ". value may not contain <. AttValue ::= `'` { _ } `'` | `"` { _ } `"`
`def` | textDecl : (Option[String], Option[String]) prolog, but without standalone
`def` | xAttributeValue : String attribute value, terminated by either ' or ". value may not contain <. AttValue ::= `'` { _ } `'` | `"` { _ } `"`
`def` | xAttributes (pscope : NamespaceBinding) : (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 (ch : () => Char, nextch : () => Unit) : 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 ". value may not contain <. AttValue ::= `'` { _ } `'` | `"` { _ } `"`
`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) : (String, MetaData, NamespaceBinding) parse a start or empty tag. [40] STag ::= '<' Name { S Attribute } [S] [44] EmptyElemTag ::= '<' Name { S Attribute } [S]
`def` | xText : String parse character data. precondition: xEmbeddedBlock == false (we are not in a scala block)
`def` | xToken (that : Seq[Char]) : Unit
`def` | xToken (that : Char) : Unit munch expected XML token, report syntax error for unexpected
`def` | xmlProcInstr : MetaData <? prolog ::= xml S ... ?>

Methods inherited from TokenTests
isSpace, isSpace, isNameChar, isNameStart, isName, isPubIDChar, isValidIANAEncoding, checkSysID, checkPubID

Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized

Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf

Value Details

`abstract` `val` input : Source

`abstract` `val` preserveWS : Boolean

  if true, does not remove surplus whitespace

`` `var` curInput : Source

`` `var` inpStack : List[Source]

  stack of inputs

`` `var` pos : Int

  holds the position in the source file

`` `var` extIndex : Int

`` `var` tmppos : Int

  holds temporary values of pos

`` `var` ch : Char

  holds the next character

`protected` `val` cbuf : StringBuilder

  character buffer, for names

`` `var` dtd : DTD

`protected` `var` doc : Document

`` `var` eof : Boolean

Method Details

`abstract` `def` externalSource(systemLiteral : String) : Source

`` `def` xmlProcInstr : MetaData

  <? prolog ::= xml S ... ?>

`` `def` prolog : (Option[String], Option[String], Option[Boolean])

  <? prolog ::= xml S // this is a bit more lenient than necessary...

`` `def` textDecl : (Option[String], Option[String])

  prolog, but without standalone

`` `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

`protected` `def` putChar(c : Char) : StringBuilder

  append Unicode character to name buffer

`` `def` nextch : Unit

  this method assign the next character to ch and advances in input

`` `def` xToken(that : Char) : Unit

  munch expected XML token, report syntax error for unexpected

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

`` `def` xAttributes(pscope : NamespaceBinding) : (MetaData, NamespaceBinding)

  parse attribute and create namespace scope, metadata [41] Attributes ::= { S Name Eq AttValue }

`` `def` xAttributeValue : String

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

`` `def` xEntityValue : String

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

`protected` `def` xTag(pscope : NamespaceBinding) : (String, MetaData, NamespaceBinding)

  parse a start or empty tag. [40] STag ::= '<' Name { S Attribute } [S] [44] EmptyElemTag ::= '<' Name { S Attribute } [S]

`` `def` xEndTag(n : String) : Unit

  [42] '<' xmlEndTag ::= '<' '/' Name S? '>'

`` `def` xCharData : NodeSeq

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

`` `def` xCharRef(ch : () => Char, nextch : () => Unit) : 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` appendText(pos : Int, ts : NodeBuffer, txt : String) : Unit

`` `def` content1(pscope : NamespaceBinding, ts : NodeBuffer) : Unit

  '<' content1 ::= ...

`` `def` content(pscope : NamespaceBinding) : NodeSeq

  content1 ::= '<' content1 | '&' charref ...

`` `def` externalID : ExternalID

  externalID ::= SYSTEM S syslit PUBLIC S pubid S syslit

`` `def` parseDTD : Unit

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

`` `def` element(pscope : NamespaceBinding) : NodeSeq

`` `def` element1(pscope : NamespaceBinding) : NodeSeq

  '<' element ::= xmlTag1 '>' { xmlExpr | '{' simpleExpr '}' } ETag | xmlTag1 '/' '>'

`` `def` xName : String

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

`` `def` xEQ : Unit

  scan [S] '=' [S]

`` `def` xSpaceOpt : Unit

  skip optional space S?

`` `def` xSpace : Unit

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

`` `def` xProcInstr : NodeSeq

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

`` `def` xText : String

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

`` `def` systemLiteral : String

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

`` `def` pubidLiteral : String

`` `def` extSubset : Unit

`` `def` markupDecl1 : Any

`` `def` markupDecl : Unit

`` `def` intSubset : Unit

  "rec-xml/#ExtSubset" pe references may not occur within markup declarations

`` `def` elementDecl : Unit

  <! element := ELEMENT

`` `def` attrDecl : Unit

  <! attlist := ATTLIST

`` `def` entityDecl : Unit

  <! element := ELEMENT

`` `def` notationDecl : Unit

  'N' notationDecl ::= "OTATION"

`` `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` push(entityName : String) : Unit

`` `def` pushExternal(systemId : String) : Unit

`` `def` pop : Unit

`` `def` normalizeAttributeValue(attval : String) : String

  for the moment, replace only character references see spec 3.3.3 precond: cbuf empty