Bigloo

23. Bigloo The Programming Language (4.5a) User manual for version 4.5a December 2022 -- Web

main page
top: | Bigloo The Programming Language (4.5a) User manual for version 4.5a December 2022
Web
Chapters
| This chapter describes the Bigloo API for Web programming.
### 23.1 Overview
The Bigloo web library supports tools helping Web programming. It contains XML, JSON, and CSS parsers, WebDAV tools, and function for handling the web formats of dates.
### 23.2 XML
xml-parse input-port #!key (content-length 0) (make-element (lambda (tag attr body start-pos) (list tag attr body))) (make-comment (lambda (str pos) str)) (make-declaration (lambda (str pos) (cons 'declaration str))) (make-cdata (lambda (str pos) (cons 'cdata str))) (make-xml-declaration (lambda (attr pos) (cons 'xml-decl attr))) (make-instruction (lambda (str pos) (cons 'instruction str))) (specials '()) (strict #t) (encoding 'UTF-8) (eoi #f) | bigloo procedure
Parses an XML documention. The arguments are: `input-port` the input port containing the document to be parsed. `content-length` if > 0, the number of characters to parse. `procedure` element constructor for backward compatibility. A function of 3 arguments: tag, attributes, children. `make-element` the element constructor. A function of 4 arguments: tag, attributes, children, start position. `make-comment` the comment constructor. A function of 2 arguments: the comment and the start position. `make-declaration` the declaration constructor. A function of 2 arguments: the declaration and the start position. `make-cdata` the cdata constructor. A function of 2 arguments: the cdata and the start position. `make-xml-declaration` the xml declaration constructor. A function of 2 arguments: the xml-declaration and the start position. `make-instruction` the instruction constructor. A function of 2 arguments: the instruction and the start position. `specials` an alist `(tag . parse)` of tags to be parsed using special parsers. This can be used to parse elements (e.g., HTML elements) that do not comply with strict syntax, for instance because they do not accept closing tags. `strict` a boolean, require strict xml syntax conformance. `encoding` a string, characters encoding. `eoi` an optional predicat that is true on end-of-input.
html-parse input-port #!key (content-length 0) (procedure list) (encoding 'UTF-8) (eoi #f) | bigloo procedure
Parse an HTML document. The optional arguments are: `input-port` the input port containing the document to be parsed. `content-length` if > 0, the number of characters to parse. `procedure` the function invoked to construct elements. `encoding` characters encoding. `eoi` an optional predicat that is true on end-of-input. This function is mere wrapper of `xml-parse`.
unhtml-port input-port output-port #!key table | bigloo procedure
Removes tags from `input-port` and write the result to `output-port`. If provided, `table` must a hashtable associating HTML escape sequences (e.g., "&amp;") to strings used in the replacement.
unhtml str::bstring #!optional table | bigloo procedure
Removes HTML tags from the string `str`.
xml-string-decode str | bigloo procedure
xml-string-decode! str | bigloo procedure
xml-string-encode str | bigloo procedure
Decode/encode XML strings.
    (xml-string-decode "foo&gt;bar&#032;gee") =>  "foo>bar gee"
html-string-decode str | bigloo procedure
html-string-encode str | bigloo procedure
Decode/encode HTML strings.
    (xml-string-decode "foo&amp;bar&#quot;gee") =>  "foo&bar\"gee"
