DEV Community

Discussion on: Need help with editing a massive file

Collapse
 
cjbrooks12 profile image
Casey Brooks

Pretty much any text editor out there isn't going to do a good job working on really large files. You're better off writing a small script to do the conversion for you. Here's an overview of different ways of parsing an XML document in Java, and in particular you should be looking at the SAX- or StAX-style parsers.

A DOM parser will typically load the entire file contents into memory, which isn't going to work with a large XML document, but the SAX and StAX parsers will process the file line-by-line, and so should be able to easily handle files of any size, no matter how large. The differences between a SAX and StAX parser are subtle, but this page has some useful insights into their differences, and when to use one over the other.

Of course, you could use any language for parsing XML, you just need to find the appropriate parser for that language.

But whatever you do, do not try to parse the XML with Regex.