public function processElement($element, $depth) { if (IdmlPxeHelper::hasPxeParents($element) || IdmlPxeHelper::elementHasContent($element)) { $cssClassNames = array(); IdmlPxeHelper::setPxeParents($element, $this->verifyParentIds(IdmlPxeHelper::getPxeParents($element))); $tagName = IdmlPxeHelper::getPxeTag($element); if (IdmlPxeHelper::hasPxeClass($element)) { $tagName .= "." . IdmlPxeHelper::getPxeClass($element); } if (!is_object($this->pxeRules)) { $this->pxeRules = new PxeRules(); } if ($this->pxeRules->requiresAttribute($tagName, "id")) { $this->verifyElementId($element, true); } else { $this->verifyElementId($element); } if (strlen($element->idAttribute) > 0) { $element->attribs["id"] = $element->idAttribute; } $element->attribs['class'] = implode(' ', $cssClassNames); $strAttr = $this->getHTMLAttributesString($element, $element->attribs); if ($this->hasDivParent) { $this->addPageElement("<span {$strAttr}>", $depth); $element->idmlTag = "span"; } else { $this->addPageElement("<div {$strAttr}>", $depth); $element->idmlTag = "div"; $this->hasDivParent = true; } } else { $element->idmlTag = "(empty)"; } }
/** * Sets the element ID if required by the PXE tag assigned and isnt already set. * Uses the element's hash value if it has one, or uses a brand new hash value if necessary * @param IdmlElement $element */ public function assignIdAttribute(IdmlElement $element) { if (strlen($element->idAttribute) == 0 && $this->pxeRules->requiresAttribute(IdmlPxeHelper::getPxeTag($element), "id")) { if (IdmlPxeHelper::hasHashValue($element)) { $element->idAttribute = $this->getElementHashTag($element); } else { $element->idAttribute = IdmlPxeHelper::getNewTagHash(); } } }