SXML/xexp Representation of XML and HTML in Racket
(require (planet neil/xexp:2:1)) |
1 Introduction
1.1 Differences with SXML
xexp syntax must be ordered as in SXML first normal form (1NF). For example, any attributes list must precede child elements. SXML/xexp tools may be permissive about accepting other orderings, but generally should not emit any ordering but 1NF ordering.
The SXML keyword symbols, such as *TOP* may be in lowercase (e.g., *top*)
xexp adds a special & syntax for character entity references. The syntax is (& val), where val is the symbolic name of the character as a symbol, or an integer with the numeric value of the character.
2 SXML and SXML/xexp Tools
Writing HTML from SXML/xexp. | |
Writing HTML from SXML/xexp templates. | |
Permissively parsing HTML to SXML/xexp. | |
Example-based SXPath query generation for SXML/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. |
3 Definitions
Some definitions used by many SXML/xexp packages...
3.1 Exceptions
(struct exn:fail:invalid-xexp exn:fail ( expected context-xexp invalid-xexp) #:extra-constructor-name make-exn:fail:invalid-xexp #:transparent) expected : string? context-xexp : any/c invalid-xexp : any/c
(raise-invalid-xexp-exn error-name-sym #:expected expected #:invalid-xexp invalid-xexp maybe-context-xexp)
error-name-sym = symbol? expected = string? invalid-xexp = any/c maybe-context-xexp =
| #:context-xexp any/c
3.2 Misc.
> (make-xexp-char-ref 'rArr) (& rArr)
> (make-xexp-char-ref 151) (& 151)
> (xexp-char-ref-value '(& nbsp)) nbsp
> (xexp-char-ref-value '(& 2000)) 2000
4 History
- PLaneT 2:1 —
2012-06-13 Added provide for make-xexp-char-ref.
Added a little more documentation.
- PLaneT 2:0 —
2012-06-12 Somewhat heavy changes. (Previous version was labeled as in-development, as is this one.)
Converted to McFly.
Removed the typed/racket/base/no-check for now.
- Version 0.1 —
PLaneT 1:0 — 2011-08-21 Part of forked development from HtmlPrag.
5 Legal
Copyright 2011 – 2012 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, 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.