Common Lisp Package: XMLS-TOOLS

README:

FUNCTION

Public

FIND-SUBTREE (XML-TREE PATH-SPEC)

Finds the node requested by PATH-SPEC by traversing XML-TREE in the manner specified by PATH-SPEC. PATH-SPEC is a list of nodes to visit after the root node to reach the final destination listed in the order they are to be visited. Each node is either an XMLS:NODE-NAME or a cons of an XMLS:NODE-NAME and an integer specifying which of a number of possible matches to return (starting from 0) For example, to find the second c element in the following XMLS tree: ("a" NIL (("b" . "foo") NIL (("c" . "foo") NIL "Hello") (("c" . "foo") NIL "World"))) The following PATH-SPEC could be used: (("b" . "foo") (("c" . "foo") 1)) Note: FIND-SUBTREE supports FIND-CHILD's optional namespace, so the following is equally permissible: ("b" ("c" 1))

VALIDATE-XML (XML RULES)

Accepts an XML tree as generated by xmls and checks it against RULES to determine if the XML is valid for that DTD. Returns two values: T or NIL depending on whether the XML passes as valid, and an error message string in the case of the XML being invalid.

Undocumented

FIND-ALL-CHILDREN (XML-TREE CHILD-NAME &KEY CHILD-NAMESPACE)

FIND-CHILD (XML-TREE CHILD-NAME &KEY (SKIP-MATCHES 0) (SKIP-CHILDREN 0) CHILD-NAMESPACE)

GET-ATTR-VALUE (ATTR-NAME XML)

GET-PCDATA (XML-CHILDREN &OPTIONAL (OUT-STRING ))

MAKE-XML-PARSER (&OPTIONAL (DEFAULT-HANDLER #'IGNORE-ELEMENT))

SEARCH-CHILDREN (ELEMENT-NAME XML-CHILDREN)

XHTML-TO-TEXT (XML)

Private

EXTRACT-XML-CONTENT-ELEMENTS (CHILD-LIST)

Takes CHILD-LIST, a list of objects existing as children for a parent tree, and returns a list of the names of any elements and :PCDATA for any character data.

VALIDATE-ATTRIBUTES-AGAINST-RULES (ATTRIBS RULES)

Takes a list of XML attributes in ATTRIBS and checks against rules to ensure they all belong, have the correct form and no required attributes are missing

VALIDATE-CHILDREN (CHILDREN RULES)

Validates each subtree given in CHILDREN against RULES

VALIDATE-CHILDREN-AGAINST-RULES (CHILD-SUMMARY-LIST RULES)

Checks that all subtree elements in CHILD-SUMMARY-LIST exist as being permissible in RULES - a subset of the global RULES DTD which defines what children are permissible for this child list's parent element. Also ensures that all elements occur the correct number of times as defined by RULES.

VALIDATE-TREE (XML RULES)

Does the actual validation work as defined by validate-xml. Use validate-xml

Undocumented

%COMPRESS-WHITESPACE (STRING)

IGNORE-ELEMENT (TREE &REST ARGS)

SPEC-ENUMERATION (SPEC)

TEXT-LINES (STRING)

MACRO

Public

Undocumented

DEF-ELEMENT-HANDLER (ELEMENT-NAME (XML-TREE-NAME &REST ARGS) (XML-PARSER) &BODY HANDLER-CODE)

PROCESS-XML (TREE &REST ARGS)

WITH-PARSER (XML-PARSER &BODY BODY)

WITH-STATE ((STATE-KEY STATE-VALUE) &BODY BODY)

Private

Undocumented

COMPRESS-WHITESPACE (STRING)

HANDLE-MAYBE-TEXT-CHILDREN (TREE OUT-STREAM)

HANDLE-NON-TEXT-CHILDREN (TREE OUT-STREAM)

WITH-INDENT (STREAM &BODY BODY)

VARIABLE

Private

Undocumented

*XHTML-TO-TEXT-PARSER*