1 <?php
2
3 class Kint_Parsers_Xml extends kintParser
4 {
5 protected function _parse( & $variable )
6 {
7 try {
8 if ( is_string( $variable ) && substr( $variable, 0, 5 ) === '<?xml' ) {
9 $e = libxml_use_internal_errors( true );
10 $xml = simplexml_load_string( $variable );
11 libxml_use_internal_errors( $e );
12 if ( empty( $xml ) ) {
13 return false;
14 }
15 } else {
16 return false;
17 }
18 } catch ( Exception $e ) {
19 return false;
20 }
21
22 $this->value = kintParser::factory( $xml )->extendedValue;
23 $this->type = 'XML';
24 }
25 }
26