PHP - XML

XML (eXtensible Markup Language) is a data format for structured document interchange on the Web. It is a standard defined by The World Wide Web consortium (W3C).

Simple XML File


<books>
  <book>
   <title>PHP Programming Ebook</title>
   <characters>
    <character>
     <name>Tutorials Studio</name>
     <desc>A Great Book</desc>
    </character>
   </characters>
   </book>
  </books>							
							

      PHP XML Functions List  


Example

XML File


							
<building_data>
<building address="some address" lat="28.902914" lng="-71.007235" />
<building address="some address" lat="48.892342" lng="-75.0423423" />
<building address="some address" lat="58.929753" lng="-79.1236987" />
</building_data>
	
							

PHP File


<?php

$reader = new XMLReader();
if (!$reader->open("data.xml"))
{
    die("Failed to open 'data.xml'");
}
while($reader->read())
{
    $node = $reader->expand();
    // process $node...
}
$reader->close(); 

?>	
							
Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!