scala.xml.parsing

MarkupParser

trait MarkupParser extends MarkupParserCommon with 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.

known subclasses: XhtmlParser, ConstructingParser

Inherits

  1. MarkupParserCommon
  2. TokenTests
  3. AnyRef
  4. Any

Type Members

  1. type InputType = Source

  2. type PositionType = Int

Value Members

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

  2. def attrDecl(): Unit

    <! attlist := ATTLIST

  3. var ch: Char

    holds the next character

  4. def checkPubID(s: String): Boolean

  5. def checkSysID(s: String): Boolean

  6. def content(pscope: NamespaceBinding): NodeSeq

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

  7. def content1(pscope: NamespaceBinding, ts: NodeBuffer): Unit

    '<' content1 ::=

  8. var curInput: Source

  9. 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

  10. var dtd: DTD

  11. def element(pscope: NamespaceBinding): NodeSeq

  12. def element1(pscope: NamespaceBinding): NodeSeq

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

  13. def elementDecl(): Unit

    <! element := ELEMENT

  14. def entityDecl(): Unit

    <! element := ELEMENT

  15. var eof: Boolean

  16. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

  17. var extIndex: Int

  18. def extSubset(): Unit

  19. def externalID(): ExternalID

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

  20. def externalSource(systemLiteral: String): Source

  21. def hashCode(): Int

    Returns a hash code value for the object

  22. def initialize: MarkupParser with MarkupHandler

    As the current code requires you to call nextch once manually after construction, this method formalizes that suboptimal reality

  23. var inpStack: List[Source]

    stack of inputs

  24. val input: Source

  25. def intSubset(): Unit

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

  26. def isAlpha(c: Char): Boolean

    These are 99% sure to be redundant but refactoring on the safe side

  27. def isAlphaDigit(c: Char): Boolean

  28. def isName(s: String): Boolean

    Name ::= ( Letter | '_' ) (NameChar)*

  29. def isNameChar(ch: Char): Boolean

    NameChar ::= Letter | Digit | '

  30. def isNameStart(ch: Char): Boolean

    NameStart ::= ( Letter | '_' ) where Letter means in one of the Unicode general categories { Ll, Lu, Lo, Lt, Nl }

  31. def isPubIDChar(ch: Char): Boolean

  32. def isValidIANAEncoding(ianaEncoding: Seq[Char]): Boolean

    Returns true if the encoding name is a valid IANA encoding

  33. def lookahead(): BufferedIterator[Char]

    Create a lookahead reader which does not influence the input

  34. def markupDecl(): Unit

  35. def markupDecl1(): Any

  36. def nextch: Char

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

  37. def normalizeAttributeValue(attval: String): String

    for the moment, replace only character references see spec 3

  38. def notationDecl(): Unit

    'N' notationDecl ::= "OTATION"

  39. def parseDTD(): Unit

    parses document type declaration and assigns it to instance variable dtd

  40. def pop(): Unit

  41. var pos: Int

    holds the position in the source file

  42. val preserveWS: Boolean

    if true, does not remove surplus whitespace

  43. def prolog(): (Option[String], Option[String], Option[Boolean])

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

  44. def pubidLiteral(): String

  45. def push(entityName: String): Unit

  46. def pushExternal(systemId: String): Unit

  47. def reportSyntaxError(str: String): Unit

  48. def reportSyntaxError(pos: Int, str: String): Unit

  49. def reportValidationError(pos: Int, str: String): Unit

  50. def returning[T](x: T)(f: (T) ⇒ Unit): T

  51. def systemLiteral(): String

    attribute value, terminated by either ' or "

  52. def textDecl(): (Option[String], Option[String])

    prolog, but without standalone

  53. var tmppos: Int

    holds temporary values of pos

  54. def toString(): String

    Returns a string representation of the object

  55. def xAttributeValue(): String

    attribute value, terminated by either ' or "

  56. def xAttributes(pscope: NamespaceBinding): (MetaData, NamespaceBinding)

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

  57. def xCharData: NodeSeq

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

  58. def xCharRef(ch: () ⇒ Char, nextch: () ⇒ Unit): String

    CharRef ::= "&#" '0'

  59. def xComment: NodeSeq

    Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'

  60. def xEQ: Unit

    scan [S] '=' [S]

  61. def xEndTag(n: String): Unit

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

  62. def xEntityValue(): String

    entity value, terminated by either ' or "

  63. def xHandleError(that: Char, msg: String): Unit

  64. def xName: String

    Name ::= (Letter | '_' | ':') (NameChar)*

  65. def xProcInstr: NodeSeq

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

  66. def xSpace: Unit

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

  67. def xSpaceOpt: Unit

    skip optional space S?

  68. def xText: String

    parse character data

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

  70. def xToken(that: Char): Unit

  71. def xmlProcInstr(): MetaData

    <? prolog ::= xml S