|(require (planet neil/xexp:1:=0))|
Note: This package is in a state of active development, and some interface changes, perhaps not backward-compatible, are expected. Documentation is gravely lacking.
SXML is a representation for XML in Scheme, defined by Oleg Kiselyov. “SXML/xexp” is the temporary name for a format for Racket that’s based on SXML and is mostly compatible with it. The current plan is, hopefully, for the “/xexp” part of the name to go away, and for SXML and xexp to merge. For now, Racket language identifiers based on SXML/xexp will have “xexp” instead of “sxml”, because we do not want to call something “SXML” if it is not strictly SXML. (And, historically, xexp was much more different from SXML, while we experimented with unifying SXML, SHTML, and PLT xexpr, but we have decided to move back to as compatible with SXML as practical.) This documentation will be fleshed out in a later version of the SXML/xexpr tools.
Libraries using xexp include:
Permissively parsing HTML to xexp.
Writing HTML from xexp.
Writing HTML from xexp templates.
Example-based SXPath query generation for xexp.
There are also libraries for SXML, which generally can be used for xexp:
XPath query language implementation for SXML, by Oleg Kiselyov.
Pattern-matching of SXML, by Jim Bender.
Parsing of XML to SXML, by Oleg Kiselyov, and maintained by Kirill Lisovsky.
Some definitions used by many SXML/xexp packages...
|(make-invalid xexp-exc) → any/c|
|xexp-exc : any/c|
|(raise-invalid-xexp-error) → any/c|
The following definitions are used by some xexp-related libraries.
|(make-xexp-char-ref val) → any/c|
|val : any/c|
Yields an xexp character entity reference for val. For example:
(make-xexp-char-ref "rArr") ==> (& rArr) (make-xexp-char-ref (string->symbol "rArr")) ==> (& rArr) (make-xexp-char-ref 151) ==> (& 151)
|(xexp-char-ref-value obj) → any/c|
|obj : any/c|
Yields the value for the xexp entity obj, or #f if obj is not a recognized entity. Values of named entities are symbols, and values of numeric entities are numbers. An error may raised if obj is an entity with system ID inconsistent with its public ID. For example:
(define (f s) (xexp-char-ref-value (cadr (html->xexp s)))) (f " ") ==> nbsp (f "ߐ") ==> 2000
Version 0.1 —
2011-08-21 — PLaneT (1 0)
Part of forked development from HtmlPrag.
Copyright (c) 2011 Neil Van Dyke. This program is Software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License (LGPL 3), or (at your option) any later version. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See http://www.gnu.org/licenses/ for details. For other licenses and consulting, please contact the author.
Standard Documentation Format Note: The API signatures in this documentation are likely incorrect in some regards, such as indicating type any/c for things that are not, and not indicating when arguments are optional. This is due to a transitioning from the Texinfo documentation format to Scribble, which the author intends to finish someday.