Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
Create books XML from array.
3
 
4
--FILE--
5
<?php
6
require_once '../ArrayToDOMDocument.php';
7
 
8
$data = array(
9
	'book' => array(
10
		array(
11
			'author' => 'Author0',
12
			'title' => 'Title0',
13
			'publisher' => 'Publisher0',
14
			'__attributes__' => array(
15
				'isbn' => '978-3-16-148410-0'
16
			)
17
		),
18
		array(
19
			'author' => array('Author1', 'Author2'),
20
			'title' => 'Title1',
21
			'publisher' => 'Publisher1'
22
		),
23
		array(
24
			'__attributes__' => array(
25
				'isbn' => '978-3-16-148410-0'
26
			),
27
			'__content__' => 'Title2'
28
		)
29
	)
30
);
31
 
32
echo Array2DOM::arrayToXMLString($data);
33
?>
34
 
35
--EXPECT--
36
<?xml version="1.0"?>
37
<root>
38
  <book isbn="978-3-16-148410-0">
39
    <author><![CDATA[Author0]]></author>
40
    <title><![CDATA[Title0]]></title>
41
    <publisher><![CDATA[Publisher0]]></publisher>
42
  </book>
43
  <book>
44
    <author><![CDATA[Author1]]></author>
45
    <author><![CDATA[Author2]]></author>
46
    <title><![CDATA[Title1]]></title>
47
    <publisher><![CDATA[Publisher1]]></publisher>
48
  </book>
49
  <book isbn="978-3-16-148410-0"><![CDATA[Title2]]></book>
50
</root>