media @ VU
[] readme course(s) preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthought(s) appendix reference(s) example(s) resource(s) _

talk show tell print

php-cd.php



  <?php
  q=_GET["q"];xmlDoc = new DOMDocument();
  xmlDoc->load("xml/xml-cd.xml");x=xmlDoc->getElementsByTagName('ARTIST');
  
  for (i=0; i<=x->length-1; i++)
  {
  //Process only element nodes
  if (x->item(i)->nodeType==1)
    {
    if (x->item(i)->childNodes->item(0)->nodeValue == q)
      { 
      y=(x->item(i)->parentNode);
      }
    }
  }
  cd=(y->childNodes);for (i=0;i<cd->length;i++)
  { 
  // echo("trying");
  //Process only element nodes
  if (cd->item(i)->nodeType==1)
    { 
    echo("<b>");
    echo(strtolower(cd->item(i)->nodeName));
    echo("</b>");
    echo(": ");
    echo(cd->item(i)->childNodes->item(0)->nodeValue);
    echo("<br />");
    } 
  }
  ?>
    
  
    
  

(C) A. Eliëns 21/5/2007

You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.