Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/19/2008
Times viewed :
7733
PHP and XML Introduction
What is XML?
XML is a specification for
creating your own mark-up languages. A
document created according to the rules of the XML specification looks similar
to HTML in that it contains elements and attributes coded as tags.
Nevertheless, browsers do not attempt to directly format and display XML
documents unless some formatting information is provided in some way (You can
use XSLT for transformation).
Though XSLT is out of scope
for current tutorial but I am giving here some information regarding XSLT.
XSLT, the Extensible Style sheet Language for Transformations, is an official
recommendation of the World Wide Web Consortium (W3C). It provides a flexible,
powerful language for transforming XML documents into something else (to .html,
.pdf etc.)
What
is PHP?
PHP (Hypertext Pre-processor)
a programming language devised by Rasmus Lerdorf in 1994 for building dynamic, interactive websites.
Since then, its been evolving into a full-fledged language in its own rights.
A sure sign that PHP is maturing
(like XML) as a technology is evidenced by its totally revamped and upgraded
support for object oriented programming (OOP) principles and improved support
for XML. The Zend engine (the part that interprets
and executes PHP code) now enables PHP5 developers to implement, among a host
of other things, graceful application-wide error
handling. PHPs main use as a cross-platform, HTML-embedded, server-side web
scripting language.
Cross Platform Most PHP code can be processed
without alteration on computers running many different operating system. For example, a PHP script that runs on Linux
operating system runs well on Windows operating system
HTML embedded PHP code can be written in
files containing a mixture of PHP instructions and HTML code.
Server-side- The PHP programs are run on a
server specifically on a web server.
Web-scripting language PHP programs run via a
web browser.
PHP
and XML
There have been PHP
functions available for connecting to, retrieving data from, and manipulating
databases almost since PHP was first written. More recently, as the XML
specification gained prominence as a means of exchanging and string data, PHP
has added functions that make it easier to work with XML documents.
Because of the nature and
format of the XML documents, much of the work on adding XML functions to PHP
has centered on properly parsing XML documents and manipulating them while
remaining in conformance to xml specification. To effectively parse and
manipulate XML documents, these functions need to be able to get at and work
with the names and value of the elements and attributes, as well as the many
other types of XML document components.