| 1 | <?php |
||
| 5 | abstract class XML { |
||
| 6 | |||
| 7 | # Create XML object |
||
| 8 | |||
| 9 | public static function create(string $data) { |
||
| 10 | |||
| 11 | $data = ('<?xml version="1.0" encoding="UTF-8" ?>' . $data); |
||
| 12 | |||
| 13 | return @simplexml_load_string($data); |
||
| 14 | } |
||
| 15 | |||
| 16 | # Convert XML object to string |
||
| 17 | |||
| 18 | public static function string(SimpleXMLElement $xml) { |
||
| 28 | |||
| 29 | # Output XML data |
||
| 30 | |||
| 31 | public static function output(SimpleXMLElement $xml) { |
||
| 32 | |||
| 33 | Headers::nocache(); Headers::content(MIME_TYPE_XML); |
||
| 34 | |||
| 35 | echo self::string($xml); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | } |
||
| 39 |