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

XML Elements

<p>The first step in learning about how information is structured in an XML document (the word “document” will be used to refer to information and its organization, typically stored in a disk file) will be to learn the syntactic components. The most basic component in XML is called an “<b>element</b>” or “<b>node</b>”: both are used inter-changeably in documentation.</p> <p>An <b>element</b> consists of a “name” assigned to it, as well as the content which the name describes/defines. One can also use the word “<b>tag</b>” to describe a name, in conformance with HTML terminology. As it turns out, “tag” is popular universally, and in this document, we shall stick to this terminology. Each element has an opening tag, content (optional) and a closing tag. Sometimes, a single tag might be enough to describe an element, especially when no meaningful content can be stored between the opening and closing of a tag. Learning by example is the best way, so we will see a few below.</p> <p>First let us look at what an element typically looks like:</p> <p>&lt;name&gt;Babe Ruth&lt;/name&gt;</p> <p>The parts of this element are as follows:</p> <p> • &lt;<b>name</b>&gt; is the opening tag, and “name” is the tag-name</p> <p> • “Babe Ruth” is the content of the element, and here it is a character string</p> <p> • &lt;/<b>name</b>&gt; is the closing tag: note the forward-slash “/” at the beginning</p> <p>Another example of an element is: &lt;drinking minor=”yes” /&gt;</p> <p> • Note here that there is only one tag, which both opens and closes the element; the tag name is “drinking”</p> <p> • “minor” is called an “<a href="/courses/video/47/368/Attributes.html">attribute</a>” or “property” of the element. It has the value “yes” in this case.</p> <p>XML, unlike HTML, is a case sensitive markup language. The content of an element can be a character <a href="/courses/video/4/154/Strings-As-Our-First-Variable.html ">string</a>, an alphanumeric string, a <a href="http://02geek.com/courses/video/4/156/Numbers-As-Our-Second-Variable.html">number</a> etc.; it can be any type of information that is normally used by people and applications. When it comes to tag names, the following exclusions apply:</p> <p> • The word “XML” or “xml” cannot be used as a tag name… it is the ONLY reserved keyword in an XML document</p> <p> • A tag name or <a href="/courses/video/47/368/Attributes.html">attribute</a> name cannot start with a numeric character; for example, “32age” is not a valid identifier (another name for tag or attribute name,) whereas “age32” is valid.</p> <p> • You can't have a space character within an identifier name: for example, “player name” is not a valid identifier, while “player_name” is.</p> <p>This ends the introduction to syntax and naming of tags and attribute names.</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