php - How can I handle a huge XML file using SimpleXML but to prevent memory and performance problems? -
i trying avoid xmlreader app build has huge xml file. simplexml easy write , wondering if there way handle (memory , performance issues) in quite busy server. do, echo data xml search form.
ok, if want without xmlreader, here's do.
use fopen open , read n number of bytes of file.
fix ending : (that's tough part it's doable) closing left unclosed , if needed backtracking if happen in middle of text.
when xml chunk valid can parse simplexml.
process chunk or save in separate xml file , create chunk ...until have of them.
obviously if xml complex might little painful.
summary : creating own custom/dirt-cheap xml parser/fixer can split huge xml file multiple smaller files.
Comments
Post a Comment