/** * Parses <b> element, as after <b> elements occur data, that needs to * be extracted. * * @param DOMElement $final * @param array $pole * * @returns array with parsed data */ private function spracujB(Trace $trace, DOMElement $final) { //do attribue_names pridam element, podla ktoreho parsujem $attributeName = ParserUtils::fixNbsp($final->nodeValue); $this->attribute_names[] = $attributeName; $child = $trace->addChild("Parsing attribute '{$attributeName}'"); $sused = $final->nextSibling; if ($sused == NULL) { $child->tlog("No value to parse"); return; } if ($sused->nextSibling == NULL) { // je textNode $child->tlog("Attribute is text node"); $child->tlogVariable("Parsed attribute:", $sused->nodeValue); $values = array(self::fixAttributeValue($sused->nodeValue)); $this->setAttribute($trace, $attributeName, $values); return; } $textSused = $sused->nextSibling; if ($textSused->nodeType != \XML_ELEMENT_NODE) { $child->tlog("Nothing to parse here"); return; } if ($textSused->tagName == 'p') { $child->tlog("Parsing <p> tags"); $values = array(); for (; $textSused != null; $textSused = $textSused->nextSibling) { if ($textSused->nodeType != \XML_ELEMENT_NODE || $textSused->tagName != 'p') { continue; } $values[] = self::fixAttributeValue($textSused->nodeValue); } $child->tlogVariable("Parsed attribute:", $values); $this->setAttribute($trace, $attributeName, $values); } else { $child->tlog("Parsing other tags"); $child->tlogVariable("Parsed attribute:", $sused->nodeValue); $values = array(self::fixAttributeValue($sused->nodeValue)); $this->setAttribute($trace, $attributeName, $values); } }