src/Utils/Converter.php
public function toXLIFF($pretty_print = FALSE) {
    $this->doc->formatOutput = $pretty_print;

    // Do not use getElementById to comply with older versions of libxml.
    // getElementById doesn't work properly on libxml 2.7.6 (CentOS)
    $xpath = new \DOMXPath($this->doc);
    $wrapper_div = $xpath->query("//*[@id='eggs-n-cereal-dont-ever-use-this-id']")->item(0);

    $out = $this->doc->createDocumentFragment();

    $domNodeList = array();
    for ($i = 0; $i < $wrapper_div->childNodes->length; ++$i) {
      $domNodeList[] = $wrapper_div->childNodes->item($i);
    }

    $this->sanitizeMixedDomNodeList($this->doc, $domNodeList);

    foreach($domNodeList as $domNode){
      if ($output = $this->convert($domNode)) {
        $out->appendChild($output);
      }
    }

    return $this->doc->saveXML($out);
  }
public function toXLIFF($pretty_print = FALSE) {
    $this->doc->formatOutput = $pretty_print;

    // Do not use getElementById to comply with older versions of libxml.
    // getElementById doesn't work properly on libxml 2.7.6 (CentOS)
    $xpath = new \DOMXPath($this->doc);
    $wrapper_div = $xpath->query("//*[@id='eggs-n-cereal-dont-ever-use-this-id']")->item(0);

    $out = $this->doc->createDocumentFragment();

    $domNodeList = array();
    for ($i = 0; $i < $wrapper_div->childNodes->length; ++$i) {
      $domNodeList[] = $wrapper_div->childNodes->item($i);
    }

    $this->sanitizeMixedDomNodeList($this->doc, $domNodeList);

    foreach($domNodeList as $domNode){
      if ($output = $this->convert($domNode)) {
        $out->appendChild($output);
      }
    }

    return $this->doc->saveXML($out);
  }
public function toXLIFF ( $ pretty_print = FALSE ) { $ this -> doc -> formatOutput = $ pretty_print ; // Do not use getElementById to comply with older versions of libxml. // getElementById doesn't work properly on libxml 2.7.6 (CentOS) $ xpath = new \ DOMXPath ( $ this -> doc ) ; $ wrapper_div = $ xpath -> query ( "//*[@id='eggs-n-cereal-dont-ever-use-this-id']" ) -> item ( 0 ) ; $ out = $ this -> doc -> createDocumentFragment ( ) ; $ domNodeList = array ( ) ; for ( $ i = 0 ; $ i < $ wrapper_div -> childNodes -> length ; ++ $ i ) { $ domNodeList [ ] = $ wrapper_div -> childNodes -> item ( $ i ) ; } $ this -> sanitizeMixedDomNodeList ( $ this -> doc , $ domNodeList ) ; foreach ( $ domNodeList as $ domNode ) { if ( $ output = $ this -> convert ( $ domNode ) ) { $ out -> appendChild ( $ output ) ; } } return $ this -> doc -> saveXML ( $ out ) ; }
Converts HTML to the corresponding XLIFF representation.

@return string
The source HTML converted to XLIFF.
Converts HTML to the corresponding XLIFF representation .