xml.lsp
Module: XML
Author: Jeff Ober
Version: 2.1
Original location: http://static.artfulcode.net/newlisp/xml.lsp
Source: xml.lsp
Package definition: xml.qwerty
Parsing and serializing of XML data (updated for newlisp 10).
Functions to parse XML text (non-validating) and serialize lisp structures to XML. Requires matching and newlisp 10.Version history
2.1 • code clean-up • updated for newlisp 10 • some arguments have changed in lisp->xml and xml->lisp • default encoding is now determined by newlisp UTF-8 compile options • added functions to trim whitespace and decode entities
2.0 • complete rewrite • added XML-compliant entities • automatic serialization of data
1.0 • initial release- § -
XML:trim-whitespace
syntax: (XML:trim-whitespace str)
parameter: str - a string
Trims all whitespace off both ends of str.
- § -
XML:decode
syntax: (XML:decode str)
parameter: str - a string
Decodes XML entities and converts them to characters.
- § -
XML:encode
syntax: (XML:encode str)
parameter: str - a string
Encodes characters in a string to be valid for XML.
- § -
XML:lisp->xml
syntax: (XML:lisp->xml sxml-list [indent? [str-encoding]])
parameter: sxml-list - an SXML list
parameter: indent? - optional; whether or not to format the resulting XML (default nil)
parameter: str-encoding - optional; sets the encoding in the declaration
Serializes an SXML list (equivalent to parsing an XML document with (xml-type-tags nil nil nil nil) and options 1 and 16). The encoding in the declaration defaults to UTF-8 if newlisp was compiled with UTF-8 support, ASCII otherwise.
- § -
XML:xml->lisp
syntax: (XML:xml->lisp str-xml)
parameter: str-xml - an XML string
Parses str-xml and returns an SXML list. Uses newlisp's built-in parser.
Equivalent to:
(begin (xml-type-tags nil nil nil) (xml-parse str-xml (+ 1 16)))- ∂ -
Artful Code
generated with newLISP and newLISPdoc