How to validate very large XML files?

前端 未结 11 2506
失恋的感觉
失恋的感觉 2020-12-16 15:44

How can I validate a large XML file (>100mb)? I try to open it with IE, FX & GC and it either crashes or doesn\'t do anything.

11条回答
  •  猫巷女王i
    2020-12-16 16:12

    xmllint --stream

    Worked on a 1.2Gb file with memory limited to 500Mb:

    ulimit -Sv 500000
    xmllint --stream a.xml
    

    Without --stream, Linux kills the process, and without ulimit, my computer jams.

    I was not able however to get output from --xpath when using --stream: How to do command line XPath queries in huge XML files?

    Tested in Ubuntu 14.04, xmllint version 20901.

提交回复
热议问题