src/Serializer.php
public function serializerSimplexmlLoadString($xmlString){
    $numericTable = array();
    //commonly present restricted characters that can safely be replaced
    $numericTable['&'] = '&#38;';
    $entBitmask = defined('ENT_HTML5') ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
    $trans = get_html_translation_table(HTML_ENTITIES, $entBitmask);
    foreach ($trans as $k=>$v){
      $numericTable[$v]= "&#".ord($k).";";
    }
    $xmlString = strtr($xmlString, $numericTable);
    return simplexml_load_string($xmlString);
  }
public function serializerSimplexmlLoadString($xmlString){
    $numericTable = array();
    //commonly present restricted characters that can safely be replaced
    $numericTable['&'] = '&#38;';
    $entBitmask = defined('ENT_HTML5') ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
    $trans = get_html_translation_table(HTML_ENTITIES, $entBitmask);
    foreach ($trans as $k=>$v){
      $numericTable[$v]= "&#".ord($k).";";
    }
    $xmlString = strtr($xmlString, $numericTable);
    return simplexml_load_string($xmlString);
  }
public function serializerSimplexmlLoadString ( $ xmlString ) { $ numericTable = array ( ) ; //commonly present restricted characters that can safely be replaced $ numericTable [ '&' ] = '&#38;' ; $ entBitmask = defined ( 'ENT_HTML5' ) ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES ; $ trans = get_html_translation_table ( HTML_ENTITIES , $ entBitmask ) ; foreach ( $ trans as $ k => $ v ) { $ numericTable [ $ v ] = "&#" . ord ( $ k ) . ";" ; } $ xmlString = strtr ( $ xmlString , $ numericTable ) ; return simplexml_load_string ( $ xmlString ) ; }
Converts xml to string and handles entity encoding.

@param string $xmlString
The xml string to convert to xml.

@return \SimpleXMLElement
Returns SimpleXml element
Converts xml to string and handles entity encoding .