Git Product home page Git Product logo

xml's Introduction

xml

npm version Build Status Coverage Status

Maintaining XML in pure javascript (IN BOTH NODE.JS & BROWSERS) Homepage

Maintaining?

Converting

converting

Editing/Traversing

XMLLite.findChildNode(doc, query);
XMLLite.findChildNodes(doc, query);
XMLLite.findOrCreateChildNode(doc, query);
XMLLite.removeChildNode(doc, query);
XMLLite.eachChildNode(doc, query, callback);
// ...

Formatting

XMLLite.beautify(xml, indent);
XMLLite.uglify(xml, preserveComments);
XMLLite.sanitize(xml, reverse);
// ...

Actually, you can get the js object from XMLLite.xml2js(xml), do whatever you want, and convert it back to xml again with XMLLite.js2xml(obj).

Why?

  1. A reasonable need for usage in both Node.js and Browsers
  2. A more reasonable need to use native APIs(DOMParser/XMLSerializer) to speed up the maintaining process and keep the library thin

Why @lite-js/xml?

  1. It works exactly the same in both Node.js and Browsers
  2. The browser version is supper light-weight(dist/xml.js)
  3. Convenient APIs for converting between xml/js/json/DOM, and lots of helpers to maintain the data structures
  4. Super fast. it takes less than 30ms to convert an xml document with over 1,000 nodes into a js object

Install

$ npm install @lite-js/xml --save
$ npm install @lite-js/xml -g

Usage

In Node.js

const XML = require('@lite-js/xml');

Command line client

$ xml-lite --help

In browsers

<script src="$path/to/@lite-js/xml/dist/xml.js"> <!-- window.XML is available -->

In browsers with webpack

import XMLLite from '@lite-js/xml/indexBrowser';

xml's People

Contributors

laispace avatar leungwensen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

meritonferati

xml's Issues

< or > in attributes

spec/fixtures/mmap-content.xml

  • all < should be escaped
  • XMLLite should have the ability to parse attributes like <tag attr="acting weird &lt;>"></tag>

I can't find the method called 'js2dom'

I can't find the method called 'js2dom', but I find it in the source code . so I add it to the index file.
Hope you can add it to the index file instead I add it by myself. thx.

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.