Common Lisp Package: ORG.IODB.XML-MOP

xml-mop allows representing parts of XML documents as CLOS objects

README:

FUNCTION

Public

PARSE-XML-STREAM (STREAM ACCEPTABLE-ROOT-CLASSES)

This is where we interact with s-xml. Returns a list of the parsed root elements. Usually there is only one unless you are doing something weird.

Private

ACTIVE-HANDLE-FINISH-ELEMENT (NAME ATTRIBUTES PARENT-SEED SEED)

Called when the end of an element is encountered and we are in the process of churning out objects.

ACTIVE-HANDLE-NEW-ELEMENT (NAME ATTRIBUTES SEED)

Called when an element is encountered and we are in the process of churning out objects.

ACTIVE-HANDLE-TEXT (STRING SEED)

Called when text is encountered and we are in the process of churning out objects.

ACTIVE-PARSE-STREAM (STREAM DOC-CLASS)

This is where we interact with s-xml.

ASSIGN-CHILD-ELEMENT (PARENT-ELEMENT NEW-CHILD-ELEMENT PARENT-SLOT)

Assigns a child element to the given slot of the parent element. This function takes into account the user's preferences for child element plurality and type conversion of the element.

DESTRUCTURE-SEED (SEED)

Returns multiple values: 1. element stack 2. allowed-root-element-classes 3. root elements 4. slot

GENERATE-SEED (ELEMENT-STACK ALLOWED-ROOT-ELEMENT-CLASSES ROOT-ELEMENTS PARENT-SLOTS)

Generates the seed that is passed along as an XML stream is parsed. This is currently not the greatest system because of how the parse system is set up (event-driven, and does not allow extra consumption). Currently a seed encodes the following data: the element classes allowed as root elements * a list of root elements encountered so far * the corresponding slots on the element stack * the element stack as a list * a list of slots that correspond to elements on the stack, which will be assigned when elements on the stack are popped off

RESOLVE-NODE-DESCRIPTOR-DEFINITION (DESCRIPTOR-DEFINITION)

Takes either a list of descriptor-definitions or a single descriptor definition.

RESOLVE-SUBELEMENT-DESCRIPTOR-DEFINITION (DESCRIPTOR-DEFINITION)

Does not allow multiple descriptor definitions as is the case for a node descriptor.

Undocumented

ASSIGN-NODE-TAG-DESCRIPTORS (NODE-CLASS PARSED-TAG-DESCRIPTORS)

DESCRIPTOR-MATCHES? (DESCRIPTOR TEST-STRING)

DETERMINE-ELEMENT-CLASS-MATCHING-TAG (ALLOWED-ELEMENT-CLASS TAG-NAME)

ENSURE-LIST (MY-LIST)

PARSE-NODE-TAG-DESCRIPTORS (TAG-DESCRIPTORS)

PARSE-SUBELEMENT-DESCRIPTOR-ALIASES (&KEY ELEMENT-TYPE ALIAS MULTIPLE)

MACRO

Private

Undocumented

DEFMETHOD (&WHOLE FORM NAME &BODY BODY &ENVIRONMENT ENV)

GENERIC-FUNCTION

Public

CHILD-ELEMENT-VALUE (CHILD-ELEMENT PARENT-ELEMENT PARENT-SLOT)

Returns the value that child-element takes when assigned to parent-slot on parent-element

ELEMENT-VALUE (ELEMENT)

Returns the 'value' of the element in general. This depends on the element. For example, if it is a price, then this might return a number in US cents. This function is called on the element by default before it is assigned as the slot-value to a parent element.

ON-LOADED-FROM-XML (ELEMENT)

Called when the element has finished loading in the xml stream.

ON-START-XML-LOAD (ELEMENT)

Called when the element has started to load in the xml stream. After attribs have been assigned.

Private

DESCRIPTOR-MATCHES-NAME? (DESCRIPTOR TEST-STRING)

Determines if the given descriptor matches the test string. Remember, a descriptor is a way to specify nodes in an XML document. The test string is a node name, probably a tag or attribute.

FIND-ALLOWED-ELEMENT (PARENT-ELEMENT TAG-NAME)

Finds the element class underneath parent-element that corresponds to the tag string.

FIND-SLOT-MATCHING-SUBELEMENT (ELEMENT TAG-NAME)

Finds a slot in an element class that matches the tag-name given

FIND-SUBELEMENT-MATCHING-TAG (PARENT-ELEMENT TAG-NAME)

Finds the most specific sub-element class of the supplied parent element (generally an element class) that matches the tag string. This will check the slot definitions of the class for a slot with matching 'subelement' descriptor, and then check the allowed-subelements field of the class.

PROCESS-ELEMENT (PARENT-ELEMENT TAG-NAME ATTRIBUTES)

Adds the child element with the given tag name and attribs to the parent elem.

Undocumented

ASSIGN-ATTRIBUTE (ELEMENT NAME ATTR-VALUE)

ASSIGN-ATTRIBUTES (ELEMENT ATTRIBUTES)

CONDITION-ELEMENT-NAME (CONDITION)

SETFCONDITION-ELEMENT-NAME (NEW-VALUE CONDITION)

CONDITION-PARENT-ELEMENT (CONDITION)

SETFCONDITION-PARENT-ELEMENT (NEW-VALUE CONDITION)

FINALIZE-AFTER-PARSE (ELEMENT)

FIND-SLOT-MATCHING-ATTRIBUTE (ELEMENT ATTR-NAME)

NODE-CLASS-ALLOWED-ELEMENTS (OBJECT)

SLOT-ACCESSOR

Public

Undocumented

ELEMENT-TEXT (OBJECT)

SETFELEMENT-TEXT (NEW-VALUE OBJECT)

Private

DESCRIPTOR-PRIMARY-DESCRIPTION (OBJECT)

If this is true, then this is the description used to output an XML version of this descriptor.

DESCRIPTOR-TAG-ALIASES (OBJECT)

alternative node descriptors for this subelement.

PARSER-CASE-INSENSITIVE-TABLE (OBJECT)

For looking up member elements by tag name.

PARSER-CASE-SENSITIVE-TABLE (OBJECT)

For looking up member elements by tag name.

PARSER-LAMBDA-TABLE (OBJECT)

For looking up elements by calling a test function.

Undocumented

DESCRIPTOR-CASE-SENSITIVE (OBJECT)

DESCRIPTOR-ELEMENT-TYPE (OBJECT)

DESCRIPTOR-MATCHER (OBJECT)

DESCRIPTOR-MULTIPLE (OBJECT)

ELEMENT-CLASS-AUTO (OBJECT)

SETFELEMENT-CLASS-AUTO (NEW-VALUE OBJECT)

ELEMENT-CLASS-PARSER (OBJECT)

ELEMENT-CLASS-REDUCES-TO (OBJECT)

SETFELEMENT-CLASS-REDUCES-TO (NEW-VALUE OBJECT)

ELEMENT-CLASS-TAG-DESCRIPTORS (OBJECT)

SETFELEMENT-CLASS-TAG-DESCRIPTORS (NEW-VALUE OBJECT)

ELEMENT-SLOT-ATTRIBUTE (OBJECT)

SETFELEMENT-SLOT-ATTRIBUTE (NEW-VALUE OBJECT)

ELEMENT-SLOT-ATTRIBUTES (SLOT-DEFINITION)

SETFELEMENT-SLOT-ATTRIBUTES (NEW-VALUE OBJECT)

ELEMENT-SLOT-SUBELEMENT (OBJECT)

SETFELEMENT-SLOT-SUBELEMENT (NEW-VALUE OBJECT)

ELEMENT-SLOT-SUBELEMENTS (SLOT-DEFINITION)

SETFELEMENT-SLOT-SUBELEMENTS (NEW-VALUE OBJECT)

ELEMENT-TAG-STRING (OBJECT)

SETFELEMENT-TAG-STRING (NEW-VALUE OBJECT)

SETFNODE-CLASS-ALLOWED-ELEMENTS (NEW-VALUE OBJECT)

CLASS

Public

ELEMENT-CLASS

A metaclass for XML elements. An additional option that can be passed to element classes is the :tags option, which accepts a sequence of node-string identifiers.

Undocumented

ELEMENT

Private

ELEMENT-DIRECT-SLOT-DEFINITION

Direct slots of ELEMENT-CLASS (that is those that are defined in a defclass form where element-class is the metaclass) have an ATTRIBUTE and SUBELEMENT property. These direct slot definitions are transformed into effective slot definitions in compute-effective-slot-definition.

NAMED-NODE-DESCRIPTOR

This is the standard way to describe an XML node. A node descriptor helps map from a cased or uncased string to a handler class or function. Several descriptors may map to a single element.

STANDARD-PARSER

The parser class keeps track of element or attributes an XML node can have. Typically, each element class has a parser associated with it that will attempt to look up a node. If that fails, a parser is invoked for the document.

SUBELEMENT-DESCRIPTOR

Describes a subelement associated with a slot on an element class.

Undocumented

ELEMENT-EFFECTIVE-SLOT-DEFINITION

XML-TREENODE-CLASS

CONDITION

Public

ENCOUNTERED-UNKNOWN-ELEMENT

Raised when an element is encountered with no matching xml-mop class.

Private

Undocumented

ENCOUNTERED-UNMATCHED-ATTRIBUTE