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

JavaScript

<p><a href="/02geek/javascript/101.html">Javascript</a> is a scripting language that can be embedded inside HTML documents to process information and finally display it in the browser window. We actually embed a piece of code inside <a href="/html5/101.html">HTML</a> tags! It's a client-side application entity, and we shall soon see a real life example. Let's first get some idea of Javascript syntax.</p> <p>Javascript code should always be <a href="/courses/video/47/367/Nesting-Elements.html">nested</a> inside the HTML &lt;script&gt; <a href="/courses/video/47/366/Elements.html">element</a>, between its start and end tags. Script tags have some information as element <a href="/courses/video/47/368/Attributes.html">attribute</a> e-value pairs, mainly to let the HTML parser know, for example, that it is text (human readable) code written in Javascript. This language provides many constructs that resemble constructs in everyday programming languages as well, so it's intuitive and easily learned. <a href="/course/basics/conditionals-if">Condition testing</a>, <a href="/courses/video/47/374/Looping-XML.html">looping</a>, API, you name it!</p> <p>Let's now look at a real world example of loading an XML document inside Javascript. We look at a scenario where an XML document is loaded from a URL, by requesting data from a HTTP server and returning the content retrieved to the user. The example XML document is a flight booking information record:</p> <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt; </p> <p>&lt;flight-booking id=&quot;TWA123456&quot;&gt; </p> <p>&lt;name&gt;James Bond&lt;/name&gt; </p> <p>&lt;age&gt;45&lt;/age&gt; </p> <p>&lt;flight-number&gt;TWA1625&lt;/flight-number&gt; </p> <p>&lt;date&gt;11-29-2012&lt;/date&gt; </p> <p>&lt;time&gt;12:15&lt;/time&gt; </p> <p>&lt;origin&gt;London&lt;/origin&gt; </p> <p>&lt;destination&gt;Paris&lt;/destination&gt; </p> <p>&lt;class&gt;Business&lt;/class&gt; </p> <p>&lt;/flight-booking&gt; </p> <p>The Javascript that does the above task would look something like: </p> <p>&lt;script type=&quot;text/javascript&quot;&gt; </p> <p>function loadXML(path){ </p> <p>if(window.XMLHttpRequest){ </p> <p>xhttp = new XMLHttpRequest();</p> <p>}else{</p> <p>xhttp = new ActiveObject(&quot;Microsoft.XMLHTTP); </p> <p>}</p> <p>xhttp.open('GET', path, false); </p> <p>xhttp.send();</p> <p>return xhttp.responseXML; </p> <p>}</p> <p>xml = loadXML(&quot;flightbooking.xml&quot;); </p> <p>document.write(xml); </p> <p>&lt;/script&gt; </p> <p>We have written a <a href="/course/basics/functions">function</a> that will load the XML document, given the URL to locate it. The <a href="/courses/video/10/78/Calling-Functions.html">call</a> to the function is made, and the <a href="/courses/video/4/154/Strings-As-Our-First-Variable.html">string</a> <a href="/courses/video/10/83/Return-Something.html">return</a> type stored. The document will be finally displayed in the browser window. But we don't get what we expect (you can verify that from the tutorial or your own script,) mainly because the root level XML element is the entire document node (root node of the DOM tree) and it's not a simple node; it has nested elements. </p> <p>The main point to highlight here is the short learning cycle required for mastering Javascript (we have a great course for it, if you're unfamiliar!) There's nothing obscure about it... simplicity was the design goal right from the beginning. </p> <p>In the next summary, we'll see how to use looping constructs to return selective information stored in the retrieved from the XML document. Until then, goodbye!</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