How to parse an XML file in PHP

XML file here . How to get the source content in this XML file?

+3
source share
2 answers

There are actually four relatively simple ways to read an XML file:

  • DOMthat uses the DOM API (and therefore must load the entire document into memory)
  • SimpleXML, which provides a very simple and elegant way to parse XML documents (but does not have a lot of document manipulation methods), it also loads the entire document into memory.
  • XMLReader - , . , , , ( XML-), , DOM XMLReader::expand().
  • XML Parser - , SAX-, , , XML ; , XMLReader ( ).

:

  • SimpleXML XML
  • XMLReader XML
+15

PHP XML- ( SimpleXML).

, , - .

+4

Source: https://habr.com/ru/post/1722406/


All Articles