Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

xsdlibrary

sublimedatasys1.2kISC1.3.6

Xml Schema Library

xsd, xml, xml schema, xml2xsd, xsd2xml, json2xml, json schema to xsd, json to xml, xml to xsd, xml to xml schema, coverter, xml library, xsd library

readme

XSD Library

XML Schema library to convert XML to XSD (XML Schema) using pure javascript.

  • Convert XML to XML Schema
  • Convert JSON (JS Object) to XML Schema
  • XML to JSON Schema
  • Detect XML or XML Schema
  • Validate XML Schema
ToDo
  • XML Schema to JSON Schema

Installation

npm

$ npm install xsdlibrary

yarn

$ yarn add xsdlibrary

Usage

import {
    xml2xsd,
    xsd2jsonSchema,
    json2xsd,
    validateXml,
    detectXmlSchema,
    jsonSchema2xsd
} from xsdlibrary;

Convert XML data to XML Schema(XSD)

const xmlString = ``; // your xml string
xml2xsd(xmlString); // returns xml schema

Convert XML Schema to Json Schema

const xsdString = ""; // your xml schema string
xsd2jsonSchema(xsdString); // returns "xml" or "xsd" or an error object if none

Convert JSON Schema to XML Schema

const jsonObj = {}; // your javascript object
jsonSchema2xsd(jsonObj); // returns xml schema

Validate XML or XML Schema

const xmlString = ""; // your xml or xml schema string
validateXml(xmlString); // returns true if valid or an error object

Detect XML or XML Schema

const string = ""; // your xml or xml schema string
detectXmlSchema(string); // returns "xml" or "xsd" or an error object if none