UEA-Prodem

This commit is contained in:
2026-06-10 12:38:42 -03:00
parent 3f33154e16
commit c41625e542
9352 changed files with 1128292 additions and 14752 deletions
+44
View File
@@ -0,0 +1,44 @@
import { XMLParser } from "fast-xml-parser";
import { COMMON_HTML, CURRENCY, EntityDecoderImpl, XML } from "./xml-external/nodable_entities";
const entityDecoder = new EntityDecoderImpl({
namedEntities: { ...XML, ...COMMON_HTML, ...CURRENCY },
numericAllowed: true,
limit: {
maxTotalExpansions: Infinity,
},
ncr: {
xmlVersion: 1.1,
},
});
const parser = new XMLParser({
attributeNamePrefix: "",
processEntities: {
enabled: true,
maxTotalExpansions: Infinity,
},
htmlEntities: true,
entityDecoder: {
setExternalEntities: (entities) => {
entityDecoder.setExternalEntities(entities);
},
addInputEntities: (entities) => {
entityDecoder.addInputEntities(entities);
},
reset: () => {
entityDecoder.reset();
},
decode: (text) => {
return entityDecoder.decode(text);
},
setXmlVersion: (version) => void {},
},
ignoreAttributes: false,
ignoreDeclaration: true,
parseTagValue: false,
trimValues: false,
tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined),
maxNestedTags: Infinity,
});
export function parseXML(xmlString) {
return parser.parse(xmlString, true);
}