function populateFromDomNode($rootNode) { $children = new xArray($rootNode->get_elements_by_tagname('*')); $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bversion\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->version = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bsummary\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->summary = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\btype\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->type = $res->get_content(); } //REWIEVER $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\breviewer\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->reviewer = new hCard($res); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bdtreviewed\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->dateReviewed = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\brating\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->rating = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bdescription\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->description = $res->get_content(); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\btags\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->tags = new xArray($this->tags); $m = new MicroFormatParser(); foreach ($res->child_nodes() as $rcn) { $e = $m->parseRel($rcn); $this->tags->append($e->toArray()); } } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\bpermalink\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->permalink = new relElement($res); } $res = $children->detect(' $atts = new xArray($value->attributes()); return $atts->detect(\' return ("class" == $value->name && preg_match("/\\blicense\\b/", $value->value)) ? true : false; \'); '); if ($res) { $this->license = new relElement($res); } }
<?php require 'MicroFormatParser.php'; $url = !empty($_REQUEST['url']) ? $_REQUEST['url'] : 'testpage.html'; $html = file_get_contents($url); // Instantiate the parser. $mfParser = new MicroFormatParser(); // Set parser options. $mfParser->parserSetup(array('hcard' => true, 'hreview' => true, 'hcalendar' => true, 'reltag' => true)); // Parse $mf = $mfParser->parseSource($html); // Output the resulting xArray echo '<pre>'; $mf->each(' echo "<h1>".get_class($value)."</h1>"; var_export($value); echo "<hr />"; '); /* ### See documentation for xArray on more ways to manipulate the data ### */