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

xml-name-validator

Package Overview
Dependencies
Maintainers
6
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xml-name-validator

Validates whether a string matches the production for an XML name or qualified name

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29M
decreased by-4.54%
Maintainers
6
Weekly downloads
 
Created

What is xml-name-validator?

The xml-name-validator npm package is used to check if a string is a valid XML name, according to the XML specification. It can validate both XML names and qualified names (QNames), which are used in XML documents to ensure that element and attribute names are compliant with the XML naming rules.

What are xml-name-validator's main functionalities?

Validating XML names

This feature allows you to validate whether a given string is a valid XML name. The `isName` function returns `true` if the string is a valid XML name, and `false` otherwise.

const { isName, isQName } = require('xml-name-validator');

const validName = 'validElement';
const invalidName = '1InvalidElement';

console.log(isName(validName)); // true
console.log(isName(invalidName)); // false

Validating XML qualified names (QNames)

This feature allows you to validate whether a given string is a valid XML qualified name (QName). The `isQName` function returns `true` if the string is a valid QName, which includes a namespace prefix, and `false` otherwise.

const { isName, isQName } = require('xml-name-validator');

const validQName = 'ns:validElement';
const invalidQName = 'ns:1InvalidElement';

console.log(isQName(validQName)); // true
console.log(isQName(invalidQName)); // false

Other packages similar to xml-name-validator

Keywords

FAQs

Package last updated on 12 Nov 2023

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