s-xml

API Reference

s-xml

Simple Common Lisp XML Parser

S-XML

A simple XML parser with an efficient, purely functional, event-based interface as well as a DOM interface
  • Condition XML-PARSER-ERROR  (ERROR)
    Thrown by the XML parser to indicate errorneous input
  • Function PARSE-ATTRIBUTE-NAME (string)
    Default parser for the attribute name
  • Function PARSE-ATTRIBUTE-VALUE (name string)
    Default parser for the attribute value
  • Variable *ATTRIBUTE-NAME-PARSER*
    #'s-xml:parse-attribute-name
    Called to compute interned attribute name from a buffer that will be reused
  • Variable *ATTRIBUTE-VALUE-PARSER*
    #'s-xml:parse-attribute-value
    Called to compute an element of an attribute list from a buffer that will be reused
  • Function PRINT-STRING-XML (string stream &key (start 0) end)
    Write the characters of string to stream using basic XML conventions
  • Variable *IGNORE-NAMESPACES*
    nil
    When t, namespaces are ignored like in the old version of S-XML
  • Variable *LOCAL-NAMESPACE*
    (make-instance 's-xml::xml-namespace :uri "local" :prefix "" :package
                   (find-package :keyword))
    The local (global default) XML namespace
  • Variable *NAMESPACES*
    `(("xml" . ,s-xml::*xml-namespace*) ("" . ,s-xml:*local-namespace*))
    Ordered list of (prefix . XML-namespace) bindings currently in effect - special variable
  • Function FIND-NAMESPACE (uri)
    Find a registered XML namespace identified by uri
  • Function REGISTER-NAMESPACE (uri prefix package)
    Register a new or redefine an existing XML namespace defined by uri with prefix and package
  • Function SPLIT-IDENTIFIER (identifier)
    Split an identifier 'prefix:name' and return (values prefix name)
  • Variable *REQUIRE-EXISTING-SYMBOLS*
    nil
    If t, each XML identifier must exist as symbol already
  • Variable *AUTO-EXPORT-SYMBOLS*
    t
    If t, export newly interned symbols form their packages
  • Function RESOLVE-IDENTIFIER (identifier namespaces &optional as-attribute)
    Resolve the string identifier in the list of namespace bindings
  • Variable *AUTO-CREATE-NAMESPACE-PACKAGES*
    t
    If t, new packages will be created for namespaces, if needed, named by the prefix
  • Function EXTEND-NAMESPACES (attributes namespaces)
    Given possible 'xmlns[:prefix]' attributes, extend the namespaces bindings
  • Function PRINT-IDENTIFIER (identifier stream &optional as-attribute)
    Print identifier on stream using namespace conventions
  • Class XML-PARSER-STATE
    The XML parser state passed along all code making up the parser
    ENTITIES   Accessor: GET-ENTITIES
    A hashtable mapping XML entity names to their replacement stings
    SEED   Accessor: GET-SEED
    The user seed object
    BUFFER   Accessor: GET-BUFFER
    The main reusable character buffer
    MINI-BUFFER   Accessor: GET-MINI-BUFFER
    The secondary, smaller reusable character buffer
    NEW-ELEMENT-HOOK   Accessor: GET-NEW-ELEMENT-HOOK
    Called when new element starts
    FINISH-ELEMENT-HOOK   Accessor: GET-FINISH-ELEMENT-HOOK
    Called when element ends
    TEXT-HOOK   Accessor: GET-TEXT-HOOK
    Called when text is found
  • Function START-PARSE-XML (stream &optional (state (make-instance 'xml-parser-state)))
    Parse and return a toplevel XML element from stream, using parser state
  • Generic-Function PARSE-XML-DOM (stream output-type)
    Parse a character stream as XML and generate a DOM of output-type
  • Function PARSE-XML (stream &key (output-type :lxml))
    Parse a character stream as XML and generate a DOM of output-type, defaulting to :lxml
  • Function PARSE-XML-STRING (string &key (output-type :lxml))
    Parse a string as XML and generate a DOM of output-type, defaulting to :lxml
  • Function PARSE-XML-FILE (filename &key (output-type :lxml))
    Parse a character file as XML and generate a DOM of output-type, defaulting to :lxml
  • Generic-Function PRINT-XML-DOM (dom input-type stream pretty level)
    Generate XML output on a character stream from a DOM of input-type, optionally pretty printing using level
  • Function PRINT-XML (dom &key (stream t) (pretty nil) (input-type :lxml) (header))
    Generate XML output on a character stream (t by default) from a DOM of input-type (:lxml by default), optionally pretty printing (off by default), or adding a header (none by default)
  • Function PRINT-XML-STRING (dom &key (pretty nil) (input-type :lxml))
    Generate XML output to a string from a DOM of input-type (:lxml by default), optionally pretty printing (off by default)
  • Method PARSE-XML-DOM (stream (output-type (eql :lxml)))
  • Method PRINT-XML-DOM (dom (input-type (eql :lxml)) stream pretty level)
  • Method PARSE-XML-DOM (stream (output-type (eql :sxml)))
  • Method PRINT-XML-DOM (dom (input-type (eql :sxml)) stream pretty level)
  • Function XML-ELEMENT-P (object)
  • Function XML-ELEMENT-NAME (instance)
  • Function (setf XML-ELEMENT-NAME) (value instance)
  • Function XML-ELEMENT-ATTRIBUTES (instance)
  • Function (setf XML-ELEMENT-ATTRIBUTES) (value instance)
  • Function XML-ELEMENT-CHILDREN (instance)
  • Function (setf XML-ELEMENT-CHILDREN) (value instance)
  • Function MAKE-XML-ELEMENT (&key ((name name) nil) ((attributes attributes) nil) ((children children) nil))
  • Function XML-ELEMENT-ATTRIBUTE (xml-element key)
    Return the string value of the attribute with name the keyword :key of xml-element if any, return null if not found
  • Function (setf XML-ELEMENT-ATTRIBUTE) (value xml-element key)
    Set the string value of the attribute with name the keyword :key of xml-element, creating a new attribute if necessary or overwriting an existing one, returning the value
  • Function NEW-XML-ELEMENT (name &rest children)
    Make a new xml-element with name and children
  • Function FIRST-XML-ELEMENT-CHILD (xml-element)
    Get the first child of an xml-element
  • Method PRINT-XML-DOM (xml-element (input-type (eql :xml-struct)) stream pretty level)
  • Method PARSE-XML-DOM (stream (output-type (eql :xml-struct)))