PHP's XML parser is based on Expat. It lets you parse but not validate XML documents means it does not allow us to find out the XML tags which are present instead of that we can check the correctness of the structure. PHP?s XML parser is event-based. In the following example you could learn about few in-built functions provided by PHP to access XML document.
<?php$xml="<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?><lang><php>PHP is very easy to learn</php><Java>Java is the king of open source language</Java></lang>"; $parse=xml_parser_create();
xml_parser_free($parse); echo "<b>Index array:</b>"."<br/>";
print_r($var1); echo "<br/><b>Vals array</b><br/>";
Index array: Array (  => Array ( [tag] => LANG [type] => open [level] => 1 )  => Array ( [tag] => PHP [type] => complete [level] => 2 [value] => PHP is very easy to learn )  => Array ( [tag] => JAVA [type] => complete [level] => 2 [value] => Java is the king of open source language )  => Array ( [tag] => LANG [type] => close [level] => 1 ) ) Vals array Array ( [LANG] => Array (  => 0  => 3 ) [PHP] => Array (  => 1 ) [JAVA] => Array (  => 2 ) )
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.