Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'        Annotated program -- Keyboard shortcut: 't'    course-homepage-mirror.scm - The mirror in Scheme of the course home page.Lecture 6 - slide 14 : 22
Program 4

; This file is generated by an LAML script based on the LAML tool tools/xml-in-laml/xml-in-laml.scm. DO NOT EDIT!

;;; Loading the XML-in-LAML stuff common for all languages:
(load (string-append laml-dir "lib/xml-in-laml/xml-in-laml.scm"))

(define course-homepage-xml-transliterate-character-data? #t)
(define course-homepage-xml-char-transformation-table html-char-transformation-table)
(define course-homepage-xml-non-transliteration-elements '())
(define course-homepage-xml-preformatted-text-elements '())
(define course-homepage-xml-pass-default-dtd-attributes? #f)
(define course-homepage-xml-accept-only-string-valued-attributes? #t)
(define course-homepage-xml-accept-extended-contents? #f)
(define course-homepage-xml-document-type-declaration "")
(define course-homepage-xml-represent-white-space? #f)


; Empty temporary language map
(set! temp-language-map (quote ()))



;;; The validation procedures

(define (course-home-page-course-homepage-laml-validate! el-name attributes contents overlap-check?) (let ((attributes-of-elements (quote (("name" "CDATA" "#REQUIRED") ("number-of-lectures" "CDATA" "#REQUIRED") ("current-lecture" "CDATA" "#IMPLIED")))) (req-n 2) (dfa (quote (finite-state-automaton 0 (3) #((0 b 1) (1 c 2) (2 d 3)) #((lecture-names  . b) (links  . c) (terminator$$  . d)))))) (if (and overlap-check? xml-check-language-overlap?) (check-language-overlap! (as-symbol "course-home-page"))) (if xml-check-attributes? (xml-check-attributes! attributes attributes-of-elements req-n "course-home-page")) (if xml-validate-contents? (validate-contents-by-dfa! contents dfa "course-home-page"))))

(define (lecture-names-course-homepage-laml-validate! el-name attributes contents overlap-check?) (let ((attributes-of-elements (quote ())) (req-n 0) (dfa (quote (finite-state-automaton 0 (3) #((0 b 1) (1 b 2) (1 c 3) (2 b 2) (2 c 3)) #((lecture-name  . b) (terminator$$  . c)))))) (if (and overlap-check? xml-check-language-overlap?) (check-language-overlap! (as-symbol "lecture-names"))) (if xml-check-attributes? (xml-check-attributes! attributes attributes-of-elements req-n "lecture-names")) (if xml-validate-contents? (validate-contents-by-dfa! contents dfa "lecture-names"))))

(define (lecture-name-course-homepage-laml-validate! el-name attributes contents overlap-check?) (let ((attributes-of-elements (quote ())) (req-n 0)) (if (and overlap-check? xml-check-language-overlap?) (check-language-overlap! (as-symbol "lecture-name"))) (if xml-check-attributes? (xml-check-attributes! attributes attributes-of-elements req-n "lecture-name")) (if xml-validate-contents? (validate-as-pcdata! contents "lecture-name"))))

(define (links-course-homepage-laml-validate! el-name attributes contents overlap-check?) (let ((attributes-of-elements (quote ())) (req-n 0) (dfa (quote (finite-state-automaton 0 (2) #((0 b 1) (0 c 2) (1 b 1) (1 c 2)) #((link  . b) (terminator$$  . c)))))) (if (and overlap-check? xml-check-language-overlap?) (check-language-overlap! (as-symbol "links"))) (if xml-check-attributes? (xml-check-attributes! attributes attributes-of-elements req-n "links")) (if xml-validate-contents? (validate-contents-by-dfa! contents dfa "links"))))

(define (link-course-homepage-laml-validate! el-name attributes contents overlap-check?) (let ((attributes-of-elements (quote (("href" "CDATA" "#REQUIRED")))) (req-n 1)) (if (and overlap-check? xml-check-language-overlap?) (check-language-overlap! (as-symbol "link"))) (if xml-check-attributes? (xml-check-attributes! attributes attributes-of-elements req-n "link")) (if xml-validate-contents? (validate-as-pcdata! contents "link"))))

;;; Make and put XML mirror functions in the temporary language map:
(set! temp-mirror-function (generate-xml-mirror-function course-home-page-course-homepage-laml-validate! "course-home-page" (quote ()) (quote double) (quote course-homepage) #f #f))
(set! temp-language-map (put-mirror-function temp-language-map "course-home-page" temp-mirror-function))
(set! temp-mirror-function (generate-xml-mirror-function course-home-page-course-homepage-laml-validate! "course-home-page" (quote ()) (quote double) (quote course-homepage) #t course-home-page!))
(define course-home-page temp-mirror-function)

(set! temp-mirror-function (generate-xml-mirror-function lecture-names-course-homepage-laml-validate! "lecture-names" (quote ()) (quote double) (quote course-homepage) #f #f))
(set! temp-language-map (put-mirror-function temp-language-map "lecture-names" temp-mirror-function))
(set! temp-mirror-function (generate-xml-mirror-function lecture-names-course-homepage-laml-validate! "lecture-names" (quote ()) (quote double) (quote course-homepage) #t #f))
(define lecture-names temp-mirror-function)

(set! temp-mirror-function (generate-xml-mirror-function lecture-name-course-homepage-laml-validate! "lecture-name" (quote ()) (quote double) (quote course-homepage) #f #f))
(set! temp-language-map (put-mirror-function temp-language-map "lecture-name" temp-mirror-function))
(set! temp-mirror-function (generate-xml-mirror-function lecture-name-course-homepage-laml-validate! "lecture-name" (quote ()) (quote double) (quote course-homepage) #t #f))
(define lecture-name temp-mirror-function)

(set! temp-mirror-function (generate-xml-mirror-function links-course-homepage-laml-validate! "links" (quote ()) (quote double) (quote course-homepage) #f #f))
(set! temp-language-map (put-mirror-function temp-language-map "links" temp-mirror-function))
(set! temp-mirror-function (generate-xml-mirror-function links-course-homepage-laml-validate! "links" (quote ()) (quote double) (quote course-homepage) #t #f))
(define links temp-mirror-function)

(set! temp-mirror-function (generate-xml-mirror-function link-course-homepage-laml-validate! "link" (quote ()) (quote double) (quote course-homepage) #f #f))
(set! temp-language-map (put-mirror-function temp-language-map "link" temp-mirror-function))
(set! temp-mirror-function (generate-xml-mirror-function link-course-homepage-laml-validate! "link" (quote ()) (quote double) (quote course-homepage) #t #f))
(define link temp-mirror-function)

; Register the name of the language:
(register-xml-in-laml-language (quote course-homepage) temp-language-map)

; Define the language variable
(define course-homepage (activator-via-language-map (quote course-homepage)))

; Register the XML navigator of the language:
(register-xml-in-laml-navigator (quote course-homepage) (quote (xml-navigator #((course-home-page #(course-home-page lecture-name lecture-names link links) #(current-lecture href name number-of-lectures)) (lecture-name #(lecture-name) #()) (lecture-names #(lecture-name lecture-names) #()) (link #(link) #(href)) (links #(link links) #(href))))))