Posts

Showing posts with the label Large xml file parser in php

SAX parsing for cdata tag for large xml file

     Here, I have given the code for parsing or reading large xml files using php.      Large xml files in php  are parsed using this  SAX  parser. The inner function of php, which gives directly the data of xml, can handle only small xml files (mostly upto 1KB to 50KB). So for parsing large xml files having data like 5MB, 50MB, etc. we have to use this method.      The code is given as simple as possible. Just enter your xml file path in 5th line. The 30th line gives the switch cases. Each switch case has one tag name of xml file. So if we want to perform any search or value of that tag or some other operation also can be done in that switch case area. From 54th line, we can do ending operation of that xml file. For ex. if we want to put data in table, we can complete table tag there.      The cdata tag is parsed in characterdata function on line 73. All cdata tag is parsed there and we can perform operat...