#lang scheme/base
(require scheme/serialize
"../base.ss"
"../javascript/struct.ss"
(prefix-in plain: "../plain/render.ss"))
(define-struct xml () #:prefab)
(define-struct (atom xml) (data) #:prefab)
(define-struct (block xml) (children) #:prefab)
(define-struct (entity xml) (code) #:prefab)
(define-struct (comment xml) (data) #:prefab)
(define-struct (cdata xml) (data) #:prefab)
(define-struct (pi xml) (data) #:prefab)
(define-struct (raw xml) (data) #:prefab)
(define-struct (element xml) (tag attributes child) #:prefab)
(define-struct attribute (name value) #:prefab)
(define (quotable-value? val)
(or (plain:quotable-value? val)
(javascript? val)))
(provide quotable-value?)
(provide/contract
[struct xml ()]
[struct (block xml) ([children (listof xml?)])]
[struct (element xml) ([tag symbol?] [attributes (listof attribute?)] [child xml?])]
[struct (entity xml) ([code (or/c symbol? integer?)])]
[struct (comment xml) ([data (listof quotable-value?)])]
[struct (cdata xml) ([data (listof quotable-value?)])]
[struct (pi xml) ([data (listof quotable-value?)])]
[struct (raw xml) ([data (listof quotable-value?)])]
[struct (atom xml) ([data quotable-value?])]
[struct attribute ([name symbol?] [value (or/c atom? raw?)])])