Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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';
}
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) {
function checkExpectationAndValidity(pExpectation, pValue) {
const lValueToTest = makeValidXMLName(pValue);
expect(lValueToTest).to.equal(pExpectation);
expect(XMLNameValidator.name(lValueToTest).success).to.equal(true);
}
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);
}
};
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"
);
}
};
function isValidAttributeName(name: string): boolean {
return validateName(name).success
}
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"
);
}
};
exports.qname = function (qname) {
exports.name(qname);
const result = xnv.qname(qname);
if (!result.success) {
throw new DOMException(
"\"" + qname + "\" did not match the QName production: " + result.error,
"InvalidCharacterError"
);
}
};
exports.qname = function (qname, core) {
exports.name(qname, core);
try {
xnv.qname(qname);
} catch (e) {
throw new core.DOMException(core.DOMException.NAMESPACE_ERR,
"\"" + qname + "\" did not match the QName production: " + e.message);
}
};