Trait

scala.xml.parsing

MarkupParser

Related Doc: package parsing

Permalink

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.

Self Type
MarkupParser with MarkupHandler
Version

1.0

Linear Supertypes
MarkupParserCommon, TokenTests, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MarkupParser
  2. MarkupParserCommon
  3. TokenTests
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type AttributesType = (MetaData, NamespaceBinding)

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  2. type ElementType = NodeSeq

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  3. type InputType = io.Source

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  4. type NamespaceType = NamespaceBinding

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  5. type PositionType = Int

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon

Abstract Value Members

  1. abstract def externalSource(systemLiteral: String): io.Source

    Permalink
  2. abstract val input: io.Source

    Permalink
  3. abstract val preserveWS: Boolean

    Permalink

    if true, does not remove surplus whitespace

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def appendText(pos: Int, ts: NodeBuffer, txt: String): Unit

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def attrDecl(): Unit

    Permalink

    <! attlist := ATTLIST
  7. val cbuf: collection.mutable.StringBuilder

    Permalink

    character buffer, for names

    character buffer, for names

    Attributes
    protected
  8. def ch: Char

    Permalink

    The library and compiler parsers had the interesting distinction of different behavior for nextch (a function for which there are a total of two plausible behaviors, so we know the design space was fully explored.) One of them returned the value of nextch before the increment and one of them the new value.

    The library and compiler parsers had the interesting distinction of different behavior for nextch (a function for which there are a total of two plausible behaviors, so we know the design space was fully explored.) One of them returned the value of nextch before the increment and one of them the new value. So to unify code we have to at least temporarily abstract over the nextchs.

    Definition Classes
    MarkupParser → MarkupParserCommon
  9. def ch_returning_nextch: Char

    Permalink
    Attributes
    protected
    Definition Classes
    MarkupParser → MarkupParserCommon
  10. def checkPubID(s: String): Boolean

    Permalink
    Definition Classes
    TokenTests
  11. def checkSysID(s: String): Boolean

    Permalink
    Definition Classes
    TokenTests
  12. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @throws( ... )
  13. def content(pscope: NamespaceBinding): NodeSeq

    Permalink

    content1 ::=  '<' content1 | '&' charref ...
  14. def content1(pscope: NamespaceBinding, ts: NodeBuffer): Unit

    Permalink

    '<' content1 ::=  ...
  15. var curInput: io.Source

    Permalink
    Attributes
    protected
  16. var doc: Document

    Permalink
    Attributes
    protected
  17. def document(): Document

    Permalink

    [22]     prolog      ::= XMLDecl? Misc* (doctypedecl Misc*)?
    [23]     XMLDecl     ::= ' VersionInfo EncodingDecl? SDDecl? S? '?>'
    [24]     VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"')
    [25]     Eq          ::= S? '=' S?
    [26]     VersionNum  ::= '1.0'
    [27]     Misc        ::= Comment | PI | S
  18. var dtd: DTD

    Permalink
  19. def element(pscope: NamespaceBinding): NodeSeq

    Permalink
  20. def element1(pscope: NamespaceBinding): NodeSeq

    Permalink

    '<' element ::= xmlTag1 '>'  { xmlExpr | '{' simpleExpr '}' } ETag
                 | xmlTag1 '/' '>'
  21. def elementDecl(): Unit

    Permalink

    <! element := ELEMENT

  22. def entityDecl(): Unit

    Permalink

    <! element := ELEMENT
  23. def eof: Boolean

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  24. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  26. def errorAndResult[T](msg: String, x: T): T

    Permalink
    Attributes
    protected
    Definition Classes
    MarkupParserCommon
  27. def errorNoEnd(tag: String): Nothing

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  28. var extIndex: Int

    Permalink
  29. def extSubset(): Unit

    Permalink
  30. def externalID(): ExternalID

    Permalink

    externalID ::= SYSTEM S syslit
                   PUBLIC S pubid S syslit
  31. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate()
  32. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate()
  33. def initialize: MarkupParser.this

    Permalink

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

  34. var inpStack: List[io.Source]

    Permalink

    stack of inputs

  35. def intSubset(): Unit

    Permalink

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

  36. def isAlpha(c: Char): Boolean

    Permalink

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

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

    Definition Classes
    TokenTests
  37. def isAlphaDigit(c: Char): Boolean

    Permalink
    Definition Classes
    TokenTests
  38. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  39. def isName(s: String): Boolean

    Permalink

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

    See [5] of XML 1.0 specification.

    Definition Classes
    TokenTests
  40. def isNameChar(ch: Char): Boolean

    Permalink

    NameChar ::= Letter | Digit | '.' | '-' | '_' | ':'
               | CombiningChar | Extender

    See [4] and Appendix B of XML 1.0 specification.

    Definition Classes
    TokenTests
  41. def isNameStart(ch: Char): Boolean

    Permalink

    NameStart ::= ( Letter | '_' )

    where Letter means in one of the Unicode general categories { Ll, Lu, Lo, Lt, Nl }.

    We do not allow a name to start with :. See [3] and Appendix B of XML 1.0 specification

    Definition Classes
    TokenTests
  42. def isPubIDChar(ch: Char): Boolean

    Permalink
    Definition Classes
    TokenTests
  43. final def isSpace(cs: Seq[Char]): Boolean

    Permalink

    (#x20 | #x9 | #xD | #xA)+
    Definition Classes
    TokenTests
  44. final def isSpace(ch: Char): Boolean

    Permalink

    (#x20 | #x9 | #xD | #xA)
    Definition Classes
    TokenTests
  45. def isValidIANAEncoding(ianaEncoding: Seq[Char]): Boolean

    Permalink

    Returns true if the encoding name is a valid IANA encoding.

    Returns true if the encoding name is a valid IANA encoding. This method does not verify that there is a decoder available for this encoding, only that the characters are valid for an IANA encoding name.

    ianaEncoding

    The IANA encoding name.

    Definition Classes
    TokenTests
  46. var lastChRead: Char

    Permalink
  47. def lookahead(): BufferedIterator[Char]

    Permalink

    Create a lookahead reader which does not influence the input

    Create a lookahead reader which does not influence the input

    Definition Classes
    MarkupParser → MarkupParserCommon
  48. def markupDecl(): Unit

    Permalink
  49. def markupDecl1(): Any

    Permalink
  50. def mkAttributes(name: String, pscope: NamespaceBinding): (MarkupParser.this)#AttributesType

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  51. def mkProcInstr(position: Int, name: String, text: String): (MarkupParser.this)#ElementType

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  52. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  53. var nextChNeeded: Boolean

    Permalink

    holds the next character

  54. def nextch(): Unit

    Permalink

    this method tells ch to get the next character when next called

    this method tells ch to get the next character when next called

    Definition Classes
    MarkupParser → MarkupParserCommon
  55. def notationDecl(): Unit

    Permalink

    'N' notationDecl ::= "OTATION"
  56. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate()
  57. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate()
  58. def parseDTD(): Unit

    Permalink

    parses document type declaration and assigns it to instance variable dtd.

    parses document type declaration and assigns it to instance variable dtd.

    <! parseDTD ::= DOCTYPE name ... >
  59. def pop(): Unit

    Permalink
  60. var pos: Int

    Permalink

    holds the position in the source file

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

    Permalink

    <? prolog ::= xml S?
    // this is a bit more lenient than necessary...
  62. def pubidLiteral(): String

    Permalink

    [12]       PubidLiteral ::=        '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  63. def push(entityName: String): Unit

    Permalink
  64. def pushExternal(systemId: String): Unit

    Permalink
  65. def putChar(c: Char): collection.mutable.StringBuilder

    Permalink

    append Unicode character to name buffer

    append Unicode character to name buffer

    Attributes
    protected
  66. var reachedEof: Boolean

    Permalink
  67. def reportSyntaxError(str: String): Unit

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  68. def reportSyntaxError(pos: Int, str: String): Unit

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  69. def reportValidationError(pos: Int, str: String): Unit

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

    Permalink

    Apply a function and return the passed value

    Apply a function and return the passed value

    Definition Classes
    MarkupParserCommon
  71. def saving[A, B](getter: A, setter: (A) ⇒ Unit)(body: ⇒ B): B

    Permalink

    Execute body with a variable saved and restored after execution

    Execute body with a variable saved and restored after execution

    Definition Classes
    MarkupParserCommon
  72. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  73. def systemLiteral(): String

    Permalink

    attribute value, terminated by either ' or ".

    attribute value, terminated by either ' or ". value may not contain <.

    AttValue     ::= `'` { _ } `'`
                   | `"` { _ } `"`
  74. def textDecl(): (Option[String], Option[String])

    Permalink

    prolog, but without standalone

  75. var tmppos: Int

    Permalink

    holds temporary values of pos

    holds temporary values of pos

    Definition Classes
    MarkupParser → MarkupParserCommon
  76. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  77. def truncatedError(msg: String): Nothing

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  78. def unreachable: Nothing

    Permalink
    Attributes
    protected
    Definition Classes
    MarkupParserCommon
  79. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  80. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  81. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  82. def xAttributeValue(): String

    Permalink
    Definition Classes
    MarkupParserCommon
  83. def xAttributeValue(endCh: Char): String

    Permalink

    attribute value, terminated by either ' or ".

    attribute value, terminated by either ' or ". value may not contain <.

    endCh

    either ' or "

    Definition Classes
    MarkupParserCommon
  84. def xAttributes(pscope: NamespaceBinding): (MetaData, NamespaceBinding)

    Permalink

    parse attribute and create namespace scope, metadata

    parse attribute and create namespace scope, metadata

    [41] Attributes    ::= { S Name Eq AttValue }
  85. def xCharData: NodeSeq

    Permalink

    '<! CharData ::= [CDATA[ ( {char} - {char}"]]>"{char} ) ']]>'
    
    see [15]
  86. def xCharRef: String

    Permalink
    Definition Classes
    MarkupParserCommon
  87. def xCharRef(it: Iterator[Char]): String

    Permalink
    Definition Classes
    MarkupParserCommon
  88. def xCharRef(ch: () ⇒ Char, nextch: () ⇒ Unit): String

    Permalink

    CharRef ::= "&#" '0'..'9' {'0'..'9'} ";" | "&#x" '0'..'9'|'A'..'F'|'a'..'f' { hexdigit } ";"

    CharRef ::= "&#" '0'..'9' {'0'..'9'} ";" | "&#x" '0'..'9'|'A'..'F'|'a'..'f' { hexdigit } ";"

    see [66]

    Definition Classes
    MarkupParserCommon
  89. def xComment: NodeSeq

    Permalink

     Comment ::= ''
    
    see [15]
  90. def xEQ(): Unit

    Permalink

    scan [S] '=' [S]

    scan [S] '=' [S]

    Definition Classes
    MarkupParserCommon
  91. def xEndTag(startName: String): Unit

    Permalink

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

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

    Definition Classes
    MarkupParserCommon
  92. def xEntityValue(): String

    Permalink

    entity value, terminated by either ' or ".

    entity value, terminated by either ' or ". value may not contain <.

    AttValue     ::= `'` { _  } `'`
                   | `"` { _ } `"`
  93. def xHandleError(that: Char, msg: String): Unit

    Permalink
    Definition Classes
    MarkupParser → MarkupParserCommon
  94. def xName: String

    Permalink

    actually, Name ::= (Letter | '_' | ':') (NameChar)* but starting with ':' cannot happen Name ::= (Letter | '_') (NameChar)*

    actually, Name ::= (Letter | '_' | ':') (NameChar)* but starting with ':' cannot happen Name ::= (Letter | '_') (NameChar)*

    see [5] of XML 1.0 specification

    pre-condition: ch != ':' // assured by definition of XMLSTART token post-condition: name does neither start, nor end in ':'

    Definition Classes
    MarkupParserCommon
  95. def xProcInstr: (MarkupParser.this)#ElementType

    Permalink

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

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

    see [15]

    Definition Classes
    MarkupParserCommon
  96. def xSpace(): Unit

    Permalink

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

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

    Definition Classes
    MarkupParserCommon
  97. def xSpaceOpt(): Unit

    Permalink

    skip optional space S?

    skip optional space S?

    Definition Classes
    MarkupParserCommon
  98. def xTag(pscope: (MarkupParser.this)#NamespaceType): (String, (MarkupParser.this)#AttributesType)

    Permalink

    parse a start or empty tag.

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

    Attributes
    protected
    Definition Classes
    MarkupParserCommon
  99. def xTakeUntil[T](handler: ((MarkupParser.this)#PositionType, String) ⇒ T, positioner: () ⇒ (MarkupParser.this)#PositionType, until: String): T

    Permalink

    Take characters from input stream until given String "until" is seen.

    Take characters from input stream until given String "until" is seen. Once seen, the accumulated characters are passed along with the current Position to the supplied handler function.

    Attributes
    protected
    Definition Classes
    MarkupParserCommon
  100. def xToken(that: Seq[Char]): Unit

    Permalink
    Definition Classes
    MarkupParserCommon
  101. def xToken(that: Char): Unit

    Permalink
    Definition Classes
    MarkupParserCommon
  102. def xmlProcInstr(): MetaData

    Permalink

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

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from MarkupParserCommon

Inherited from TokenTests

Inherited from AnyRef

Inherited from Any

Ungrouped