02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoPrevious Video

Loading XML in PHP

<p>So far, we have seen examples of how applications on the client side in web-interactions load XML data that is rendered to them as the content format. We'll now take a look at PHP, a specialized server-side language that makes XML content available to client applications such as <a href="/html5/101.html">HTML</a> browsers, which then render this information as text in the browser window using special languages like <a href="/02geek/javascript/101.html">Javascript</a>. We'll start with a very simple example, using samples of XML information as well as a PHP script to load this document onto the browser application:</p> <p>&lt;?</p> <p>$xmlString = &quot;&lt;canine&gt;who let the dogs out?&lt;/canine&gt;&quot;; </p> <p>echo $xmlString; </p> <p>?&gt; </p> <p>When this information is fed to the browser, it displays the output &quot;Who Let the Dogs out?&quot; correctly. It displayed data because the root <a href=" /courses/video/47/396/Elements-and-Attributes-in-PHP.html">element</a> has no nested elements inside of it. If we store an XML document instead that consists of <a href="/courses/video/47/367/Nesting-Elements.html ">nested elements</a>, it doesn't make sense to display the contents of the root element on the browser. It's not a simple <a href="/courses/video/4/154/Strings-As-Our-First-Variable.html">string</a> any more. So it simply displays a blank page, with NO content. </p> <p>&lt;? <p>$xmlString = &quot;&lt;canine&gt; </p> <p>&lt;question&gt;Who Let the dogs out?&lt;/question&gt; </p> <p>&lt;answer&gt;It's a dog's life!&lt;/answer&gt; </p> <p>&lt;/canine&gt;&quot; </p> <p>echo $xmlString; </p> <p>?&gt; </p> <p>In the next session we shall see what kind of PHP code needs to be written in order to parse any XML document and then give it to the client software (browser) so that only the content is correctly displayed. We can see the division of responsibilities between technologies and languages, all centered around content management. On the server side is PHP, and on the client side (mainly browsers,) it is Javascript. XML is the common glue that binds these technologies together, and provides a extensible and flexible framework for content management.</p>

Overview and Context of XML

We will learn about the historical perspective and overview of the XML standard. The main focus is on Information organization and cross platform usage

12:47

XML Elements

The first step in learning about how XML documents are structured is to get familiar with elements, the basic components of an XML document.

08:22

XML Nested Elements

Nested elements allow for complex data to be represented effortlessly in an XML document.

09:19

Attributes

Attribute-value pairs are an alternative to nesting of elements in an XML document. We'll see the pros and cons of this feature

08:12

More Then Just Leftovers

Comments, White-space, Special characters, Version Information and Parser by-passing content; we discuss what these constructs are and how to use them effectively

13:54

XML Validation

XML documents should be well formed structure- and content-wise for applications to be configured and behave properly. We discuss an analogy with a real life scenario to highlight the point

08:17

E4X – ActionScript 3.0

We describe the importance and beneficial features of E4X library, and why it should be used in browsers at the earliest

24:56

XML DOM

An XML document is often pictured as an inverted nodes (elements) tree and connected nodes have a relation between them. DOM allows the program to traverse and retrieve these related nodes.

11:12

JavaScript

We describe the basic syntax of Javascript to load XML documents in client-side applications

13:51

Looping XML

We describe the looping constructs of PHP scripting language and how they can be used to parse and render XML information in client software

14:19

XML as a Remote

We describe the utility of XML for the modern web, especially when there's a plethora of programming languages and platforms and how XML builds several bridges

09:19

Loading XML in PHP

We describe how to load XML documents into server side applications in the PHP scripting language

04:57

Elements and Attributes in PHP

We describe how to access elements and attribute values while processing XML content via PHP scripts in server-side software

04:44

foreach

We describe the foreach looping construct in PHP and also how it can be used to process XML documents in server-side software

07:01

PHP XML compare

We describe how to compare XML document components and content in different documents having the same syntax

05:08

Modifying XML

We describe how to modify the content of XML documents in PHP : insertion/deletion/update operations in server-side applications

08:34