PHP xml tutorial

xml :- extensible markup language(xml) is markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.

the design goals of xml emphasize simplicity, generality, usability, over the internet.

the internet media type for xml is application/xml[1],   text/xml[2].


what is xml ?

  • xml language stands for extensible markup language.
  • xml language is a subset of sgml.
  • xml language is platform and language-independent.
  • xml language tags are user defined not predefined.
  • xml language designed to transport and carry data.
  • xml language markup is very verbose.
  • xml language is a markup language much like as html.
  • xml language is w3c recommendation.

features/benefits of xml

  • easy data exchange - xml is one of the most widely-used formats for sharing structured information today: between programs, between people, between computers and people both locally and across networks.
  • reducing server load :- web-based applications can use xml to reduce the load on the web servers by keeping all information on the client for as long as possible, and then sending the information to those servers in one big xml document.
  • self-describing
  • create your own languages - xml allows you to specify your own markup language for your own specific purpose.
  • xml is used both on and offline for storing and processing data.

the xml file look like as :--

               
                <? xml version = "1.0"   encoding = "UTF-8"?>
                
                    <books>
                      
                          <java>
                          
                                 java is a strong programming language
                                
                           </java>
                                
                                  <php>
                                      
                                      php  is a server side scripting language
                                                                            
                                   </php>
                                      
                    </books>


PHP with XML

php language provide more functions and classes to work with xml documents.

the most important features in php :

  • parsing xml documents using the xml parser extension
  • manipulate xml documents using the dom extension
  • using php simplexml read, write and manipulate xml documents.