latest
s-i-e-v-e/sxmlSXML is XML written using s-expr syntax.
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers




JSR Score
64%
Published
a year ago (0.1.2)
SXML ("S-expression-based XML")
SXML is XML written using s-expr syntax.
Syntax
XHTML/XML:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>An example page</title> </head> <body> <h1 id="greeting">Hi, there!</h1> <p>This is just an >>example<< "to" show XHTML & SXML.</p> </body> </html>
Equivalent SXML:
(html @xmlns "http://www.w3.org/1999/xhtml" @xml:lang "en" @lang "en" (head (title An example page)) (body (h1 @id "greeting" Hi, there!) (p This is just an >>example<< "to" show XHTML & SXML.) ) ;; this is a comment )
XHTML/HTML schema:
(schema @start html (def-attr :xmlns :text) (def-attr :xml:lang :text) (def-attr :lang :text) (def-attr :type :text) (def-el :html (? :xmlns :xml:lang :lang :type) (? id) (head :body)) (def-el :head :title) (def-el :body (* :p :h1)) (def-attr :id (* :text)) (def-el :h1 (? :id) :text) (def-el :p :text) (def-el :title :text) )
Getting Started
- Install Deno (
curl -fsSL https://deno.land/x/install/install.sh | sh
) - Clone this repository
- Install sxml using
deno install -fA src/sxml.ts
. Do this every time you update the repository so that the latest changes are compiled. - See
sxml --help
for more information.
Status
- cli: parsing
- cli: validation against a schema
- cli: generate xml (sxml -> xml)
- Implement additional schema definition primitives based on RELAX NG
- browser: parsing, validation, generation
Add Package
deno add jsr:@sieve/sxml
Import symbol
import * as sxml from "@sieve/sxml";
Import directly with a jsr specifier
import * as sxml from "jsr:@sieve/sxml";
Add Package
pnpm i jsr:@sieve/sxml
pnpm dlx jsr add @sieve/sxml
Import symbol
import * as sxml from "@sieve/sxml";
Add Package
yarn add jsr:@sieve/sxml
yarn dlx jsr add @sieve/sxml
Import symbol
import * as sxml from "@sieve/sxml";
Add Package
npx jsr add @sieve/sxml
Import symbol
import * as sxml from "@sieve/sxml";
Add Package
bunx jsr add @sieve/sxml
Import symbol
import * as sxml from "@sieve/sxml";