XML is a language used to structure data for sharing across websites. Technologies such as RSS Feeds and Podcasts are written in XML. XML is straightforward to create and resembles HTML, with the difference that you define your own tags.
To read, update, create, and manipulate an XML document, you need an XML parser.
In PHP, there are two main types of XML parsers:
Tree-based parsers holds the entire document in Memory and transforms the XML document into a Tree structure. It analyzes the whole document, and provides access to the Tree elements (DOM).
This type of parser is a better option for smaller XML documents, but not for large XML document as it causes major performance issues.
Example of tree-based parsers:
Event-based parsers do not hold the entire document in Memory, instead, they read in one node at a time and allow you to interact with in real time. Once you move onto the next node, the old one is thrown away.
This type of parser is well suited for large XML documents. It parses faster and consumes less memory.
Example of event-based parsers: