FluentDOM\Document::appendElement PHP Method

appendElement() public method

Overload appendElement to add a text content and attributes directly.
public appendElement ( string $name, string $content = '', array $attributes = NULL ) : Element
$name string
$content string
$attributes array
return Element
    public function appendElement($name, $content = '', array $attributes = NULL)
    {
        $this->appendChild($node = $this->createElement($name, $content, $attributes));
        return $node;
    }

Usage Example

 /**
  * @see Loadable::load
  * @param mixed $source
  * @param string $contentType
  * @param array $options
  * @return Document|NULL
  */
 public function load($source, $contentType, array $options = [])
 {
     if ($this->supports($contentType) && ($this->_lines = $this->getLines($source))) {
         $dom = new Document('1.0', 'UTF-8');
         $dom->registerNamespace('', $this->_namespace);
         $dom->appendElement($this->_nodeNames['root'])->append($this);
         return $dom;
     }
     return NULL;
 }
All Usage Examples Of FluentDOM\Document::appendElement