You are here

public function LingotekXMLElement::addXML in Lingotek Translation 7.7

Add a SimpleXMLElement object to this object

Parameters

SimpleXMLElement $xml:

File

lib/Drupal/lingotek/LingotekXMLElement.php, line 39
Defines LingotekXMLElement

Class

LingotekXMLElement
An extension of SimpleXMLElement to add CDATA

Code

public function addXML(SimpleXMLElement $xml) {
  $to_dom = dom_import_simplexml($this);
  $from_dom = dom_import_simplexml($xml);
  foreach ($from_dom->childNodes as $child_element) {
    $to_dom
      ->appendChild($to_dom->ownerDocument
      ->importNode($child_element, TRUE));
  }
}