moonbitstack/moonxml/event does not have a README file

    Sink

    pub(open) trait Sink {
    fn push(Self, event : Event) -> Unit
    }

    Where events go. The tree builder is one implementation; a caller counting tags or writing rows to a database is another, and it never builds a tree.

    Event

    pub(all) enum Event {
    StartTag(name~ : String, attrs~ : Array[(String, String)], self_closing~ : Bool)
    EndTag(name~ : String)
    Text(text~ : String)
    CData(text~ : String)
    Comment(text~ : String)
    ProcessingInstruction(target~ : String, data~ : String)
    Doctype(text~ : String)
    }

    One event of a document being read: a tag opening, a run of text, a comment. libexpat's second reading of a document, in one type.

    @xml.scan and @html.scan stream these; Document::events reads a finished tree back as the same stream. HTML's stream is its tokenizer's: the tree construction that follows needs to see the tree it is building, so a document's events describe a tree that already exists.

    Source Files