MCPcopy Create free account
hub / github.com/NaturalIntelligence/fast-xml-parser / parseAttributesExp

Function parseAttributesExp

src/v6/XmlPartReader.js:183–192  ·  view source on GitHub ↗
(attrStr, parser)

Source from the content-addressed store, hash-verified

181const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
182
183function parseAttributesExp(attrStr, parser) {
184 const matches = getAllMatches(attrStr, attrsRegx);
185 const len = matches.length; //don't make it inline
186 for (let i = 0; i < len; i++) {
187 let attrName = parser.processAttrName(matches[i][1]);
188 let attrVal = parser.replaceEntities(matches[i][4] || true);
189
190 parser.outputBuilder.addAttribute(attrName, attrVal);
191 }
192}
193
194
195const getAllMatches = function(string, regex) {

Callers 1

buildTagExpObjFunction · 0.85

Calls 4

processAttrNameMethod · 0.80
replaceEntitiesMethod · 0.80
addAttributeMethod · 0.80
getAllMatchesFunction · 0.70

Tested by

no test coverage detected