Skip to content
This repository has been archived by the owner on Jan 3, 2022. It is now read-only.
/ xml.js Public archive
forked from kripken/xml.js

Port of libxml to JavaScript using Emscripten

License

Notifications You must be signed in to change notification settings

Beat-YT/xml.js

 
 

Repository files navigation

This package is a fork of kripken/xml.js that is compatible with NodeJS


This package exports the xmllint object which is an Emscripten port of libxml2's xmllint command for use in the browser or node.

Installation:

npm install Beat-YT/xml.js

API

const xmllint = require('xmllint');

var result = xmllint.validateXML({
    schema: "string",
    xml: "string"
})

The return value Object has one property errors which is either null, in the case of no errors, or an Array of error strings....eg:

if (!result.errors) {
	//there were no errors.
}

Usable with Browserify via browserify-shim.

Building xmllint from source

Install emscripten.

	git clone
	git submodule init
	git submodule update
	./script/clean
	./script/libxml2
	./script/compile
	./script/test

There are also equivalent gulp tasks.