JSPM

  • Created
  • Published
  • Downloads 323
  • Score
    100M100P100Q82559F
  • License ISC

Xml Schema Library

Package Exports

  • xsdlibrary

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xsdlibrary) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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