@@ -145,20 +145,20 @@ |
||
| 145 | 145 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 146 | 146 | * @version 2016-11-21 |
| 147 | 147 | */ |
| 148 | - public function loadXML($source, $options = null) |
|
| 149 | - { |
|
| 150 | - $tRetorno = $source ? parent::load($this->iso2utf($source), $options) : false; |
|
| 148 | + public function loadXML($source, $options = null) |
|
| 149 | + { |
|
| 150 | + $tRetorno = $source ? parent::load($this->iso2utf($source), $options) : false; |
|
| 151 | 151 | |
| 152 | - if (!$tRetorno){ |
|
| 153 | - $tRetorno = parent::loadXML($this->iso2utf($source), $options); |
|
| 154 | - } |
|
| 155 | - if(!$tRetorno){ |
|
| 156 | - foreach (libxml_get_errors() as $error) { |
|
| 157 | - echo "Error: " . $error->message; |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - return $tRetorno; |
|
| 161 | - } |
|
| 152 | + if (!$tRetorno){ |
|
| 153 | + $tRetorno = parent::loadXML($this->iso2utf($source), $options); |
|
| 154 | + } |
|
| 155 | + if(!$tRetorno){ |
|
| 156 | + foreach (libxml_get_errors() as $error) { |
|
| 157 | + echo "Error: " . $error->message; |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + return $tRetorno; |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * Método para realizar consultas XPATH al documento XML |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | $tRetorno = $source ? parent::load($this->iso2utf($source), $options) : false; |
| 151 | 151 | |
| 152 | - if (!$tRetorno){ |
|
| 152 | + if (!$tRetorno) { |
|
| 153 | 153 | $tRetorno = parent::loadXML($this->iso2utf($source), $options); |
| 154 | 154 | } |
| 155 | - if(!$tRetorno){ |
|
| 155 | + if (!$tRetorno) { |
|
| 156 | 156 | foreach (libxml_get_errors() as $error) { |
| 157 | - echo "Error: " . $error->message; |
|
| 157 | + echo "Error: ".$error->message; |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | return $tRetorno; |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | private function utf2iso($string) |
| 209 | 209 | { |
| 210 | - return mb_detect_encoding($string, ['UTF-8', 'ISO-8859-1']) != 'ISO-8859-1' ? utf8_decode($string) : $string; |
|
| 210 | + return mb_detect_encoding($string, ['UTF-8', 'ISO-8859-1'])!='ISO-8859-1' ? utf8_decode($string) : $string; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | // agregar nodos hijos |
| 249 | 249 | if ($dom->hasChildNodes()) { |
| 250 | - foreach($dom->childNodes as $child) { |
|
| 250 | + foreach ($dom->childNodes as $child) { |
|
| 251 | 251 | if ($child instanceof \DOMText) { |
| 252 | 252 | $textContent = trim($child->textContent); |
| 253 | 253 | if ($textContent!="") { |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $newXML = ''; |
| 373 | 373 | $n_letras = strlen($xml); |
| 374 | 374 | $convertir = false; |
| 375 | - for ($i=0; $i<$n_letras; ++$i) { |
|
| 375 | + for ($i = 0; $i<$n_letras; ++$i) { |
|
| 376 | 376 | if ($xml[$i]=='>') |
| 377 | 377 | $convertir = true; |
| 378 | 378 | if ($xml[$i]=='<') |