Good stuff for programming geeks
[ start | index | login or register ]
start > PXSL

PXSL

Created by tmoertel. Last edited by tmoertel 436 days ago. Viewed 13884 times. #12
[diff] [history] [edit] [rdf]
labels
Category:Programming
attachments

PXSL – Parsimonious XML Shorthand Language

Quick links:
>>Docs, Source, and Downloads | PXSL/FAQs | PXSL Ask-a-Question
PXSL/Examples | PXSL/Links | PXSL/Changelog

PXSL ("pixel") is a convenient shorthand for writing markup-heavy XML documents. It provides XML authors and programmers with a simple, concise syntax that they can use to create XML documents. For more advanced users, PXSL offers customizable shortcuts and sophisticated refactoring tools like functional macros that can markedly reduce the size and complexity of markup-dense XML documents.

The short version is this: PXSL is XML turned inside-out. Instead of tagging the structure, you tag the non-structure, which is the better approach when most of your information is structure.

For more on PXSL, >>read the online documentation.

Examples

MathML in XML                   MathML in PXSL

<declare type="fn"> declare -type=fn <ci> f </ci> ci << f >> <lambda> lambda <bvar><ci> x </ci></bvar> bvar <apply> ci << x >> <plus/> apply <apply> plus <power/> apply <ci> x </ci> power <cn> 2 </cn> ci << x >> </apply> cn << 2 >> <ci> x </ci> ci << x >> <cn> 3 </cn> cn << 3 >> </apply> </lambda> </declare>

Simple doc in XML               Equivalent PXSL

<!-- my document --> -- my document <doc keywords="x y z"> doc -keywords=<<x y z>> <title> title My title <<My title>> </title> body -id=db13 <body id="db13"> <<This is multi- This is multi- line text.>> line text. </body> </doc>

tmoertel

Icon-Comment rmz, 1484 days ago. Icon-Permalink

Nice! Whereas this has a kinda python-like syntax, it reminds me of a lisp-like XML shorthand I had used before.

(doc keywords="x y z" (title "my title") (body id="db13" "This is multi- line text. ))

and

(declare type="fn" (ci f) (lambda (bvar (ci "x")) (apply (plus) (apply (power) (ci "x") (cn "2")) (ci "x") (cn "2"))))

Too bad your blogging thing can't put in the line breaks and indentation. Suffice it to say, indent it exactly like lisp. Just 2-characters-per-tag longer than PXSL, but it doesn't depend on the indentation, so you can write stuff like

(table (tr (td "a") (td "b")))

all on one line.

Icon-Comment tmoertel, 1484 days ago. Icon-Permalink

I prefer to think of it as Haskell-like indentation syntax, if you don't mind. :)

If you like lisp-ish syntax, take a look at >>SXML. For a list of other XML shorthands, see the PXSL FAQs.

(BTW, you can insert code into your comments by wrapping it within {code} delimiters.)

Please login to post a comment.
community.moertel.com | Copyright © 2003–07 Moertel Consulting