Constants
return values of token() method |
| ERROR |
- error in markup of input stream |
| EOF |
- end of stream reached |
| HEAD |
- head of the element parsed:
<tag ... ^-- happens here |
| HEAD_END |
- end of head of non-empty element parsed:
<tag ... > ^-- happens here |
| EMPTY_HEAD_END |
- end of head of empty element parsed:
<tag ... /> ^-- happens here |
| TAIL |
- tail of the non-empty element parsed:
</tag> ^-- happens here |
| ATTR |
- attribute parsed:
<tag attr="value" >
^-- happens here
Attribute can be with or without (html style) value. scanner.attribute is the name of attribute and scanner.value - is a value of attribute. |
| WORD |
- sequence of non-space characters parsed.
scanner.value contains the text. |
| SPACE |
- space sequence parsed.
scanner.value contains the sequence of space characters. |
| CDATA |
- cdata parsed:
<![CDATA[ ...value... ]]> ^-- happens here
scanner.value contains text of the cdata. |
| PI |
- processing instruction parsed:
<? ...value... ?> ^-- happens here
scanner.value contains text of the instruction. |
| DOCTYPE |
- doctype declaration parsed:
<!DOCTYPE ...value... > ^-- happens here
scanner.value contains text of the doctype declaration: characters after <!DOCTYPE and before closing '>' |
Properties |
| value |
- string, text of attribute value, text, cdata or pi. |
| attribute |
- string, name of the attribute. Valid if token == XMLScanner.ATTR |
| tag |
- string, name of the tag. Valid if token is XMLScanner.HEAD, XMLScanner.TAIL or XMLScanner.HEAD_END. |
| lineNo |
- integer, read-only, reports current line number in input stream. |
Methods |
| this |
( input: Stream )
Constructor, used as new XMLScanner(stream). Takes input stream as first parameter. |
| token |
( ) returns: int
Returns one of constants above. Use them in fully qualified form, e.g. XMLScanner.HEAD, XMLScanner.TAIL, etc. |
| stepBack |
( )
pushes back current token so next invocation of token() will return it. |