Skip to main content
Home

SXML 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
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with 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 &gt;&gt;example&lt;&lt; "to" show XHTML &amp; 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

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@sieve/sxml

Import symbol

import * as sxml from "@sieve/sxml";
or

Import directly with a jsr specifier

import * as sxml from "jsr:@sieve/sxml";

Add Package

pnpm i jsr:@sieve/sxml
or (using pnpm 10.8 or older)
pnpm dlx jsr add @sieve/sxml

Import symbol

import * as sxml from "@sieve/sxml";

Add Package

yarn add jsr:@sieve/sxml
or (using Yarn 4.8 or older)
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";