Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yisibl/is-xml

Check if a String/Buffer is XML
https://github.com/yisibl/is-xml

Last synced: 14 days ago
JSON representation

Check if a String/Buffer is XML

Awesome Lists containing this project

README

        

# is-xml

[![Build Status](https://travis-ci.org/yisibl/is-xml.svg?branch=master)](https://travis-ci.org/yisibl/is-xml)
[![NPM Downloads](https://img.shields.io/npm/dm/is-xml.svg?style=flat)](https://www.npmjs.com/package/is-xml)
[![NPM Version](http://img.shields.io/npm/v/is-xml.svg?style=flat)](https://www.npmjs.com/package/is-xml)
[![License](https://img.shields.io/npm/l/is-xml.svg?style=flat)](http://opensource.org/licenses/MIT)

> Check if a String/Buffer is XML(HTML/XHTML/SVG/MathML/XUL/XBL/RSS)

## Install

```sh
npm install --save is-xml
```

## Usage

```js
var isXML = require('is-xml');
```

### XML

```js
isXML('I am XML');
isXML(
'<标题>一丝是谁?标题>' +
'<简介>当你们每天喊我「丝姐」的时候' +
'我深深的沉浸在其中不能自拔简介>'
);
// => true
```

### HTML

```js
isXML('');
isXML('');
isXML('');
isXML('img');
// => true
```

### SVG

```js
isXML('');
isXML('');
// => true
```

### Emjio :joy:

```js
isXML('

');
isXML('

');
isXML('');
isXML('

');
// => true
```

### [More test case](test/index.js)

## License

MIT © [yisibl](https://github.com/yisibl/) ([Weibo](http://weibo.com/jieorlin))