#lang racket/base (require racket/include (except-in racket/port call-with-output-string) racket/contract) (include "html-parser.notscheme") (define make-parser make-html-parser) (define test-doc "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE greeting [\n <!ELEMENT greeting (#PCDATA)>\n <!ELEMENT feeting (#PCDATA)>\n]>\n<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*)