Class HTML5::HTMLInputStream
In: lib/html5/inputstream.rb
Parent: Object

This class takes care of character encoding and removing or replacing incorrect byte-sequences and also provides column and line tracking.

Methods

Attributes

char_encoding  [RW] 
errors  [RW] 
queue  [RW] 

Public Class methods

Initialises the HTMLInputStream.

HTMLInputStream(source, [encoding]) -> Normalized stream from source for use by the HTML5Lib.

source can be either a file-object, local filename or a string.

The optional encoding parameter must be a string that indicates the encoding. If specified, that encoding will be used, regardless of any BOM or later declaration (such as in a meta element)

parseMeta - Look for a <meta> element containing encoding information

Public Instance methods

Read one character from the stream or queue if available. Return EOF when EOF is reached.

Returns a string of characters from the stream up to but not including any character in characters or EOF. characters can be any container that supports the in method being called on it.

Attempts to detect at BOM at the start of the stream. If an encoding can be determined from the BOM return the name of the encoding otherwise return nil

Report the encoding declared by the meta element

Produces a file object from source.

source can be either a file object, local filename or a string.

Returns (line, col) of the current position in the stream.

[Validate]