1. xml-name-validator
Validates whether a string matches the production for an XML name or qualified name
xml-name-validator
Package: xml-name-validator
Created by: jsdom
Last modified: Sun, 12 Nov 2023 05:38:10 GMT
Version: 5.0.0
License: Apache-2.0
Downloads: 89,051,070
Repository: https://github.com/jsdom/xml-name-validator

Install

npm install xml-name-validator
yarn add xml-name-validator

Validate XML Names and Qualified Names

This package simply tells you whether or not a string matches the Name or QName productions in the XML Namespaces specification. We use it for implementing the validate algorithm in jsdom, but you can use it for whatever you want.

Usage

This package's main module exports two functions, name() and qname(). Both take a string and return a boolean indicating whether or not the string matches the relevant production.

 "use strict":
const xnv = require("xml-name-validator");

// Will return true
xnv.name("x");
xnv.name(":");
xnv.name("a:0");
xnv.name("a:b:c");

// Will return false
xnv.name("\\");
xnv.name("'");
xnv.name("0");
xnv.name("a!");

// Will return true
xnv.qname("x");
xnv.qname("a0");
xnv.qname("a:b");

// Will return false
xnv.qname(":a");
xnv.qname(":b");
xnv.qname("a:b:c");
xnv.qname("a:0");

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin