/** * Recursive XML Nodes Checking * * @param string $path xpath * @param SLS_XMLToolBox $xml */ private function checkNode($path, $xml) { if (substr($path, strlen($path)-1, 1) != "/") $path .= "/"; $childs = $xml->returnXpathQuery($path."*"); //var_dump($childs->item(0)->getAttribute("isSecure")); exit; for ($i=0 ; $i<$childs->length ; $i++) { $setAtt = array(); $isSecure = (string)$childs->item($i)->getAttribute('isSecure'); if ($isSecure != 'true' && $isSecure != 'false') $setAtt['isSecure'] = 'true'; //array_push($arrayErrors, "The node ".$path.(string)$childs->item($i)->nodeName." should have the attribute 'isSecure' set to 'true' or 'false'"); $js = (string)$childs->item($i)->getAttribute('js'); if ($js != 'true' && $js != 'false') $setAtt['js'] = 'false'; //array_push($arrayErrors, "The node ".$path.(string)$childs->item($i)->nodeName." should have the attribute 'js' set to 'true' or 'false'"); if (!empty($setAtt)) $xml->setTagAttributes($path.(string)$childs->item($i)->nodeName, $setAtt); if ($childs->item($i)->hasChildNodes()) { if (is_object($childs->item($i)->childNodes->item(0))) { //var_dump(get_class($childs->item($i)->childNodes->item(0))); exit; if (get_class($childs->item($i)->childNodes->item(0)) !== "DOMText" && get_class($childs->item($i)->childNodes->item(0)) !== "DOMCdataSection") $xml = $this->checkNode($path.(string)$childs->item($i)->name, $xml); } } } return $xml; }