2.0.0 An XML / XHTML / HTML parser that aims to be as lenient as possible.
Table of Contents
What is Plump?
Plump is a parser for HTML/XML like documents, focusing on being lenient towards invalid markup. It can handle things like invalid attributes, bad closing tag order, unencoded entities, inexistent tag types, self-closing tags and so on. It parses documents to a class representation and offers a small set of DOM functions to manipulate it. You are free to change it to parse to your own classes though.
How To
Load Plump through Quicklisp or ASDF:
(ql:quickload :plump)
Using the PARSE function, plump will transform a string, pathname or stream into a document:
(plump:parse "<foo><bar this is=\"a thing\">baz</bar><span id=\"test\">oh my")
This returns a root node. If you want to append a document to a root node (or any other node that accepts children) that you've made, you can pass it into the parse function. To return the document into a readable form, you can call SERIALIZE:
(plump:serialize *)
Using the DOM you can easily traverse the document and change it:
(plump:remove-child (plump:get-element-by-id ** "test"))
(plump:serialize ***)
By default plump includes a few special tag dispatchers to catch HTML oddities like self-closing tags and fulltext-nodes. Especially the self-closing tags can lead to problems in XML documents. In order to parse without any HTML "tricks", you can simply do:
(let ((plump:*tag-dispatchers* plump:*xml-tags*)) (plump:parse "<link>foo</link>"))
This will also influence the serialization. By default self-closing tags will be printed in "HTML-fashion," but if you require full XML support, the above should be the way to go. This behaviour is new in Plump2, as previously everything was always serialized in XML mode.
Extending Plump
If you want to handle a certain tag in a special way, you can write your own tag-dispatcher. For example comments, the doctype and self-closing tags are handled in this fashion. In order to properly hook in, you will have to learn to use Plump's lexer (see next section).
(plump:define-tag-dispatcher (my-dispatcher *tag-dispatchers*) (name)
(string-equal name "my-tag"))
(plump:define-tag-parser my-dispatcher (name)
(let ((attrs (plump:read-attributes)))
(when (char= (plump:consume) #\/)
(plump:consume)) ;; Consume closing
(make-instance 'my-tag :parent plump:*root* :attributes attrs)))
If you don't want to disturb the standard Plump tag dispatchers list, you can define your own special variable to contain the dispatchers and bind *tag-dispatchers* to that during parsing, as shown for the XML example above. Shorthand macros exist to define self-closing or full-text tags:
(plump:define-self-closing-element img *tag-dispatchers* *html-tags*)
(plump:define-fulltext-element style *tag-dispatchers* *html-tags*)
You can also define a wild card dispatcher for your own special variable that will dispatch on any tag that doesn't match another dispatcher:
(plump:define-wildcard-dispatcher your-default *your-special-variable*)
XML allows for script tags (like <?php ?>). By default Plump does not specify any special reading for any script tag. If an unhandled script tag is encountered, a warning is emitted and Plump will try to just read anything until ?> is encountered. For most script tags this probably will not suffice, as they might contain some form of escaped ?>. If you do want to use Plump to process script tags properly as well, you will have to define your own reader with define-processing-parser. You can also use that macro to define a reader that outputs a more suitable format than a text tag.
During parsing, all elements are created through MAKE-* functions like MAKE-ROOT, MAKE-ELEMENT, MAKE-TEXT-NODE, and so on. By overriding these functions you can instead delegate the parsing to your own DOM.
If you subclass the DOM classes, you might want to define a method on SERIALIZE-OBJECT to produce the right output.
Plump's Lexer
Since parser generators are good for strict grammars and Plump needed to be fast and lenient, it comes with its own primitive reading/lexing mechanisms. All the lexer primitives are defined in lexer.lisp and you can leverage them for your own projects as well, if you so desire.
In order to allow the lexing to work, you'll have to wrap your processing code in with-lexer-environment. You can then use functions like consume, advance, unread, peek and consume-until to process the input.
make-matcher allows you to use a very simple language to define matching operations. This will evaluate to a function with no arguments that should return T if it matches and NIL otherwise. Combining matchers with consume-until allows you to easily make sequence readers:
(plump:with-lexer-environment ("<foo>")
(when (char= #\< (plump:consume))
(plump:consume-until (plump:make-matcher (is #\>)))))
Available matcher constructs are not, and, or, is, in, next, prev, any, and find. define-matcher allows you to associate keywords to matchers, which you can then use as a matcher rule in make-matcher. Regular symbols act as variables:
(let ((find "baz"))
(plump:with-lexer-environment ("foo bar baz")
(plump:consume-until (plump:make-matcher (is find)))))
Speed

If you know of other native-lisp libraries that beat Plump, please do let me know, I would be very interested!
See Also
- lQuery Dissect and manipulate the DOM with jQuery-like commands.
- CLSS Traverse the DOM by CSS selectors.
- plump-tex Serialize between TeX and the Plump DOM.
- plump-sexp Serialize between SEXPrs and the Plump DOM.
Support
If you'd like to support the continued development of Plump, please consider becoming a backer on Patreon:
System Information
Definition Index
-
PLUMP-DOM
- ORG.SHIRAKUMO.PLUMP.DOM
No documentation provided.-
EXTERNAL SPECIAL-VARIABLE *ENTITY-MAP*
String hash-table containing the entity names and mapping them to their respective characters.
-
EXTERNAL SPECIAL-VARIABLE *STREAM*
The stream to serialize to during SERIALIZE-OBJECT.
-
EXTERNAL CLASS CDATA
XML CDATA section node.
-
EXTERNAL CLASS CHILD-NODE
Node class that is a child and thus has a parent.
-
EXTERNAL CLASS COMMENT
Comment node that can only contain a single comment string.
-
EXTERNAL CLASS DOCTYPE
Special DOM node for the doctype declaration.
-
EXTERNAL CLASS ELEMENT
Standard DOM element/block including attributes, tag-name, parent and children.
-
EXTERNAL CLASS FULLTEXT-ELEMENT
Special DOM element that contains full, un-entitied text like SCRIPT and STYLE.
-
EXTERNAL CLASS NESTING-NODE
Node class that can contain child nodes.
-
EXTERNAL CLASS NODE
Base DOM node class.
-
EXTERNAL CLASS PROCESSING-INSTRUCTION
XML processing instruction node.
-
EXTERNAL CLASS ROOT
Root DOM node, practically equivalent to a "document".
-
EXTERNAL CLASS TEXT-NODE
Text node that can only contain a single text string.
-
EXTERNAL CLASS TEXTUAL-NODE
Node class that represents a textual node and thus contains a TEXT field.
-
EXTERNAL CLASS XML-HEADER
XML header element
-
EXTERNAL CONDITION DISCOURAGED-XML-CHARACTER
Warning signalled when a discouraged XML character is encountered during WRITE-ENCODE-CHAR.
-
EXTERNAL CONDITION INVALID-XML-CHARACTER
Error signalled when an invalid XML character is encountered during WRITE-ENCODE-CHAR.
-
EXTERNAL FUNCTION ALLOWED-CHAR-P
- CHAR
Returns T if the character is a permitted XML character.
-
EXTERNAL FUNCTION APPEND-CHILD
- PARENT
- CHILD
Appends the given child onto the parent's child list. Returns the child.
-
EXTERNAL FUNCTION ATTRIBUTE
- ELEMENT
- ATTRIBUTE
Returns the asked attribute from the element or NIL. If the attribute could not be found, the second return value is set to NIL.
-
EXTERNAL FUNCTION (SETF ATTRIBUTE)
- VALUE
- ELEMENT
- ATTRIBUTE
Set an attribute on an element to the given value.
-
EXTERNAL FUNCTION CDATA-P
- OBJECT
Returns T if the given OBJECT is of type CDATA
-
EXTERNAL FUNCTION CHILD-ELEMENTS
- NESTING-NODE
Returns a new vector of children of the given node, filtered to elements.
-
EXTERNAL FUNCTION CHILD-NODE-P
- OBJECT
Returns T if the given OBJECT is of type CHILD-NODE
-
EXTERNAL FUNCTION CHILD-POSITION
- CHILD
Returns the index of the child within its parent.
-
EXTERNAL FUNCTION CLEAR
- NESTING-NODE
Clears all children from the node. Note that the PARENT of all child elements is set to NIL.
-
EXTERNAL FUNCTION CLONE-ATTRIBUTES
- NODE
Clone the attribute map. Note that keys and values are NOT copied/cloned.
-
EXTERNAL FUNCTION CLONE-CHILDREN
- NODE
- &OPTIONAL
- DEEP
- NEW-PARENT
Clone the array of children. If DEEP is non-NIL, each child is cloned as per (CLONE-NODE NODE T). When copying deeply, you can also pass a NEW-PARENT to set on each child.
-
EXTERNAL FUNCTION COMMENT-P
- OBJECT
Returns T if the given OBJECT is of type COMMENT
-
EXTERNAL FUNCTION DECODE-ENTITIES
- TEXT
- &OPTIONAL
- REMOVE-INVALID
Translates all entities in the text into their character counterparts if possible. If an entity does not match, it is left in place unless REMOVE-INVALID is non-NIL.
-
EXTERNAL FUNCTION DISCOURAGED-CHAR-P
- CHAR
Returns T if the character is a discouraged XML character.
-
EXTERNAL FUNCTION DOCTYPE-P
- OBJECT
Returns T if the given OBJECT is of type DOCTYPE
-
EXTERNAL FUNCTION ELEMENT-P
- OBJECT
Returns T if the given OBJECT is of type ELEMENT
-
EXTERNAL FUNCTION ELEMENT-POSITION
- CHILD
Returns the index of the child within its parent, counting only elements. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION ENCODE-ENTITIES
- TEXT
- &OPTIONAL
- STREAM
Encodes the characters < > & " with their XML entity equivalents. If no STREAM is given, it encodes to a new string.
-
EXTERNAL FUNCTION ENSURE-ATTRIBUTE-MAP
- TABLE
Ensures that the TABLE is suitable as an attribute-map. If it is not, the table is copied into a proper attribute-map.
-
EXTERNAL FUNCTION ENSURE-CHILD-ARRAY
- ARRAY
If the ARRAY is suitable as a child-array, it is returned. Otherwise the array's elements are copied over into a proper child-array.
-
EXTERNAL FUNCTION FAMILY
- CHILD
Returns the direct array of children of the parent of the given child. Note that modifying this array directly modifies that of the parent.
-
EXTERNAL FUNCTION FAMILY-ELEMENTS
- CHILD
Returns the direct array of children elements of the parent of the given child. Note that this is a copy of the array, modifying it is safe. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION FIRST-CHILD
- ELEMENT
Returns the first child within the parent or NIL if the parent is empty.
-
EXTERNAL FUNCTION FIRST-ELEMENT
- ELEMENT
Returns the first child element within the parent or NIL if the parent is empty. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION FULLTEXT-ELEMENT-P
- OBJECT
Returns T if the given OBJECT is of type FULLTEXT-ELEMENT
-
EXTERNAL FUNCTION GET-ATTRIBUTE
- ELEMENT
- ATTRIBUTE
Synonymous to ATTRIBUTE.
-
EXTERNAL FUNCTION GET-ELEMENT-BY-ID
- NODE
- ID
Searches the given node and returns the first node at arbitrary depth that matches the given ID attribute.
-
EXTERNAL FUNCTION GET-ELEMENTS-BY-TAG-NAME
- NODE
- TAG
Searches the given node and returns an unordered list of child nodes at arbitrary depth that match the given tag.
-
EXTERNAL FUNCTION HAS-ATTRIBUTE
- ELEMENT
- ATTRIBUTE
Returns T if the provided attribute exists.
-
EXTERNAL FUNCTION HAS-CHILD-NODES
- NODE
Returns T if the node can contain children and the child array is not empty.
-
EXTERNAL FUNCTION INSERT-AFTER
- ELEMENT
- NEW-CHILD
Inserts the new-child after the given element in the parent's list. Returns the new child. Note that this operation is potentially very costly. See VECTOR-PUSH-EXTEND-POSITION
-
EXTERNAL FUNCTION INSERT-BEFORE
- ELEMENT
- NEW-CHILD
Inserts the new-child before the given element in the parent's list. Returns the new child. Note that this operation is potentially very costly. See VECTOR-PUSH-EXTEND-POSITION
-
EXTERNAL FUNCTION LAST-CHILD
- ELEMENT
Returns the last child within the parent or NIL if the parent is empty.
-
EXTERNAL FUNCTION LAST-ELEMENT
- ELEMENT
Returns the last child element within the parent or NIL if the parent is empty. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION MAKE-ATTRIBUTE-MAP
- &OPTIONAL
- SIZE
Creates a map to contain attributes.
-
EXTERNAL FUNCTION MAKE-CDATA
- PARENT
- &KEY
- TEXT
Creates an XML CDATA section under the parent. Note that the element is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-CHILD-ARRAY
- &OPTIONAL
- SIZE
Creates an array to contain child elements
-
EXTERNAL FUNCTION MAKE-COMMENT
- PARENT
- &OPTIONAL
- TEXT
Creates a new comment node under the parent. Note that the node is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-DOCTYPE
- PARENT
- DOCTYPE
Creates a new doctype node under the parent. Note that the node is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-ELEMENT
- PARENT
- TAG
- &KEY
- CHILDREN
- ATTRIBUTES
Creates a standard DOM element with the given tag name and parent. Optionally a vector (with fill-pointer) containing children and an attribute-map (a hash-table with equalp test) can be supplied. Note that the element is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-FULLTEXT-ELEMENT
- PARENT
- TAG
- &KEY
- TEXT
- ATTRIBUTES
Creates a fulltext element under the parent. Optionally a text and an attribute-map (a hash-table with equalp test) can be supplied. Note that the element is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-PROCESSING-INSTRUCTION
- PARENT
- &KEY
- NAME
- TEXT
Creates an XML processing instruction under the parent. Note that the element is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-ROOT
- &OPTIONAL
- CHILDREN
Creates a root node with the given children. Children should be a vector with fill-pointer.
-
EXTERNAL FUNCTION MAKE-TEXT-NODE
- PARENT
- &OPTIONAL
- TEXT
Creates a new text node under the parent. Note that the node is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-XML-HEADER
- PARENT
- &KEY
- ATTRIBUTES
Creates an XML header object under the parent. Note that the element is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION NESTING-NODE-P
- OBJECT
Returns T if the given OBJECT is of type NESTING-NODE
-
EXTERNAL FUNCTION NEXT-ELEMENT
- CHILD
Returns the sibling element next to this one or NIL if it is already last. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION NEXT-SIBLING
- CHILD
Returns the sibling next to this one or NIL if it is already the last.
-
EXTERNAL FUNCTION NODE-P
- OBJECT
Returns T if the given OBJECT is of type NODE
-
EXTERNAL FUNCTION PREPEND-CHILD
- PARENT
- CHILD
Prepends the given child onto the parent's child list. Returns the child. Note that this operation is costly, See VECTOR-PUSH-EXTEND-FRONT
-
EXTERNAL FUNCTION PREVIOUS-ELEMENT
- CHILD
Returns the sibling element before this one or NIL if it is already the first. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION PREVIOUS-SIBLING
- CHILD
Returns the sibling before this one or NIL if it is already the first.
-
EXTERNAL FUNCTION PROCESSING-INSTRUCTION-P
- OBJECT
Returns T if the given OBJECT is of type PROCESSING-INSTRUCTION
-
EXTERNAL FUNCTION REMOVE-ATTRIBUTE
- ELEMENT
- ATTRIBUTE
Remove the specified attribute if it exists. Returns NIL.
-
EXTERNAL FUNCTION REMOVE-CHILD
- CHILD
Removes the child from its parent. Returns the child. Note that this operation is potentially very costly. See VECTOR-POP-POSITION
-
EXTERNAL FUNCTION RENDER-TEXT
- NODE
"Renders" the text of this element and its children. In effect the text is gathered from the component and all of its children, but transforming the text in such a way that: - All ASCII white space (Space, Tab, CR, LF) is converted into spaces. - There are no consecutive spaces. - There are no spaces at the beginning or end. This is somewhat analogous to how the text will be shown to the user when rendered by a browser. Hence, render-text.
-
EXTERNAL FUNCTION REPLACE-CHILD
- OLD-CHILD
- NEW-CHILD
Replace the old child with a new one. Returns the old child.
-
EXTERNAL FUNCTION ROOT-P
- OBJECT
Returns T if the given OBJECT is of type ROOT
-
EXTERNAL FUNCTION SERIALIZE
- NODE
- &OPTIONAL
- STREAM
Serializes NODE to STREAM. STREAM can be a stream, T for *standard-output* or NIL to serialize to string.
-
EXTERNAL FUNCTION SET-ATTRIBUTE
- ELEMENT
- ATTRIBUTE
- VALUE
Synonymous to (SETF (ATTRIBUTE ..) ..)
-
EXTERNAL FUNCTION SIBLING-ELEMENTS
- CHILD
Returns the array of sibling elements of the given child. Note that this is a copy of the array, modifying it is safe. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION SIBLINGS
- CHILD
Returns the array of siblings of the given child. Note that this is a copy of the array, modifying it is safe.
-
EXTERNAL FUNCTION SPLICE
- ELEMENT
Splices the contents of element into the position of the element in its parent. Returns the parent. Note that this operation is potentially very costly. See ARRAY-SHIFT
-
EXTERNAL FUNCTION STRIP
- NODE
Trim all text-nodes within NODE (at any depth) of leading and trailing whitespace. If their TEXT should be an empty string after trimming, remove them.
-
EXTERNAL FUNCTION TEXT-NODE-P
- OBJECT
Returns T if the given OBJECT is of type TEXT-NODE
-
EXTERNAL FUNCTION TEXTUAL-NODE-P
- OBJECT
Returns T if the given OBJECT is of type TEXTUAL-NODE
-
EXTERNAL FUNCTION TRANSLATE-ENTITY
- TEXT
- &KEY
- START
- END
Translates the given entity identifier (a name, #Dec or #xHex) into their respective strings if possible. Otherwise returns NIL.
-
EXTERNAL FUNCTION TRIM
- NODE
Trim all text-nodes within NODE (at any depth) of leading and trailing whitespace.
-
EXTERNAL FUNCTION WRITE-ENCODE-CHAR
- CHAR
- STREAM
- &OPTIONAL
- ENCODE-WHITESPACE
Write and possibly encode the CHAR to STREAM. This also properly handles detection of invalid or discouraged XML characters. The following restarts are available in the case of a faulty character: ABORT Do not output the faulty character at all. USE-NEW-CHARACTER Output a replacement character instead. CONTINUE Continue and output the faulty character anyway. See INVALID-XML-CHARACTER See DISCOURAGED-XML-CHARACTER
-
EXTERNAL FUNCTION XML-HEADER-P
- OBJECT
Returns T if the given OBJECT is of type XML-HEADER
-
EXTERNAL GENERIC-FUNCTION ATTRIBUTES
- OBJECT
Returns an EQUALP hash-table of the element's attributes.
-
EXTERNAL GENERIC-FUNCTION (SETF ATTRIBUTES)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION CHILDREN
- OBJECT
Returns a vector of child-nodes that are contained within the node.
-
EXTERNAL GENERIC-FUNCTION (SETF CHILDREN)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION CLONE-NODE
- NODE
- &OPTIONAL
- DEEP
Clone the given node, creating a new instance with the same contents. If DEEP is non-NIL, the following applies: The text of COMMENT and TEXT-NODEs is copied as per COPY-SEQ. The children of NESTING-NODEs are copied as per (CLONE-CHILDREN CHILD T)
-
EXTERNAL GENERIC-FUNCTION DOCTYPE
- OBJECT
Returns the doctype node's actual doctype string.
-
EXTERNAL GENERIC-FUNCTION (SETF DOCTYPE)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION FAULTY-CHAR
- CONDITION
Returns the faulty char that caused the signal.
-
EXTERNAL GENERIC-FUNCTION (SETF FAULTY-CHAR)
- NEW-VALUE
- CONDITION
No documentation provided. -
EXTERNAL GENERIC-FUNCTION PARENT
- OBJECT
Returns the node's parent that should contain this element as a child.
-
EXTERNAL GENERIC-FUNCTION (SETF PARENT)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION SERIALIZE-OBJECT
- NODE
Serialize the given node and print it to *stream*.
-
EXTERNAL GENERIC-FUNCTION TAG-NAME
- OBJECT
Returns the element's tag name.
-
EXTERNAL GENERIC-FUNCTION (SETF TAG-NAME)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION TEXT
- OBJECT
Returns the node's textual content.
-
EXTERNAL GENERIC-FUNCTION (SETF TEXT)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION TRAVERSE
- NODE
- FUNCTION
- &KEY
- TEST
Traverse the NODE and all its children recursively, calling FUNCTION on the current node if calling TEST on the current node returns a non-NIL value. It is safe to modify the child array of the parent of each node passed to FUNCTION. NODE is returned.
-
PLUMP-LEXER
- ORG.SHIRAKUMO.PLUMP.LEXER
No documentation provided.-
EXTERNAL SPECIAL-VARIABLE *INDEX*
Set to the current reading index.
-
EXTERNAL SPECIAL-VARIABLE *LENGTH*
Set to the length of the string for bounds checking.
-
EXTERNAL SPECIAL-VARIABLE *STRING*
Contains the current string to lex.
-
EXTERNAL FUNCTION ADVANCE
Skips a character if possible. Returns the new index or NIL.
-
EXTERNAL FUNCTION ADVANCE-N
- N
Advances by N characters if possible. Returns the new *INDEX*.
-
EXTERNAL FUNCTION CONSUME
Consumes a single character if possible and returns it. Otherwise returns NIL.
-
EXTERNAL FUNCTION CONSUME-UNTIL
- MATCHER
Consumes until the provided matcher function returns positively. Returns the substring that was consumed.
-
EXTERNAL FUNCTION MATCHER-AND
- &REST
- MATCHERS
Creates a matcher function that returns if all of the sub-expressions return successfully. The last match is returned, if all.
-
EXTERNAL FUNCTION MATCHER-CHARACTER
- CHARACTER
Creates a matcher function that attempts to match the given character.
-
EXTERNAL FUNCTION MATCHER-FIND
- LIST
Creates a matcher function that returns T if the character is found in the given list.
-
EXTERNAL FUNCTION MATCHER-NEXT
- MATCHER
Creates a matcher environment that peeks ahead one farther.
-
EXTERNAL FUNCTION MATCHER-NOT
- MATCHER
Creates a matcher function that inverts the result of the sub-expression.
-
EXTERNAL FUNCTION MATCHER-OR
- &REST
- MATCHERS
Creates a matcher function that returns successfully if any of the sub-expressions return successfully. The first match is returned, if any.
-
EXTERNAL FUNCTION MATCHER-PREV
- MATCHER
Creates a matcher environment that peeks behind.
-
EXTERNAL FUNCTION MATCHER-RANGE
- FROM
- TO
Creates a matcher that checks a range according to the next character's CHAR-CODE.
-
EXTERNAL FUNCTION MATCHER-STRING
- STRING
Creates a matcher function that attempts to match the given string.
-
EXTERNAL FUNCTION PEEK
Returns the next character, if any.
-
EXTERNAL FUNCTION UNREAD
Steps back a single character if possible. Returns the new *INDEX*.
-
EXTERNAL FUNCTION UNREAD-N
- N
Steps back by N characters if possible. Returns the new *INDEX*.
-
EXTERNAL MACRO DEFINE-MATCHER
- NAME
- FORM
Associates NAME as a keyword to the matcher form. You can then use the keyword in further matcher rules.
-
EXTERNAL MACRO MAKE-MATCHER
- FORM
Macro to create a matcher chain.
-
EXTERNAL MACRO MATCHER-ANY
- &REST
- IS
Shorthand for (or (is a) (is b)..)
-
EXTERNAL MACRO WITH-LEXER-ENVIRONMENT
- STRING
- &BODY
- BODY
Sets up the required lexing environment for the given string.
-
PLUMP-PARSER
- ORG.SHIRAKUMO.PLUMP.PARSER
No documentation provided.-
EXTERNAL SPECIAL-VARIABLE *ALL-TAG-DISPATCHERS*
All defined tag dispatchers
-
EXTERNAL SPECIAL-VARIABLE *HTML-TAGS*
List of HTML tag dispatchers
-
EXTERNAL SPECIAL-VARIABLE *ROOT*
Object containing the current node to set as parent.
-
EXTERNAL SPECIAL-VARIABLE *TAG-DISPATCHERS*
Active tag dispatcher functions
-
EXTERNAL SPECIAL-VARIABLE *XML-TAGS*
List of XML tag dispatchers
-
EXTERNAL STRUCTURE TAG-DISPATCHER
Encapsulates the processing for a given tag. See TAG-DISPATCHER-NAME See TAG-DISPATCHER-TEST See TAG-DISPATCHER-PARSER See TAG-DISPATCHER-PRINTER
-
EXTERNAL FUNCTION PROCESSING-PARSER
- PROCESS-NAME
Return the processing-parser function for PROCESS-NAME. SETF-able.
-
EXTERNAL FUNCTION (SETF PROCESSING-PARSER)
- FUNC
- PROCESS-NAME
Set the processing-parser function for PROCESS-NAME.
-
EXTERNAL FUNCTION READ-ATTRIBUTE
Reads an attribute and returns it as a key value cons.
-
EXTERNAL FUNCTION READ-ATTRIBUTE-NAME
Reads an attribute name.
-
EXTERNAL FUNCTION READ-ATTRIBUTE-VALUE
Reads an attribute value, either enclosed in quotation marks or until a space or tag end.
-
EXTERNAL FUNCTION READ-ATTRIBUTES
Reads as many attributes as possible from a tag and returns them as an attribute map.
-
EXTERNAL FUNCTION READ-CHILDREN
Read all children of the current *root* until the closing tag for *root* is encountered.
-
EXTERNAL FUNCTION READ-NAME
Reads and returns a tag name.
-
EXTERNAL FUNCTION READ-ROOT
- &OPTIONAL
- ROOT
Creates a root element and reads nodes into it. Optionally uses the specified root to append child nodes to. Returns the root.
-
EXTERNAL FUNCTION READ-STANDARD-TAG
- NAME
Reads an arbitrary tag and returns it. This recurses with READ-CHILDREN.
-
EXTERNAL FUNCTION READ-TAG
Attempts to read a tag and dispatches or defaults to READ-STANDARD-TAG. Returns the completed node if one can be read.
-
EXTERNAL FUNCTION READ-TAG-CONTENTS
Reads and returns all tag contents. E.g. <foo bar baz> => bar baz
-
EXTERNAL FUNCTION READ-TEXT
Reads and returns a text-node.
-
EXTERNAL FUNCTION REMOVE-PROCESSING-PARSER
- PROCESS-NAME
Remove the processing-parser for PROCESS-NAME.
-
EXTERNAL FUNCTION REMOVE-TAG-DISPATCHER
- NAME
- &OPTIONAL
- LIST
Removes the tag-dispatcher of the given name from the list.
-
EXTERNAL FUNCTION SLURP-STREAM
- STREAM
Quickly slurps the stream's contents into an array with fill pointer.
-
EXTERNAL FUNCTION TAG-DISPATCHER
- NAME
- &OPTIONAL
- LIST
Accessor to the tag-dispatcher of the given name.
-
EXTERNAL GENERIC-FUNCTION PARSE
- INPUT
- &KEY
- ROOT
Parses the given input into a DOM representation. By default, methods for STRING, PATHNAME and STREAM are defined. If supplied, the given root is used to append children to as per READ-ROOT. Returns the root.
-
EXTERNAL MACRO DEFINE-FULLTEXT-ELEMENT
- TAG
- &REST
- LISTS
Defines an element to be read as a full-text element. This means that it cannot contain any child-nodes and everything up until its closing tag is used as its text.
-
EXTERNAL MACRO DEFINE-PROCESSING-PARSER
- PROCESS-NAME
- &BODY
- BODY
Defines a new processing-instruction parser. It is invoked if a processing-instruction (<?) with PROCESS-NAME is encountered. The lexer will be at the point straight after reading in the PROCESS-NAME. Expected return value is a string to use as the processing-instructions' TEXT. The closing tag (?>) should NOT be consumed by a processing-parser.
-
EXTERNAL MACRO DEFINE-SELF-CLOSING-ELEMENT
- TAG
- &REST
- LISTS
Defines an element that does not need to be closed with /> and cannot contain child nodes.
-
EXTERNAL MACRO DEFINE-TAG-DISPATCHER
- NAME
- &REST
- LISTS
- TAGVAR
- &BODY
- BODY
Defines a new tag dispatcher. It is invoked if TEST-FORM passes. NAME --- Name to discern the dispatcher with. LISTS --- Symbols of lists to which the dispatcher should be added. TAGVAR --- Symbol bound to the tag name. BODY --- Body forms describing the test to match the tag.
-
EXTERNAL MACRO DEFINE-TAG-PARSER
- NAME
- TAGVAR
- &BODY
- BODY
Defines the parser function for a tag dispatcher. NAME --- The name of the tag dispatcher. If one with this name cannot be found, an error is signalled. TAGVAR --- Symbol bound to the tag name. BODY --- Body forms describing the tag parsing behaviour. -
EXTERNAL MACRO DEFINE-TAG-PRINTER
- NAME
- NODEVAR
- &BODY
- BODY
Defines the printer function for a tag dispatcher. NAME --- The name of the tag dispatcher. If one with this name cannot be found, an error is signalled. TAGVAR --- Symbol bound to the tag name. BODY --- Body forms describing the printing behaviour. Write to the stream bound to PLUMP-DOM:*STREAM*. -
EXTERNAL MACRO DEFINE-WILDCARD-DISPATCHER
- NAME
- &REST
- LISTS
No documentation provided. -
EXTERNAL MACRO DO-TAG-PARSERS
- TEST
- PARSER
- &OPTIONAL
- RESULT-FORM
- &BODY
- BODY
Iterates over the current *TAG-DISPATCHERS*, binding the TEST and PARSER functions. Returns RESULT-FORM's evaluated value.
-
EXTERNAL MACRO DO-TAG-PRINTERS
- TEST
- PRINTER
- &OPTIONAL
- RESULT-FORM
- &BODY
- BODY
Iterates over the current *TAG-DISPATCHERS*, binding the TEST and PRINTER functions. Returns RESULT-FORM's evaluated value.
-
EXTERNAL SETF-EXPANDER TAG-DISPATCHER
- NAME
- &OPTIONAL
- LIST
No documentation provided.
-
PLUMP
- ORG.SHIRAKUMO.PLUMP
No documentation provided.-
EXTERNAL SPECIAL-VARIABLE *ALL-TAG-DISPATCHERS*
All defined tag dispatchers
-
EXTERNAL SPECIAL-VARIABLE *ENTITY-MAP*
String hash-table containing the entity names and mapping them to their respective characters.
-
EXTERNAL SPECIAL-VARIABLE *HTML-TAGS*
List of HTML tag dispatchers
-
EXTERNAL SPECIAL-VARIABLE *INDEX*
Set to the current reading index.
-
EXTERNAL SPECIAL-VARIABLE *LENGTH*
Set to the length of the string for bounds checking.
-
EXTERNAL SPECIAL-VARIABLE *ROOT*
Object containing the current node to set as parent.
-
EXTERNAL SPECIAL-VARIABLE *STREAM*
The stream to serialize to during SERIALIZE-OBJECT.
-
EXTERNAL SPECIAL-VARIABLE *STRING*
Contains the current string to lex.
-
EXTERNAL SPECIAL-VARIABLE *TAG-DISPATCHERS*
Active tag dispatcher functions
-
EXTERNAL SPECIAL-VARIABLE *XML-TAGS*
List of XML tag dispatchers
-
EXTERNAL CLASS CDATA
XML CDATA section node.
-
EXTERNAL CLASS CHILD-NODE
Node class that is a child and thus has a parent.
-
EXTERNAL CLASS COMMENT
Comment node that can only contain a single comment string.
-
EXTERNAL CLASS DOCTYPE
Special DOM node for the doctype declaration.
-
EXTERNAL CLASS ELEMENT
Standard DOM element/block including attributes, tag-name, parent and children.
-
EXTERNAL CLASS FULLTEXT-ELEMENT
Special DOM element that contains full, un-entitied text like SCRIPT and STYLE.
-
EXTERNAL CLASS NESTING-NODE
Node class that can contain child nodes.
-
EXTERNAL CLASS NODE
Base DOM node class.
-
EXTERNAL CLASS PROCESSING-INSTRUCTION
XML processing instruction node.
-
EXTERNAL CLASS ROOT
Root DOM node, practically equivalent to a "document".
-
EXTERNAL CLASS TEXT-NODE
Text node that can only contain a single text string.
-
EXTERNAL CLASS TEXTUAL-NODE
Node class that represents a textual node and thus contains a TEXT field.
-
EXTERNAL CLASS XML-HEADER
XML header element
-
EXTERNAL CONDITION DISCOURAGED-XML-CHARACTER
Warning signalled when a discouraged XML character is encountered during WRITE-ENCODE-CHAR.
-
EXTERNAL CONDITION INVALID-XML-CHARACTER
Error signalled when an invalid XML character is encountered during WRITE-ENCODE-CHAR.
-
EXTERNAL STRUCTURE TAG-DISPATCHER
Encapsulates the processing for a given tag. See TAG-DISPATCHER-NAME See TAG-DISPATCHER-TEST See TAG-DISPATCHER-PARSER See TAG-DISPATCHER-PRINTER
-
EXTERNAL FUNCTION ADVANCE
Skips a character if possible. Returns the new index or NIL.
-
EXTERNAL FUNCTION ADVANCE-N
- N
Advances by N characters if possible. Returns the new *INDEX*.
-
EXTERNAL FUNCTION ALLOWED-CHAR-P
- CHAR
Returns T if the character is a permitted XML character.
-
EXTERNAL FUNCTION APPEND-CHILD
- PARENT
- CHILD
Appends the given child onto the parent's child list. Returns the child.
-
EXTERNAL FUNCTION ATTRIBUTE
- ELEMENT
- ATTRIBUTE
Returns the asked attribute from the element or NIL. If the attribute could not be found, the second return value is set to NIL.
-
EXTERNAL FUNCTION (SETF ATTRIBUTE)
- VALUE
- ELEMENT
- ATTRIBUTE
Set an attribute on an element to the given value.
-
EXTERNAL FUNCTION CDATA-P
- OBJECT
Returns T if the given OBJECT is of type CDATA
-
EXTERNAL FUNCTION CHILD-ELEMENTS
- NESTING-NODE
Returns a new vector of children of the given node, filtered to elements.
-
EXTERNAL FUNCTION CHILD-NODE-P
- OBJECT
Returns T if the given OBJECT is of type CHILD-NODE
-
EXTERNAL FUNCTION CHILD-POSITION
- CHILD
Returns the index of the child within its parent.
-
EXTERNAL FUNCTION CLEAR
- NESTING-NODE
Clears all children from the node. Note that the PARENT of all child elements is set to NIL.
-
EXTERNAL FUNCTION CLONE-ATTRIBUTES
- NODE
Clone the attribute map. Note that keys and values are NOT copied/cloned.
-
EXTERNAL FUNCTION CLONE-CHILDREN
- NODE
- &OPTIONAL
- DEEP
- NEW-PARENT
Clone the array of children. If DEEP is non-NIL, each child is cloned as per (CLONE-NODE NODE T). When copying deeply, you can also pass a NEW-PARENT to set on each child.
-
EXTERNAL FUNCTION COMMENT-P
- OBJECT
Returns T if the given OBJECT is of type COMMENT
-
EXTERNAL FUNCTION CONSUME
Consumes a single character if possible and returns it. Otherwise returns NIL.
-
EXTERNAL FUNCTION CONSUME-UNTIL
- MATCHER
Consumes until the provided matcher function returns positively. Returns the substring that was consumed.
-
EXTERNAL FUNCTION DECODE-ENTITIES
- TEXT
- &OPTIONAL
- REMOVE-INVALID
Translates all entities in the text into their character counterparts if possible. If an entity does not match, it is left in place unless REMOVE-INVALID is non-NIL.
-
EXTERNAL FUNCTION DISCOURAGED-CHAR-P
- CHAR
Returns T if the character is a discouraged XML character.
-
EXTERNAL FUNCTION DOCTYPE-P
- OBJECT
Returns T if the given OBJECT is of type DOCTYPE
-
EXTERNAL FUNCTION ELEMENT-P
- OBJECT
Returns T if the given OBJECT is of type ELEMENT
-
EXTERNAL FUNCTION ELEMENT-POSITION
- CHILD
Returns the index of the child within its parent, counting only elements. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION ENCODE-ENTITIES
- TEXT
- &OPTIONAL
- STREAM
Encodes the characters < > & " with their XML entity equivalents. If no STREAM is given, it encodes to a new string.
-
EXTERNAL FUNCTION ENSURE-ATTRIBUTE-MAP
- TABLE
Ensures that the TABLE is suitable as an attribute-map. If it is not, the table is copied into a proper attribute-map.
-
EXTERNAL FUNCTION ENSURE-CHILD-ARRAY
- ARRAY
If the ARRAY is suitable as a child-array, it is returned. Otherwise the array's elements are copied over into a proper child-array.
-
EXTERNAL FUNCTION FAMILY
- CHILD
Returns the direct array of children of the parent of the given child. Note that modifying this array directly modifies that of the parent.
-
EXTERNAL FUNCTION FAMILY-ELEMENTS
- CHILD
Returns the direct array of children elements of the parent of the given child. Note that this is a copy of the array, modifying it is safe. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION FIRST-CHILD
- ELEMENT
Returns the first child within the parent or NIL if the parent is empty.
-
EXTERNAL FUNCTION FIRST-ELEMENT
- ELEMENT
Returns the first child element within the parent or NIL if the parent is empty. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION FULLTEXT-ELEMENT-P
- OBJECT
Returns T if the given OBJECT is of type FULLTEXT-ELEMENT
-
EXTERNAL FUNCTION GET-ATTRIBUTE
- ELEMENT
- ATTRIBUTE
Synonymous to ATTRIBUTE.
-
EXTERNAL FUNCTION GET-ELEMENT-BY-ID
- NODE
- ID
Searches the given node and returns the first node at arbitrary depth that matches the given ID attribute.
-
EXTERNAL FUNCTION GET-ELEMENTS-BY-TAG-NAME
- NODE
- TAG
Searches the given node and returns an unordered list of child nodes at arbitrary depth that match the given tag.
-
EXTERNAL FUNCTION HAS-ATTRIBUTE
- ELEMENT
- ATTRIBUTE
Returns T if the provided attribute exists.
-
EXTERNAL FUNCTION HAS-CHILD-NODES
- NODE
Returns T if the node can contain children and the child array is not empty.
-
EXTERNAL FUNCTION INSERT-AFTER
- ELEMENT
- NEW-CHILD
Inserts the new-child after the given element in the parent's list. Returns the new child. Note that this operation is potentially very costly. See VECTOR-PUSH-EXTEND-POSITION
-
EXTERNAL FUNCTION INSERT-BEFORE
- ELEMENT
- NEW-CHILD
Inserts the new-child before the given element in the parent's list. Returns the new child. Note that this operation is potentially very costly. See VECTOR-PUSH-EXTEND-POSITION
-
EXTERNAL FUNCTION LAST-CHILD
- ELEMENT
Returns the last child within the parent or NIL if the parent is empty.
-
EXTERNAL FUNCTION LAST-ELEMENT
- ELEMENT
Returns the last child element within the parent or NIL if the parent is empty. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION MAKE-ATTRIBUTE-MAP
- &OPTIONAL
- SIZE
Creates a map to contain attributes.
-
EXTERNAL FUNCTION MAKE-CDATA
- PARENT
- &KEY
- TEXT
Creates an XML CDATA section under the parent. Note that the element is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-CHILD-ARRAY
- &OPTIONAL
- SIZE
Creates an array to contain child elements
-
EXTERNAL FUNCTION MAKE-COMMENT
- PARENT
- &OPTIONAL
- TEXT
Creates a new comment node under the parent. Note that the node is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-DOCTYPE
- PARENT
- DOCTYPE
Creates a new doctype node under the parent. Note that the node is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-ELEMENT
- PARENT
- TAG
- &KEY
- CHILDREN
- ATTRIBUTES
Creates a standard DOM element with the given tag name and parent. Optionally a vector (with fill-pointer) containing children and an attribute-map (a hash-table with equalp test) can be supplied. Note that the element is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-FULLTEXT-ELEMENT
- PARENT
- TAG
- &KEY
- TEXT
- ATTRIBUTES
Creates a fulltext element under the parent. Optionally a text and an attribute-map (a hash-table with equalp test) can be supplied. Note that the element is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-PROCESSING-INSTRUCTION
- PARENT
- &KEY
- NAME
- TEXT
Creates an XML processing instruction under the parent. Note that the element is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-ROOT
- &OPTIONAL
- CHILDREN
Creates a root node with the given children. Children should be a vector with fill-pointer.
-
EXTERNAL FUNCTION MAKE-TEXT-NODE
- PARENT
- &OPTIONAL
- TEXT
Creates a new text node under the parent. Note that the node is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MAKE-XML-HEADER
- PARENT
- &KEY
- ATTRIBUTES
Creates an XML header object under the parent. Note that the element is automatically appended to the parent's child list.
-
EXTERNAL FUNCTION MATCHER-AND
- &REST
- MATCHERS
Creates a matcher function that returns if all of the sub-expressions return successfully. The last match is returned, if all.
-
EXTERNAL FUNCTION MATCHER-CHARACTER
- CHARACTER
Creates a matcher function that attempts to match the given character.
-
EXTERNAL FUNCTION MATCHER-FIND
- LIST
Creates a matcher function that returns T if the character is found in the given list.
-
EXTERNAL FUNCTION MATCHER-NEXT
- MATCHER
Creates a matcher environment that peeks ahead one farther.
-
EXTERNAL FUNCTION MATCHER-NOT
- MATCHER
Creates a matcher function that inverts the result of the sub-expression.
-
EXTERNAL FUNCTION MATCHER-OR
- &REST
- MATCHERS
Creates a matcher function that returns successfully if any of the sub-expressions return successfully. The first match is returned, if any.
-
EXTERNAL FUNCTION MATCHER-PREV
- MATCHER
Creates a matcher environment that peeks behind.
-
EXTERNAL FUNCTION MATCHER-RANGE
- FROM
- TO
Creates a matcher that checks a range according to the next character's CHAR-CODE.
-
EXTERNAL FUNCTION MATCHER-STRING
- STRING
Creates a matcher function that attempts to match the given string.
-
EXTERNAL FUNCTION NESTING-NODE-P
- OBJECT
Returns T if the given OBJECT is of type NESTING-NODE
-
EXTERNAL FUNCTION NEXT-ELEMENT
- CHILD
Returns the sibling element next to this one or NIL if it is already last. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION NEXT-SIBLING
- CHILD
Returns the sibling next to this one or NIL if it is already the last.
-
EXTERNAL FUNCTION NODE-P
- OBJECT
Returns T if the given OBJECT is of type NODE
-
EXTERNAL FUNCTION PEEK
Returns the next character, if any.
-
EXTERNAL FUNCTION PREPEND-CHILD
- PARENT
- CHILD
Prepends the given child onto the parent's child list. Returns the child. Note that this operation is costly, See VECTOR-PUSH-EXTEND-FRONT
-
EXTERNAL FUNCTION PREVIOUS-ELEMENT
- CHILD
Returns the sibling element before this one or NIL if it is already the first. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION PREVIOUS-SIBLING
- CHILD
Returns the sibling before this one or NIL if it is already the first.
-
EXTERNAL FUNCTION PROCESSING-INSTRUCTION-P
- OBJECT
Returns T if the given OBJECT is of type PROCESSING-INSTRUCTION
-
EXTERNAL FUNCTION PROCESSING-PARSER
- PROCESS-NAME
Return the processing-parser function for PROCESS-NAME. SETF-able.
-
EXTERNAL FUNCTION (SETF PROCESSING-PARSER)
- FUNC
- PROCESS-NAME
Set the processing-parser function for PROCESS-NAME.
-
EXTERNAL FUNCTION READ-ATTRIBUTE
Reads an attribute and returns it as a key value cons.
-
EXTERNAL FUNCTION READ-ATTRIBUTE-NAME
Reads an attribute name.
-
EXTERNAL FUNCTION READ-ATTRIBUTE-VALUE
Reads an attribute value, either enclosed in quotation marks or until a space or tag end.
-
EXTERNAL FUNCTION READ-ATTRIBUTES
Reads as many attributes as possible from a tag and returns them as an attribute map.
-
EXTERNAL FUNCTION READ-CHILDREN
Read all children of the current *root* until the closing tag for *root* is encountered.
-
EXTERNAL FUNCTION READ-NAME
Reads and returns a tag name.
-
EXTERNAL FUNCTION READ-ROOT
- &OPTIONAL
- ROOT
Creates a root element and reads nodes into it. Optionally uses the specified root to append child nodes to. Returns the root.
-
EXTERNAL FUNCTION READ-STANDARD-TAG
- NAME
Reads an arbitrary tag and returns it. This recurses with READ-CHILDREN.
-
EXTERNAL FUNCTION READ-TAG
Attempts to read a tag and dispatches or defaults to READ-STANDARD-TAG. Returns the completed node if one can be read.
-
EXTERNAL FUNCTION READ-TAG-CONTENTS
Reads and returns all tag contents. E.g. <foo bar baz> => bar baz
-
EXTERNAL FUNCTION READ-TEXT
Reads and returns a text-node.
-
EXTERNAL FUNCTION REMOVE-ATTRIBUTE
- ELEMENT
- ATTRIBUTE
Remove the specified attribute if it exists. Returns NIL.
-
EXTERNAL FUNCTION REMOVE-CHILD
- CHILD
Removes the child from its parent. Returns the child. Note that this operation is potentially very costly. See VECTOR-POP-POSITION
-
EXTERNAL FUNCTION REMOVE-PROCESSING-PARSER
- PROCESS-NAME
Remove the processing-parser for PROCESS-NAME.
-
EXTERNAL FUNCTION REMOVE-TAG-DISPATCHER
- NAME
- &OPTIONAL
- LIST
Removes the tag-dispatcher of the given name from the list.
-
EXTERNAL FUNCTION RENDER-TEXT
- NODE
"Renders" the text of this element and its children. In effect the text is gathered from the component and all of its children, but transforming the text in such a way that: - All ASCII white space (Space, Tab, CR, LF) is converted into spaces. - There are no consecutive spaces. - There are no spaces at the beginning or end. This is somewhat analogous to how the text will be shown to the user when rendered by a browser. Hence, render-text.
-
EXTERNAL FUNCTION REPLACE-CHILD
- OLD-CHILD
- NEW-CHILD
Replace the old child with a new one. Returns the old child.
-
EXTERNAL FUNCTION ROOT-P
- OBJECT
Returns T if the given OBJECT is of type ROOT
-
EXTERNAL FUNCTION SERIALIZE
- NODE
- &OPTIONAL
- STREAM
Serializes NODE to STREAM. STREAM can be a stream, T for *standard-output* or NIL to serialize to string.
-
EXTERNAL FUNCTION SET-ATTRIBUTE
- ELEMENT
- ATTRIBUTE
- VALUE
Synonymous to (SETF (ATTRIBUTE ..) ..)
-
EXTERNAL FUNCTION SIBLING-ELEMENTS
- CHILD
Returns the array of sibling elements of the given child. Note that this is a copy of the array, modifying it is safe. This excludes comments, text-nodes and the like.
-
EXTERNAL FUNCTION SIBLINGS
- CHILD
Returns the array of siblings of the given child. Note that this is a copy of the array, modifying it is safe.
-
EXTERNAL FUNCTION SLURP-STREAM
- STREAM
Quickly slurps the stream's contents into an array with fill pointer.
-
EXTERNAL FUNCTION SPLICE
- ELEMENT
Splices the contents of element into the position of the element in its parent. Returns the parent. Note that this operation is potentially very costly. See ARRAY-SHIFT
-
EXTERNAL FUNCTION STRIP
- NODE
Trim all text-nodes within NODE (at any depth) of leading and trailing whitespace. If their TEXT should be an empty string after trimming, remove them.
-
EXTERNAL FUNCTION TAG-DISPATCHER
- NAME
- &OPTIONAL
- LIST
Accessor to the tag-dispatcher of the given name.
-
EXTERNAL FUNCTION TEXT-NODE-P
- OBJECT
Returns T if the given OBJECT is of type TEXT-NODE
-
EXTERNAL FUNCTION TEXTUAL-NODE-P
- OBJECT
Returns T if the given OBJECT is of type TEXTUAL-NODE
-
EXTERNAL FUNCTION TRANSLATE-ENTITY
- TEXT
- &KEY
- START
- END
Translates the given entity identifier (a name, #Dec or #xHex) into their respective strings if possible. Otherwise returns NIL.
-
EXTERNAL FUNCTION TRIM
- NODE
Trim all text-nodes within NODE (at any depth) of leading and trailing whitespace.
-
EXTERNAL FUNCTION UNREAD
Steps back a single character if possible. Returns the new *INDEX*.
-
EXTERNAL FUNCTION UNREAD-N
- N
Steps back by N characters if possible. Returns the new *INDEX*.
-
EXTERNAL FUNCTION WRITE-ENCODE-CHAR
- CHAR
- STREAM
- &OPTIONAL
- ENCODE-WHITESPACE
Write and possibly encode the CHAR to STREAM. This also properly handles detection of invalid or discouraged XML characters. The following restarts are available in the case of a faulty character: ABORT Do not output the faulty character at all. USE-NEW-CHARACTER Output a replacement character instead. CONTINUE Continue and output the faulty character anyway. See INVALID-XML-CHARACTER See DISCOURAGED-XML-CHARACTER
-
EXTERNAL FUNCTION XML-HEADER-P
- OBJECT
Returns T if the given OBJECT is of type XML-HEADER
-
EXTERNAL GENERIC-FUNCTION ATTRIBUTES
- OBJECT
Returns an EQUALP hash-table of the element's attributes.
-
EXTERNAL GENERIC-FUNCTION (SETF ATTRIBUTES)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION CHILDREN
- OBJECT
Returns a vector of child-nodes that are contained within the node.
-
EXTERNAL GENERIC-FUNCTION (SETF CHILDREN)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION CLONE-NODE
- NODE
- &OPTIONAL
- DEEP
Clone the given node, creating a new instance with the same contents. If DEEP is non-NIL, the following applies: The text of COMMENT and TEXT-NODEs is copied as per COPY-SEQ. The children of NESTING-NODEs are copied as per (CLONE-CHILDREN CHILD T)
-
EXTERNAL GENERIC-FUNCTION DOCTYPE
- OBJECT
Returns the doctype node's actual doctype string.
-
EXTERNAL GENERIC-FUNCTION (SETF DOCTYPE)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION FAULTY-CHAR
- CONDITION
Returns the faulty char that caused the signal.
-
EXTERNAL GENERIC-FUNCTION (SETF FAULTY-CHAR)
- NEW-VALUE
- CONDITION
No documentation provided. -
EXTERNAL GENERIC-FUNCTION PARENT
- OBJECT
Returns the node's parent that should contain this element as a child.
-
EXTERNAL GENERIC-FUNCTION (SETF PARENT)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION PARSE
- INPUT
- &KEY
- ROOT
Parses the given input into a DOM representation. By default, methods for STRING, PATHNAME and STREAM are defined. If supplied, the given root is used to append children to as per READ-ROOT. Returns the root.
-
EXTERNAL GENERIC-FUNCTION SERIALIZE-OBJECT
- NODE
Serialize the given node and print it to *stream*.
-
EXTERNAL GENERIC-FUNCTION TAG-NAME
- OBJECT
Returns the element's tag name.
-
EXTERNAL GENERIC-FUNCTION (SETF TAG-NAME)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION TEXT
- OBJECT
Returns the node's textual content.
-
EXTERNAL GENERIC-FUNCTION (SETF TEXT)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION TRAVERSE
- NODE
- FUNCTION
- &KEY
- TEST
Traverse the NODE and all its children recursively, calling FUNCTION on the current node if calling TEST on the current node returns a non-NIL value. It is safe to modify the child array of the parent of each node passed to FUNCTION. NODE is returned.
-
EXTERNAL MACRO DEFINE-FULLTEXT-ELEMENT
- TAG
- &REST
- LISTS
Defines an element to be read as a full-text element. This means that it cannot contain any child-nodes and everything up until its closing tag is used as its text.
-
EXTERNAL MACRO DEFINE-MATCHER
- NAME
- FORM
Associates NAME as a keyword to the matcher form. You can then use the keyword in further matcher rules.
-
EXTERNAL MACRO DEFINE-PROCESSING-PARSER
- PROCESS-NAME
- &BODY
- BODY
Defines a new processing-instruction parser. It is invoked if a processing-instruction (<?) with PROCESS-NAME is encountered. The lexer will be at the point straight after reading in the PROCESS-NAME. Expected return value is a string to use as the processing-instructions' TEXT. The closing tag (?>) should NOT be consumed by a processing-parser.
-
EXTERNAL MACRO DEFINE-SELF-CLOSING-ELEMENT
- TAG
- &REST
- LISTS
Defines an element that does not need to be closed with /> and cannot contain child nodes.
-
EXTERNAL MACRO DEFINE-TAG-DISPATCHER
- NAME
- &REST
- LISTS
- TAGVAR
- &BODY
- BODY
Defines a new tag dispatcher. It is invoked if TEST-FORM passes. NAME --- Name to discern the dispatcher with. LISTS --- Symbols of lists to which the dispatcher should be added. TAGVAR --- Symbol bound to the tag name. BODY --- Body forms describing the test to match the tag.
-
EXTERNAL MACRO DEFINE-TAG-PARSER
- NAME
- TAGVAR
- &BODY
- BODY
Defines the parser function for a tag dispatcher. NAME --- The name of the tag dispatcher. If one with this name cannot be found, an error is signalled. TAGVAR --- Symbol bound to the tag name. BODY --- Body forms describing the tag parsing behaviour. -
EXTERNAL MACRO DEFINE-TAG-PRINTER
- NAME
- NODEVAR
- &BODY
- BODY
Defines the printer function for a tag dispatcher. NAME --- The name of the tag dispatcher. If one with this name cannot be found, an error is signalled. TAGVAR --- Symbol bound to the tag name. BODY --- Body forms describing the printing behaviour. Write to the stream bound to PLUMP-DOM:*STREAM*. -
EXTERNAL MACRO DEFINE-WILDCARD-DISPATCHER
- NAME
- &REST
- LISTS
No documentation provided. -
EXTERNAL MACRO DO-TAG-PARSERS
- TEST
- PARSER
- &OPTIONAL
- RESULT-FORM
- &BODY
- BODY
Iterates over the current *TAG-DISPATCHERS*, binding the TEST and PARSER functions. Returns RESULT-FORM's evaluated value.
-
EXTERNAL MACRO DO-TAG-PRINTERS
- TEST
- PRINTER
- &OPTIONAL
- RESULT-FORM
- &BODY
- BODY
Iterates over the current *TAG-DISPATCHERS*, binding the TEST and PRINTER functions. Returns RESULT-FORM's evaluated value.
-
EXTERNAL MACRO MAKE-MATCHER
- FORM
Macro to create a matcher chain.
-
EXTERNAL MACRO MATCHER-ANY
- &REST
- IS
Shorthand for (or (is a) (is b)..)
-
EXTERNAL MACRO WITH-LEXER-ENVIRONMENT
- STRING
- &BODY
- BODY
Sets up the required lexing environment for the given string.
-
EXTERNAL SETF-EXPANDER TAG-DISPATCHER
- NAME
- &OPTIONAL
- LIST
No documentation provided.