]> src.bluestatic.org Git - isso.git/blob - php520-test/SimpleXml.php
We need to throw Exceptions rather than trigger_error()
[isso.git] / php520-test / SimpleXml.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework
5 || # Copyright (c)2005-2008 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 header('Content-Type: text/html; charset=utf8');
23
24 // simple document
25 $data = file_get_contents('../docs/xmltest.xml');
26 $xml = new SimpleXMLElement($data);
27 print_r($xml);
28 print_r($xml->download[1]->date->timestamp->attributes());
29
30 // utf8 - no header tag
31 $data = '<doc>
32 <moo>הודעות של צור קשר לא מגיעות לשום מקום</moo>
33 </doc>';
34 $xml = new SimpleXmlElement($data);
35 print_r($xml);
36
37 // utf8
38 $data = '<?xml version="1.0" encoding="utf-8" ?>
39 <doc>
40 <moo>הודעות של צור קשר לא מגיעות לשום מקום</moo>
41 </doc>';
42 $xml = new SimpleXmlElement($data);
43 print_r($xml);
44
45 ?>