xml-crypto
                                
                                
                                
                                    xml-crypto copied to clipboard
                            
                            
                            
                        Large xml file - Maximum call stack size exceeded or JavaScript heap out of memory
I am trying to sign a rather large XML file which contains about 90000 IoT measurement elements (with sub elements including the measurement, metadata and timestamps) - this is a file of about 2 million lines. xml-crypto seems to sign XML files of up to 2500 elements but after that it starts complaining that
RangeError: Maximum call stack size exceeded
    at node_modules/xpath/xpath.js:2045:20
    at node_modules/xpath/xpath.js:131:34
    at node_modules/xpath/xpath.js:124:3
    at fn (node_modules/xpath/xpath.js:117:22)
    at node_modules/xpath/xpath.js :131:2
    at fn (node_modules/xpath/xpath.js:117:22)
    at Function.PathExpr.applySteps (node_modules/xpath/xpath.js:2044:9)
    at Function.PathExpr.applyLocationPath (node_modules/xpath/xpath.js:2078:21)
    at PathExpr.evaluate (node_modules/xpath/xpath.js:2091:23)
    at XPath.evaluate (node_modules/xpath/xpath.js:1317:25)
Trying with the full 90000 elements XML it fails due to javascript heap out of memory. All this is expected, since xml-crypto seems to read the entire file into memory and processes it as a block. Are there any plans to allow stream processing of XML (not sure if that is even possible with digital signature calculations)?
Are there other suggestions on what to do to handle such large files?
This seems to be a problem with xpath, not with xml-crypto. Have you looked at https://github.com/goto100/xpath to see if you can report the issue there?
I also see that this is forked from some work that @yaronn has done. Perhaps he'd be willing to work with us along with @JLRishe to get this addressed. If needed, we could probably even move it into the node-saml organization so that it can get more attention than it is now.