RayApp
view release on metacpan or search on metacpan
core-tests/t/3_load_dsd.t view on Meta::CPAN
[ 'Honda', 1990 ],
],
],
undef,
{
person => {
personname => [ 15, 'Sally', undef, 'Albright' ],
age => 23,
},
cars => [
{
make => 'GMC',
year => 1952,
},
],
},
],
}, { RaiseError => 0, validate => 1 }), '<?xml version="1.0"?>
<x>
<record>
<person>
<personname>
<id>13</id>
<firstname>Amanda</firstname>
<middlename>X.</middlename>
<lastname>Reese</lastname>
</personname>
<age>23</age>
</person>
<cars>
<make>Volvo</make>
<year>1980</year>
</cars>
<cars>
<make>Honda</make>
<year>1990</year>
</cars>
</record>
<record>
<person>
<personname>
<id>15</id>
<firstname>Sally</firstname>
<lastname>Albright</lastname>
</personname>
<age>23</age>
</person>
<cars>
<make>GMC</make>
<year>1952</year>
</cars>
</record>
</x>
', 'Checking serializing, lists and all');
is($dsd->errstr, undef, 'No errstr');
ok($dsd = $rayapp->load_dsd_string('<?xml version="1.0"?>
<application>
<text cdata="yes"/>
<text1 />
<result type="int"/>
</application>
'), 'Loading DSD with CDATA specifications');
is($rayapp->errstr, undef, 'Should be not error');
is($dsd->md5_hex, '34d45a0fd87b715fb3a34ace820d0597',
'Checking MD5 of the DSD');
is($dsd->serialize_data({
'text' => "hola<b>\n']]>hoj<",
'text1' => "hola<b>\n']]>hoj<",
'result' => -1
}, { RaiseError => 0, validate => 1 }), q#<?xml version="1.0"?>
<application>
<text><![CDATA[hola<b>
']]]><![CDATA[]>hoj<]]></text>
<text1>hola<b>
']]>hoj<</text1>
<result>-1</result>
</application>
#, 'Serializing');
is($dsd->errstr, undef, 'Want no error message');
ok($dsd = $rayapp->load_dsd_string('<?xml version="1.0"?>
<application>
<p typeref="person3.xml"/>
</application>
'), 'Loading DSD with root typeref leading to another remote typeref');
is($rayapp->errstr, undef, 'Should be not error');
is($dsd->md5_hex, '85f1e21edc3e61422cc157ec7f22612d',
'Checking MD5 of the DSD');
is($dsd->out_content, '<?xml version="1.0"?>
<application>
<p>
<person>
<id/>
<firstname/>
<middlename/>
<lastname/>
<lineage/>
</person>
<num_of_children/>
</p>
</application>
', 'Checking the content');
is($dsd->serialize_data({
'p' => {
num_of_children => 'sixteen',
person => {
id => '0987654321',
firstname => 'Amanda',
middlename => 'Carol',
lastname => 'Reese',
}
}
}, { RaiseError => 0, validate => 1 }), '<?xml version="1.0"?>
<application>
<p>
( run in 1.064 second using v1.01-cache-2.11-cpan-6736b670a1e )