| Function summary | |
|---|---|
| keywordify | string |
| make-node-attribute-plist | node &rest args |
| make-node-instance | class node &rest initargs |
| map-node-list | fn node-list &aux (results (quote nil)) |
| parse-float | string &key (start 0) end |
| parse-real | string &key (start 0) end |
| parse-type | type string &key (start 0) end |
| prompt-for-line | message &rest args |
| read-safely-from-string | string &optional (eof-error-p t) eof-value &key (start 0) end preserve-whitespace |
| split-sequence | separators sequence &key (test (quote eql)) key coalesce-separators |
| strcat | &rest string-designators |
| text-content | node |
| Macro summary | |
|---|---|
| define-restart-function | name lambda-list &body decls-and-docs |
| do-element-nodes | (var node-list-form &optional result-form) &body body |
| map-element-nodes | function node-list |
| pcase | keyform predicate &body body |
| with-namespaces | bindings &body body |
| with-soap-envelope | (prefix &rest bindings) &body body |
map-nodes function node-list => results
function --- a function of one argument
node-list --- a dom:node-list
results --- a list
map-nodes is like dom:map-node-list, but returns a list of the results of calling function on the nodes, so it is more like CL:MAPCAR.
text-content node => content
node --- a dom:node
content --- a string
text-content attempts to extract the text content of the node. If the node has no child nodes, then content is the zero-length string "". Otherwise, content is the dom:data of node's first child.
make-node-attribute-plist node {plist-key specifier}* => plist
node --- a Closure XML dom:node
plist-key --- a symbol
specifier ::= attribute-name | (attribute-name &key key optional)
attribute-name --- a string designator
key --- a function or symbol
optional --- a generalized boolean
Make-node-attribute-plist builds a plist whose keys are the plist-keys and whose values are based the corresponding specifier and XML attribute values of the node. Values are computed as follows:
In the case that specifier is simply attribute-name, i.e., a string designator, then the value of the corresponding plist-key is the value of the XML attribute with the name designated by attribute-name.
In the case that specifier is a list, then key is applied to the XML attribute value and the result is used as the value in the resulting plist. If optional is non-nil, then if the attribute is not specified for the DOM node, the the plist-key is skipped.
Where node is a dom:node representing <element att1="val1" />:
(make-node-attribute-plist node :foo "att1")
=> (:foo "att1")
(make-node-attribute-plist node :foo '("att1" :key reverse))
=> (:foo "1tta")
(make-node-attribute-plist node :foo '("att2" :key intern))
=> (:foo ||)
(make-node-attribute-plist node :foo '("att2" :key intern :optional t))
=> ()
make-node-instance class node &rest initargs => object
class --- a class, or symbol that names a class
node --- a cxml dom:node
initargs --- a plist
object --- an object of type class
Make-node-instance is a simple wrapper that applies make-instance to class and initialization arguments that are generated by make-node-attribute-plist from node and initargs.
keywordify string => keyword
string --- a string designator
keyword --- a keyword
Keywordify returns a keyword whose symbol name is the result of replacing #\_ with #\- in the string-upcase'd string.
(keywordify "comp_than") => :comp-than
| read-safely-from-string | string &optional (eof-error-p t) eof-value &key (start 0) end preserve-whitespace | [Function] |
read-safely-from-string string &optional eof-error-p t eof-value &key start end preserve-whitespace => object, position
Arguments and Values are exactly those of READ-FROM-STRING.
read-safely-from-string binds *READ-EVAL* to NIL, and calls READ-FROM-STRING with its arguments.
parse-type type string &key start end => value
type --- a type specifier
string --- a string
start, end --- bounding index designators of string. Defaults are 0 and nil, respectively.
float --- the parsed value
Reads a value from string using read-safely-from-string. If the value satifies the type specifier, it is returned. Otherwise an error is signalled.
parse-float string &key start end => float
string --- a string
start, end --- bounding index designators of string. Defaults are 0 and nil, respectively.
float --- the parsed float
Equivalent to (parse-type 'float string :start start :end end).
parse-real string &key start end => real
string --- a string
start, end --- bounding index designators of string. Defaults are 0 and nil, respectively
real --- the parsed real
Equivalent to (parse-type 'real string :start start :end end).
strcat &rest string-designators => string * Argument and Values:
string-designators --- string designators
string --- a string
strcat returns a string which is the concatenation of the designated strings.
split-sequence separators sequence &key key test coalesce-separators => result
separators --- a sequence of separators
sequence --- a sequent to split
key --- a function of one argument or nil
test --- a function of two arguments, default is eql
coalesce-separators --- a boolean
split-sequence returns a list of sequences of the same type as sequences (extracted using subseq) where the subsequences are contiguous subsequences of sequence, delimited by any element of separators. Separators are found within sequence using test and key. If coalesce-separators is non-nil, then separators within sequence are merged (i.e., result will contain no empty sequences).
(split-sequence #(a) '(t i a r a))
=> ((T I) (R) NIL)
(split-sequence #(a) '(t i a r a) :coalesce-separators t)
=> ((T I) (R))
prompt-for-line message &rest args => line, okp
message --- a format control
args --- arguments used by format
line --- a string
okp --- a boolean
Prompts for a line of input on *query-io* after presenting the message using the args. A line is read from *query-io*. If the call to read-line returns without an error, the line that was read is returned, and okp is true. Otherwise the empty string is returned, and okp is false.
define-restart-function name lambda-list [[declaration* | documentation]]
name --- a symbol, not evaluated
lambda-list --- a list of symbols
documentation --- a string, not evaluated
declaration --- a declare expression, not evaluated
define-restart-function defines a function named name whose lambda-list is like the specified lambda-list, but with one final optional argument, the condition object. The function is defined with DEFUN. The function searches for a restart named name (using FIND-RESTART, name, and the condition object), and if a restart is found, it is invoked with INVOKE-RESTART and the variables defined by the lambda-list (but not the condition object).
do-element-nodes (var node-list-form [result-form]) form*
var --- a symbol
node-list-form --- a form
result-form --- a form
do-element-nodes is similar to dom:do-node-list, but body is only evaluated for a particular node when the node's dom:node-type is :ELEMENT.
map-element=mpdes function node-list => result-list
function --- a function-designator
node-list --- a node list
result-list --- a list
map-element-nodes returns a list whose elements are the result of calling function on each element of the node-list (in order).
pcase keyform {clause}* => result*
clause::= (keys form*)
keyform --- a form; evaluated to produce a test-key
predicate --- a form; evaluated to produce a funcallable object
keys --- a designator for a list of objects. The symbols t and otherwise may not be used as the keys designator.
results --- the values returned by the forms in the matching of clause.
Pcase is like case, except that the test-key is compared to the keys by predicate.
(pcase 'foo #'string-equal
((bar) 'bar)
(("foo") 'foo))
=> foo
with-namespaces ({(prefix uri)}*) form* => result
prefix --- a namespace prefix (a string)
uri --- a string denoting a URI
form --- a form
result --- the result of evaluating forms
with-namespaces evalutes forms with the the namespace bindings provided. I.e., it reduces nesting of CXML:WITH-NAMESPACE forms.
with-soap-envelope (soap-prefix {(prefix uri)}*) form* => envelope
soap-prefix, prefix --- namespace abbreviations/prefixes
uri --- string denoting a URI
forms --- forms
envelope --- a CXML:ROD (probably a string)
with-soap-envelope evalutes forms within a CXML:WITH-XML-OUTPUT with the following XML namespaces. prefix is bound to the SOAP envelope prefix, i.e., "http://schemas.xmlsoap.org/soap/envelope/". Any other namespace bindings provided are also in effect. Forms are evaluated within two CXML:WITH-ELEMENTs, the SOAP Envelope and the SOAP Body. A CXML:ROD (probably a string) is returned.
(with-soap-envelope
("env" ("foo" "http://foo.example.org")
("bar" "http://bar.example.org"))
(cxml:with-element* ("foo" "a")
(cxml:with-element* ("bar" "b")
(cxml:text "Text Content"))))
=>
"<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:foo="http://foo.example.org"
xmlns:bar="http://bar.example.org">
<env:Body>
<foo:a>
<bar:b>Text Content</bar:b>
</foo:a>
</env:Body>
</env:Envelope>"