PRANG
view release on metacpan or search on metacpan
lib/PRANG/XMLSchema/simple.xml
lib/PRANG/XMLSchema/simple.xsd
lib/PRANG/XMLSchema/simple2.xml
lib/PRANG/XMLSchema/simple2.xsd
perltidy
t/00-load.t
t/01-meta.t
t/10-attributes.t
t/11-elements.t
t/12-warnings.t
t/13-cdata.t
t/20-validating.t
t/21-emitting.t
t/22-round-tripping.t
t/23-cookbook.t
t/24-parse-methods.t
t/90-pod-syntax.t
t/91-pod-coverage.t
t/92-license.t
t/Cookbook/01-note.xml
t/Cookbook/02-with-body.xml
t/13-cdata.t view on Meta::CPAN
}
my @tests = (
{
desc => "XML with CDATA",
xml => qq|
<Sins>
<Envy><![CDATA[envious]]></Envy>
</Sins>
|,
emit_cdata => 1,
},
{
desc => "XML without CDATA",
xml => qq|
<Sins>
<Envy>envious</Envy>
</Sins>
|,
emit_cdata => 0,
},
);
foreach my $test (@tests) {
my $parser = XML::LibXML->new;
$parser->keep_blanks(0);
$PRANG::EMIT_CDATA = $test->{emit_cdata};
my $doc1 = $parser->parse_string($test->{xml});
my $sins = Sins->from_dom($doc1);
is($sins->envy, 'envious', $test->{desc} . " - Text node populated correctly");
my $doc2 = $parser->parse_string($sins->to_xml);
my $envy_element = $doc2->firstChild->firstChild;
my $text_node = $envy_element->firstChild;
my $expected_node_type = $test->{emit_cdata} ? XML_CDATA_SECTION_NODE : XML_TEXT_NODE;
is($text_node->nodeType, $expected_node_type, $test->{desc} . "Text node is of correct type");
is($text_node->data, 'envious', $test->{desc} . "Text node has correct value");
}
# Copyright (C) 2009, 2010 NZ Registry Services
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the Artistic License 2.0 or later.
t/23-cookbook.t view on Meta::CPAN
use PRANG::Cookbook;
use PRANG::Cookbook::Note;
use PRANG::Cookbook::Library;
our @tests = XMLTests::find_tests "Cookbook";
plan tests => @tests * 3;
my $xml_compare = XML::Compare->new(
ignore => [
q{//Error//text()}, # FIXME - cdata types
q{//AccessControlListQry/@FullResult},
],
);
for my $test ( sort @tests ) {
my $xml = XMLTests::read_xml($test);
my $object = XMLTests::parse_test( "PRANG::Cookbook", $xml, $test );
SKIP:{
skip "parse failed", 2 if !$object;
( run in 0.259 second using v1.01-cache-2.11-cpan-454fe037f31 )