Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-xml

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-xml

Check if a string is XML

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
765
increased by4.65%
Maintainers
1
Weekly downloads
 
Created
Source

is-xml

Build Status NPM Downloads NPM Version License

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

Install

npm install --save is-xml

Usage

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

XML

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

HTML

isXML('<html>');
isXML('<html></html>');
isXML('<input type="text" />');
isXML('<img src="#" alt="img"/>');
// => true

SVG

isXML('<svg width="100" height="100" viewBox="0 0 30 30" version="1.1"></svg>');
isXML('<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg></svg>');
// => true

Emjio :joy:

isXML('<p class="foo_bar-🙈🔞🙈" id="👻">');
isXML('<p 😂👻😂="foo_bar">');
isXML('<foo😘( ●─● )💓></foo😘( ●─● )💓>');
isXML('<p class="(ོ•̀⌄•́)ོ"></p>');
// => true

More test case

License

MIT © yisibl (Weibo)

Keywords

FAQs

Package last updated on 25 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc