How to use the xml-name-validator.name function in xml-name-validator

To help you get started, we’ve selected a few xml-name-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github auth0 / node-saml / lib / saml20.js View on Github external
function getNameFormat(name){
  if (is_uri(name)){
    return 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri';
  }

  //  Check that the name is a valid xs:Name -> https://www.w3.org/TR/xmlschema-2/#Name
  //  xmlNameValidate.name takes a string and will return an object of the form { success, error }, 
  //  where success is a boolean 
  //  if it is false, then error is a string containing some hint as to where the match went wrong.
  if (xmlNameValidator.name(name).success){
    return 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic';
  }

  // Default value
  return 'urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified';
}
github SayMoreX / saymore-x / app / components / FieldNameEdit.tsx View on Github external
private isValidXmlName(label: string): boolean {
    // this is only used by customFields table, and custom fields actually
    // get tags that match their labels (not such a great idea, in retrospect.
    // But it's what SayMore Windows Classic's format requires.
    return label.trim() === "" || XmlNameValidator.name(label).success;
  }
  private onChange(event: React.FormEvent, field: Field) {
github sverweij / state-machine-cat / test / render / scjson / makeValidXMLName.spec.js View on Github external
function checkExpectationAndValidity(pExpectation, pValue) {
  const lValueToTest = makeValidXMLName(pValue);

  expect(lValueToTest).to.equal(pExpectation);
  expect(XMLNameValidator.name(lValueToTest).success).to.equal(true);
}
github Nols1000 / hltv-scorebot / node_modules / jsdom / lib / jsdom / living / helpers / validate-names.js View on Github external
exports.name = function (name, core) {
  try {
    xnv.name(name);
  } catch (e) {
    throw new core.DOMException(core.DOMException.INVALID_CHARACTER_ERR,
      "\"" + name + "\" did not match the Name production: " + e.message);
  }
};
github sx1989827 / DOClever / node_modules / jsdom / lib / jsdom / living / helpers / validate-names.js View on Github external
exports.name = function (name) {
  const result = xnv.name(name);
  if (!result.success) {
    throw new DOMException(
      "\"" + name + "\" did not match the Name production: " + result.error,
      "InvalidCharacterError"
    );
  }
};
github ktsn / vue-designer / src / view / ui-logic / rendering.ts View on Github external
function isValidAttributeName(name: string): boolean {
  return validateName(name).success
}
github jsdom / jsdom / lib / jsdom / living / helpers / validate-names.js View on Github external
exports.name = function (name) {
  const result = xnv.name(name);
  if (!result.success) {
    throw new DOMException(
      "\"" + name + "\" did not match the Name production: " + result.error,
      "InvalidCharacterError"
    );
  }
};

xml-name-validator

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

Apache-2.0
Latest version published 12 months ago

Package Health Score

72 / 100
Full package analysis

Popular xml-name-validator functions