Skip to content

Repository files navigation

@jsonic/xml

A Jsonic syntax plugin that parses XML text into a tree of elements, with support for attributes, mixed content, namespaces, entities, CDATA sections, comments, processing instructions, and DOCTYPE declarations.

The same parser is available in two languages — a TypeScript/JavaScript package on npm and a Go module:

LanguagePackageSource
TypeScript@jsonic/xmlsrc/xml.ts
Gogithub.com/jsonicjs/xml/gogo/xml.go

npm versionbuildCoverage StatusKnown VulnerabilitiesDeepScan gradeMaintainability

VoxgigThis open source module is sponsored and supported by Voxgig.

Install

TypeScript / JavaScript

npm install jsonic @jsonic/xml

Go

go get github.com/jsonicjs/xml/go

Quick example

TypeScript

import{Jsonic}from'jsonic'import{Xml}from'@jsonic/xml'constparse=Jsonic.make().use(Xml)parse('<greeting lang="en">Hello, <b>world</b>!</greeting>')// {// name: 'greeting', localName: 'greeting',// attributes: { lang: 'en' },// children: [ 'Hello, ',// { name: 'b', localName: 'b', attributes: {}, children: ['world'] },// '!' ]// }

Go

import (
jsonic "github.com/jsonicjs/jsonic/go"
xml "github.com/jsonicjs/xml/go"
)
j:=jsonic.Make()
j.UseDefaults(xml.Xml, xml.Defaults)
result, _:=j.Parse(`<greeting lang="en">Hello, <b>world</b>!</greeting>`)

Documentation

Documentation is organised by the Diataxis framework — each language guide contains a tutorial, how-to recipes, a reference section, and a short explanation of design choices:

License

Copyright (c) 2021-2025 Richard Rodger and other contributors, MIT License.

About

xml

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

Generated from jsonicjs/csv