This chapter describes the Bigloo API for Web programming.
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.
 
| 
Parses an XML documention. The arguments are:| 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 |  
 
 input-portthe input port containing the document to be parsed.content-lengthif > 0, the number of characters to parse.procedureelement constructor for backward compatibility.
A function of 3 arguments: tag, attributes, children.make-elementthe element constructor.
A function of 4 arguments: tag, attributes, children, start position.make-commentthe comment constructor.
A function of 2 arguments: the comment and the start position.make-declarationthe declaration constructor.
A function of 2 arguments: the declaration and the start position.make-cdatathe cdata constructor.
A function of 2 arguments: the cdata and the start position.make-xml-declarationthe xml declaration constructor.
A function of 2 arguments: the xml-declaration and the start position.make-instructionthe instruction constructor.
A function of 2 arguments: the instruction and the start position.specialsan 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.stricta boolean, require strict xml syntax conformance.encodinga string, characters encoding.eoian optional predicat that is true on end-of-input.
 | 
| 
Parse an HTML document. The optional arguments are:| html-parse input-port #!key (content-length 0) (procedure list) (encoding 'UTF-8) (eoi #f) | bigloo procedure |  
 
 This function is mere wrapper ofinput-portthe input port containing the document to be parsed.content-lengthif > 0, the number of characters to parse.procedurethe function invoked to construct elements.encodingcharacters encoding.eoian optional predicat that is true on end-of-input.
 xml-parse. | 
| 
Removes tags from| unhtml-port input-port output-port #!key table | bigloo procedure |  input-portand write the result tooutput-port.
If provided,tablemust a hashtable associating HTML escape
sequences (e.g., "&") to strings used in the replacement. | 
| 
Removes HTML tags from the string| unhtml str::bstring #!optional table | bigloo procedure |  str. | 
| 
| xml-string-decode str | bigloo procedure |  
| xml-string-decode! str | bigloo procedure |  
Decode/encode XML strings.| xml-string-encode str | bigloo procedure |  
 
 
| (xml-string-decode "foo>bar gee") =>  "foo>bar gee"
 |  | 
| 
| html-string-decode str | bigloo procedure |  
Decode/encode HTML strings.| html-string-encode str | bigloo procedure |  
 
 
| (xml-string-decode "foo&bar&#quot;gee") =>  "foo&bar\"gee"
 |  | 
 
This section describes the functions that may help implementing WebDAV
servers and clients.
| 
The class used to raised access denied. It contains one field:| &webdav-access-control-exception::&access-control-exception | class |  
 
 | 
| 
| webdav-directory->list url #!key (timeout 0) (proxy #f) | bigloo procedure |  
The list of files, respec. urls, in the directory| webdav-directory->path-list url #!key (timeout 0) (proxy #f) | bigloo procedure |  url. | 
| 
The list of properties of a WebDAV repository.| webdav-directory->prop-list url #!key (timeout 0) (proxy #f) | bigloo procedure |  | 
| 
Return| webdav-file-exists? url #!key (timeout 0) (proxy #f) | bigloo procedure |  #tif and only ifurlexists, returns#fotherwise. | 
| 
Return| webdav-directory? url #!key (timeout 0) (proxy #f) | bigloo procedure |  #tif and only ifurlis a directory, returns#fotherwise. | 
| 
The last modification time of| webdav-file-modification-time url #!key (timeout 0) (proxy #f) | bigloo procedure |  url. | 
| 
The file size.| webdav-file-size url #!key (timeout 0) (proxy #f) | bigloo procedure |  | 
| 
| webdav-delete-file url #!key (timeout 0) (proxy #f) | bigloo procedure |  
Delete a file, respec. a directory.| webdav-delete-directory url #!key (timeout 0) (proxy #f) | bigloo procedure |  | 
| 
| webdav-make-directory url #!key (timeout 0) (proxy #f) | bigloo procedure |  
Create a directory, respec. a directory hierarchy.| webdav-make-directories url #!key (timeout 0) (proxy #f) | bigloo procedure |  | 
| 
| webdav-rename-file url dst #!key (timeout 0) (proxy #f) | bigloo procedure |  
Rename, respec. copy, a WebDAV file.| webdav-cop-file url dst #!key (timeout 0) (proxy #f) | bigloo procedure |  | 
| 
Create a WebDAV file at| webdav-put-file url obj #!key (timeout 0) (proxy #f) | bigloo procedure |  urlwhose content isobj. | 
 
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 |  | 
| 
Output a CSS AST into a CSS document.| css-write ast o::output-port | bigloo procedure |  | 
| 
Parses a CSS document.| css->ast::css-stylesheet i::input-port #!key extension eoff | bigloo procedure |  | 
 
| 
Returns the current date as a w3c datetime.| w3c-datetime-timestamp | bigloo procedure |  | 
| 
| w3c-datetime->date | bigloo procedure |  
Convert from and to Bigloo Dates and W3C dates.| date->w3c-datetime | bigloo procedure |  | 
 
| 
Parses a JSON document. The keywored arguments are:| 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 |  
 
 array-alloca function of 0 argument invoked when parsing an array.array-seta function of 3 arguments invoked after each array element is parsed. The first argument is the result of the lastarray-alloccall. The second argument is the index, and the last, the element value.array-returna function of two arguments, the allocated array
and the length.object-alloca function of 0 argument.object-seta function of 3 arguments.object-returna function of 1 argument.parse-errora function of 3 arguments.undefinedthe value used to representundefined.constant-alloca function of one argument, the parsed contant.string-alloca function of one argument, the parsed string.revivereither#for a function of three arguments, invoked
after parsing an object property.exprif false, check end-of-file after parsing the last JSON value.
 |