Moscrif API Docs for: 2012q3
Show:

XMLScanner Class

Library: core

XMLScanner - XML/HTML tokenzier. Also known as XML push parser.

Methods

this

(
  • input
)
XMLScanner

Creates new instance of XMLScanner class, and load xml file into it.

Parameters:

Returns:

XMLScanner: New instance of XMLScanner

stepBack

() Integer

Pushes back current token so next invocation of token() will return it.

Returns:

token

() Integer

Returns one of constants above. Use them in fully qualified form, e.g. XMLScanner.HEAD, XMLScanner.TAIL, etc.

Returns:

Integer: One of XMLScanner's constants.

Properties

ATTR

Integer final

Attribute can be with or without (html style) value. scanner.attribute is the name of attribute and scanner.value - is a value of attribute. Attribute parsed.

Example:

<tag attr="value" >
_______________^-- happens here

attribute

String

Name of the attribute. Valid if token == XMLScanner.ATTR.

CDATA

Integer final

CData parsed.

Example:

    <![CDATA[ ...value... ]]>
    __________________^-- happens here

DOCTYPE

Integer final

Scanner.value contains text of the doctype declaration: characters after

Example:

    <!DOCTYPE ...value... >
    ___________________^-- happens here

EMPTY_HEAD_END

Integer final

End of head of empty element parsed

Example:

    <tag ... />
    _____^-- happens here

EOF

Integer final

End of stream reached.

ERROR

Integer final

Error in markup of input stream

HEAD

Integer final

Head of the element parsed.

Example:

<tag ...
^-- happens here

HEAD_END

Integer final

End of head of non-empty element parsed.

Example:

    <tag ...
    ____^-- happens here

lineNo

Integer

Reports current line number in input stream

PI

Integer final

Processing instruction parsed.

Example:

    <? ...value... ?>
    ___________^-- happens here

tag

String

Name of the tag. Valid if token is XMLScanner.HEAD, XMLScanner.TAIL or XMLScanner.HEAD_END.

TAIL

Integer final

Tail of the non-empty element parsed

Example:

    <tag ... />
    ^-- happens here

value

String

Text of attribute value, text, cdata or pi.

WORD

Integer final

Space sequence parsed.