GithubHelp home page GithubHelp logo

andersonhonorio / xmlschema.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paulwardrip/xmlschema.js

0.0 2.0 0.0 77 KB

Implementation of XML schema validation in pure javascript.

JavaScript 96.80% HTML 3.20%

xmlschema.js's Introduction

xmlschema.js

Implementation of XML schema validation in Javascript.

Update namespaces & xs:import are now supported.

This supports most of the basic functions of xml schema validation. Some features of the spec may not be implemented yet, these features may be provided in a future release. If you would like to report a bug or even contribute to the project, contact me: [email protected]

The following features of the xsd are not implemented:

  • xs:key
  • xs:redefine
  • xs:union

Installing

You can install using bower:

bower install xmlschema.js

Usage

xmlschema([xsd]).validate(xml[, callback]);

Where xsd/xml are a URL, XMLDocument or xml string. If xsd is not provided the schema will be loaded from the xsi:schemaLocation in the xml document. The validate method returns a promise (implementation depends on environment and available libraries, it provides: then(), catch()).

You will need to register a callback with the validate method or the promise it returns: function callback(result)

The result object contains the following:

  • valid: boolean, did the xml validate
  • message: a status message, example: "Validated 14 elements and 8 attributes, document is invalid."
  • errors: an array of error messages.
  • warnings: an array of warnings.
  • xsd: an object representing the xsd document
    • doc: as an XMLDocument object.
    • str: as a string.
  • xml: an object representing the xml document
    • doc: as an XMLDocument object.
    • str: as a string.

xmlschema.js's People

Contributors

paulwardrip avatar

Watchers

Anderson Honório avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.