You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a decently sized xsd file (~7 mb) that I'm using to validate various xml documents that I'm constructing. My code looks something like this
async function validateXML(xmlString) {
const xsdString = (await fs.readFile(xsdFilePath)).toString();
const xsd = libxmljs.parseXml(xsdString);
const xml = libxmljs.parseXml(xmlString);
xml.validate(xsd);
}
I'm finding that after I invoke validate, the majority of the time spent during validation (a few hundred milliseconds) is in the xmlSchemaParse function here, based on some console statements that I've added to test performance:
My question is - if the xsd file is static, is there a way to provide the library that file (or a reference to that file) once and just have it reference that instead of attempting to parse the xsd every time I invoke validate?
The text was updated successfully, but these errors were encountered:
There isn't currently a way, but we could provide a function to parse and return schema documents then overload Document.validate to accept an already-parsed schema document
I have a decently sized xsd file (~7 mb) that I'm using to validate various xml documents that I'm constructing. My code looks something like this
I'm finding that after I invoke
validate
, the majority of the time spent during validation (a few hundred milliseconds) is in thexmlSchemaParse
function here, based on some console statements that I've added to test performance:libxmljs/lib/document.ts
Line 267 in 6507332
My question is - if the xsd file is static, is there a way to provide the library that file (or a reference to that file) once and just have it reference that instead of attempting to parse the xsd every time I invoke
validate
?The text was updated successfully, but these errors were encountered: