Mar 9, 2010

Next Step: XML Parsing

I found Dr. Drake's example of parsing to complex as it had that drop down box in it. I need an example with out the code for the drop down to walk through to find out where the code for drop down started and stopped.

I found this website called Kirupa.com and there was a nice walk through of what you needed to parse using SimpleXML. It included a brief description of XML in case you had stumbled on to the page. Then it went in to showing you the code and what each line was and why it was needed.

I also found a decent explanation on the DOM parser at the W3 Schools. It is good example of looping through the xml to pulled it out in to readable text. See code posted from the site below:


$xmlDoc = new DOMDocument();
$xmlDoc->load("note.xml");

$x = $xmlDoc->documentElement;
foreach ($x->childNodes AS $item)
{
print $item->nodeName . " = " . $item->nodeValue . "
";

}
?>

If I get time before class tomorrow I will see if I can get my rss feed for Iteration 2 parsed out.

1 comment:

  1. Thank you for the helpful information. I really liked the examples for XML and Php. This site breaks the code down in an easy and clear way. This is very useful to help parse through my data.

    ReplyDelete