Easy Tutorial
❮ Php Ref Simplexml Func String Strstr ❯

PHP xml_parse() Function



Definition and Usage

The xml_parse() function parses an XML document.

It returns TRUE on success or FALSE on failure.

Syntax

Parameter Description
parser Required. Specifies the XML parser to use.
xml Required. Specifies the XML data to parse.
end Optional. If this parameter is TRUE, the data in the "xml" parameter is the last piece of data in the current parse. Note: <br> Entity errors are reported at the end of the parse and are only shown if the "end" parameter is TRUE.

Tips and Notes

Tip: To create an XML parser, use the xml_parser_create() function.


Example 1

XML File

PHP Code

The output of the above code is as follows:


Example 2

Using the same XML file but displaying the XML data in a different way:

The output of the above code is as follows:


❮ Php Ref Simplexml Func String Strstr ❯