From: Lucian Mogosanu Date: Tue, 26 Feb 2019 19:58:21 +0000 (+0200) Subject: drafts, 086: Massage descriptions X-Git-Tag: v0.11~91 X-Git-Url: https://git.mogosanu.ro/?a=commitdiff_plain;h=a18b98f54f0a42e433f5dfc54bac5d237363c76b;p=thetarpit.git drafts, 086: Massage descriptions --- diff --git a/drafts/086-s-xml.markdown b/drafts/086-s-xml.markdown index 7323358..1af3895 100644 --- a/drafts/086-s-xml.markdown +++ b/drafts/086-s-xml.markdown @@ -18,27 +18,27 @@ The first item to be published is S-XML, an XML parser written in Common Lisp. Both the name and the code have been lifted from files [published][s-xml] by one [nonperson][nonperson] known as Sven Van Caekenberghe, who, fortunately, wrote a library that is relatively small -(around a thousand LoC), is organized so that it can be grasped in one -sitting, and is known to work[^2]. Unfortunately though, as with most -(all?) heathen programs encountered, this one isn't without warts. Thus, -in addition to providing a patch, this article discusses the structure -of S-XML and its current problems. +(around a thousand LoC), is organized so that it can be grasped in a +relatively short time, and is known to work[^2]. Unfortunately though, +as with most (all?) heathen programs encountered, this one isn't without +warts. Thus, in addition to providing a patch, this article discusses +the structure of S-XML and its current problems. The patch for S-XML is available in my [V source repository][s-xml-v]. Now, as to the library itself, it is structured as follows. -S-XML contains two layers of abstraction: a. the core parsing code, that -reads characters from a stream and returns XML elements, stored in -`xml.lisp`; b. a series of wrappers over the parser that take the parser -results and give them a particular structure; and c. an interface -between (a) and (b), stored in `dom.lisp`. In fact, one could say that -the layering goes exactly the other way around: the code in (b) provides -a set of functions for the parser (a), while the parser takes a -string/stream, reads it and calls the functions provided by (b) so it -can decide what to do once it has all the required data, e.g. tags, -attributes etc. The wrappers in (b) are stored in `xml-struct-dom.lisp`, -`lxml-dom.lisp` and `sxml-dom.lisp`[^3]. +S-XML contains three layers of abstraction: a. the core parsing code, +that reads characters from a stream and returns XML elements, stored in +`xml.lisp`; b. a series of so-called "wrappers" over the parser that +take its results and give them a particular structure; and c. an +interface between (a) and (b), stored in `dom.lisp`. In fact, one could +say that the layering goes exactly the other way around: the code in (b) +provides a set of functions for the parser (a), while the parser takes a +string/stream, processes it and calls the functions provided by (b) so +that it can decide what to do once it has all the required data, +e.g. tags, attributes etc. The wrappers in (b) are stored in +`xml-struct-dom.lisp`, `lxml-dom.lisp` and `sxml-dom.lisp`[^3]. The advantage of this design is that it doesn't constrain the user to any particular DOM tree representation. Personally, I find this @@ -56,7 +56,7 @@ Until then, however, the thing works, so it's all the better to publish it than to wait for the moment when said hero gets off his or her ass and makes the thing shine. Meanwhile, the more pressing matter for yours truly, and the next episode of this series, will involve publishing a -small RSS/Atom parser based on S-XML. +small RSS/Atom parser based on S-XML DOM trees. [^1]: This style, nowadays immediately recognizable by TMSR citizens as the "FFA style", draws from [Asciilifeform][alf]'s @@ -79,7 +79,7 @@ small RSS/Atom parser based on S-XML. [botworks]: /posts/y05/080-botworks-regrind.html [s-xml]: https://archive.is/Ra6bA [nonperson]: http://btcbase.org/log-search?q=nonperson -[s-xml-v]: http://lucian.mogosanu.ro/src/ TODO update this with actual dir +[s-xml-v]: http://lucian.mogosanu.ro/src/s-xml [lxml]: https://archive.is/DpZnN [sxml]: https://archive.is/Sl4Ev [hallucinated-freedom]: http://trilema.com/2017/the-practical-costs-of-hallucinated-freedom/