#lang scheme (include "html-parser.scm") (define make-parser make-html-parser) (define test-doc "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> <!ELEMENT feeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>") (define (test) (call-with-input-string test-doc (λ (in) (html->sxml in)))) (define-struct (exn:parse exn:fail) ()) (define (raise-parse-error msg) (raise (make-exn:parse msg (current-continuation-marks)))) (provide/contract [make-parser (->* () () #:rest list? (->* (any/c) (input-port?) any))] [html->sxml (-> input-port? list?)] [sxml->html (-> list? string?)] [sxml-display-as-html (->* (list?) (output-port?) void?)] [raise-parse-error (-> string? any)] [exn:parse? (-> exn:fail? boolean?)]) (provide *default-entities*)