public function __construct() { parent::__construct('html'); $head = new HtmlNode('head'); $body = new HtmlNode('body'); $nome = new HtmlText('Wanderson Henrique Camargo '); $body->addContentNode($nome); $bold = new HtmlNode('b'); $sobrenome = new HtmlText('Rosa'); $bold->addContentNode($sobrenome); $body->addContentNode($bold); $this->addContentNode($head)->addContentNode($body); }
public function __construct(HtmlDoc $htmlDocument) { parent::__construct(HtmlNode::ELEMENT_NODE, $htmlDocument); $this->namespace = null; $this->tagName = null; $this->tagType = null; $this->attributes = array(); $this->attributesNamed = array(); $this->tagExtension = null; $this->closed = false; }
/** * Returns the previous sibling * * @return HtmlNode|null The previous sibling or NULL of no previous sibling exists */ public function getPrevSibling() { $cNodes = $this->parentNode->childNodes; $prevPos = $this->parentNode->findNodePosition($this) - 1; for ($i = $prevPos; $i > 0; --$i) { if ($cNodes[$i] instanceof $this === false) { continue; } return $cNodes[$i]; } return null; }
public function __construct(HtmlDoc $htmlDocument) { parent::__construct(HtmlNode::CDATA_SECTION_NODE, $htmlDocument); }
public function __construct(HtmlDoc $htmlDocument) { parent::__construct(HtmlNode::TEXT_NODE, $htmlDocument); }
public function __construct(HtmlDoc $htmlDocument) { parent::__construct(HtmlNode::DOCUMENT_TYPE_NODE, $htmlDocument); }
public function replaceNode(HtmlNode $nodeSearch, HtmlNode $nodeReplace) { $parentSearchNode = $nodeSearch->getParentNode(); $nodeList = null; if ($parentSearchNode === null) { $nodeList = $this->nodeTree; } else { $nodeList = $nodeSearch->getParentNode()->childNodes; } $countChildren = count($nodeList); for ($i = 0; $i < $countChildren; $i++) { if ($nodeList[$i] !== $nodeSearch) { continue; } $nodeList[$i] = $nodeReplace; break; } if ($parentSearchNode === null) { $this->nodeTree = $nodeList; } else { $parentSearchNode->setChildNodes($nodeList); } }