dom/event
src/dom/event.tur
the SAX event vocabulary shared by tur-xml and tur-html.
Since: 0.1.0
defstruct
Attr
(defstruct Attr :copy [name : String value : String])
one attribute of a StartElement event: name and value.
defn
sax-event-release
(sax-event-release [ev : SaxEvent] :)
release every String an event owns.
Parameters
| ev | the event, not used afterwards |
Example
(sax-event-release ev)
Since: 0.1.0
defn
sax-event-retain
(sax-event-retain [ev : SaxEvent] :)
take a reference to every String an event holds.
Parameters
| ev | the event |
Returns
SaxEvent -- ev itself, now holding one more reference to each String.
Example
(f (sax-event-retain ev)) ; ... later (sax-event-release ev)
Since: 0.2.0
defn
sax-dispatch
(sax-dispatch [h : (fn [SaxEvent])
call a handler with an event: `(h ev)`.
Parameters
| h | the handler | |
| ev | the event (borrowed by the handler) |
Returns
SaxControl -- whatever the handler returned.
Example
(sax-dispatch h (StartCdata)) ; => (Continue)
Since: 0.1.0
defn
attrs-get
(attrs-get [xs : (Cons Attr) name : cstr] :)
the value of the attribute named `name`, if present.
Parameters
| xs | the attribute list of a StartElement event | |
| name | the attribute name (Clark form for a namespaced attribute) |
Returns
(Option String) -- borrowed from the event, like the list itself.
Example
(StartElement n as) (match (attrs-get as "href") (Some h) ... (None) ...)
Since: 0.1.0
Internal definitions
__release-attrs-- internal: release every String of an attribute list.__retain-attrs-- internal: retain every String of an attribute list.