### 23.3 WebDAV
This section describes the functions that may help implementing WebDAV servers and clients.
&webdav-access-control-exception::&access-control-exception | class
The class used to raised access denied. It contains one field: `header`
webdav-directory->list url #!key (timeout 0) (proxy #f) | bigloo procedure
webdav-directory->path-list url #!key (timeout 0) (proxy #f) | bigloo procedure
The list of files, respec. urls, in the directory `url`.
webdav-directory->prop-list url #!key (timeout 0) (proxy #f) | bigloo procedure
The list of properties of a WebDAV repository.
webdav-file-exists? url #!key (timeout 0) (proxy #f) | bigloo procedure
Return `#t` if and only if `url` exists, returns `#f` otherwise.
webdav-directory? url #!key (timeout 0) (proxy #f) | bigloo procedure
Return `#t` if and only if `url` is a directory, returns `#f` otherwise.
webdav-file-modification-time url #!key (timeout 0) (proxy #f) | bigloo procedure
The last modification time of `url`.
webdav-file-size url #!key (timeout 0) (proxy #f) | bigloo procedure
The file size.
webdav-delete-file url #!key (timeout 0) (proxy #f) | bigloo procedure
webdav-delete-directory url #!key (timeout 0) (proxy #f) | bigloo procedure
Delete a file, respec. a directory.
webdav-make-directory url #!key (timeout 0) (proxy #f) | bigloo procedure
webdav-make-directories url #!key (timeout 0) (proxy #f) | bigloo procedure
Create a directory, respec. a directory hierarchy.
webdav-rename-file url dst #!key (timeout 0) (proxy #f) | bigloo procedure
webdav-cop-file url dst #!key (timeout 0) (proxy #f) | bigloo procedure
Rename, respec. copy, a WebDAV file.
webdav-put-file url obj #!key (timeout 0) (proxy #f) | bigloo procedure
Create a WebDAV file at `url` whose content is `obj`.
### 23.4 CSS
CSS files and rules are internally represented as an abstract syntax tree defined by the `css` class hierarchy given belown. The type of fields whose names end with `*` is `pair-nil`. The type of fields whose names end with `+` is `pair`.
css-url value::bstring | class
css-ext value::bstring | class
css-stylesheed charset comment* import* rule*-nil | class
css-charset charset::bstring spec::bstring | class
css-comment cdo::bstring cdc::bstring content | class
css-import value medium* | class
css-media medium+ ruleset* | class
css-media-query operator type::bstring expr* | class
css-page ident pseudopage declaration* | class
css-fontface declaration* | class
css-keyframes operator::bstring ident::bstring keyframe* | class
css-pseudopage ident | class
css-ruleset stamp::int specificity selector+ declaration* | class
css-keyframe selector declaration* | class
css-selector element attr* | class
css-selector-class name | class
css-selector-hash name | class
css-selector-name name | class
css-selector-attr ident op arg | class
css-selector-pseudo expr fun | class
css-declaration proprety expr prio | class
css-function fun expr | class
css-hash-color value::bstring | class
css-write ast o::output-port | bigloo procedure
Output a CSS AST into a CSS document.
css->ast::css-stylesheet i::input-port #!key extension eoff | bigloo procedure
Parses a CSS document.
### 23.5 Date
w3c-datetime-timestamp | bigloo procedure
Returns the current date as a w3c datetime.
w3c-datetime->date | bigloo procedure
date->w3c-datetime | bigloo procedure
Convert from and to Bigloo Dates and W3C dates.
### 23.6 JSON
json-parse i::input-port #!key array-alloc array-set array-return object-alloc object-set object-return parse-error (undefined #t) reviver expr constant-alloc string-alloc | bigloo procedure
Parses a JSON document. The keywored arguments are: `array-alloc` a function of 0 argument invoked when parsing an array. `array-set` a function of 3 arguments invoked after each array element is parsed. The first argument is the result of the last `array-alloc` call. The second argument is the index, and the last, the element value. `array-return` a function of two arguments, the allocated array and the length. `object-alloc` a function of 0 argument. `object-set` a function of 3 arguments. `object-return` a function of 1 argument. `parse-error` a function of 3 arguments. `undefined` the value used to represent `undefined`. `constant-alloc` a function of one argument, the parsed contant. `string-alloc` a function of one argument, the parsed string. `reviver` either `#f` or a function of three arguments, invoked after parsing an object property. `expr` if false, check end-of-file after parsing the last JSON value.

This Html page has been produced by Skribe.
Last update Fri Dec 30 07:57:00 2022.