This is a little ECMAscript for XML demo. Click on the buttons please.

Here is the JS code for the above buttons:
function subgoals() {
      var subgoals = xml..subgoal;
      alert (subgoals);

function attempt_action() {
      var action = xml..ATTEMPT[1].action;
      alert (action);

function show_URL() {
      var NS = new Namespace("");
      // this works
      var URL = xml..a;
      var link = URL.@NS::href;
      alert ("URL (content of the 'a' tag)=" + URL + "\n" + "NameSpace=" + NS + "\nxlink:href=" + link);

Here is the XML (just copy/paste from the head, you really should look at the source of this page).

  <title>The little Flexer</title>
  <context>Once upon a time, in a dark small office.</context>
  <problem>Kaspar was trying to learn Flex but didn't have a real project. He then decided that it would be a good idea to look at Data-Driven Controls. These are most useful in combination with an external datasources in XML format.</problem>
  <goal>So he decided how to write a mx:Tree application that imports XML data.</goal>
      <subgoal>He decided to play with a little example</subgoal>
	<action>So he went to see the LiveDocs and copied an example</action>
      <result>The example worked but he didn't understand why since he didn't know about E4X</result>
      <subgoal>He then decided to learn e4X firs
	Reading 2-3 tutorials and creating a simple example only took 2-3 hours.
      He now understood how to write e4X code in Flex

  <moral>Divide a problem into subproblems and you will get there ...</moral>
    <a xmlns:xlink="" xlink:href="">
          ECMAscript for XML</a>

DKS - nov 2008 - Freeware - BAD HTML 4.0 ;). ... I think I should put the JS code in a separate file.