- Notifications
You must be signed in to change notification settings - Fork10
Validates whether a string matches the production for an XML name or qualified name
License
NotificationsYou must be signed in to change notification settings
jsdom/xml-name-validator
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This package simply tells you whether or not a string matches theName
orQName
productions in the XML Namespaces specification. We use it for implementing thevalidate algorithm in jsdom, but you can use it for whatever you want.
This package's main module exports two functions,name()
andqname()
. Both take a string and return a boolean indicating whether or not the string matches the relevant production.
"use strict":constxnv=require("xml-name-validator");// Will return truexnv.name("x");xnv.name(":");xnv.name("a:0");xnv.name("a:b:c");// Will return falsexnv.name("\\");xnv.name("'");xnv.name("0");xnv.name("a!");// Will return truexnv.qname("x");xnv.qname("a0");xnv.qname("a:b");// Will return falsexnv.qname(":a");xnv.qname(":b");xnv.qname("a:b:c");xnv.qname("a:0");
About
Validates whether a string matches the production for an XML name or qualified name