view release on metacpan or search on metacpan
core-tests/t/3_load_dsd.t view on Meta::CPAN
</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<",
lib/RayApp/DSD.pm view on Meta::CPAN
'hash' => 'hash',
'hashelement' => 'hashelement',
'' => 'no',
},
'hashorder' => {
'num' => 'num',
'string' => 'string',
'natural' => 'natural',
'' => 'natural',
},
'cdata' => {
'yes' => 'yes',
'no' => 'no',
'' => 'no',
},
);
my %PARAM_ATTRIBUTES = (
'type' => $DATA_ATTRIBUTES{'type'},
'multiple' => {
lib/RayApp/DSD.pm view on Meta::CPAN
and not $data =~ /^[+-]?\d+$/) {
$self->{errstr} .= "Value '$data' of $showname is not integer for data element defined at line $spec->{'ln'}\n";
removeChildNodeNicely($node->parentNode, $node);
return 0;
} elsif ($spec->{'type'} eq 'num'
and not $data =~ /^[+-]?\d*\.?\d+$/) {
$self->{errstr} .= "Value '$data' of $showname is not numeric for data element defined at line $spec->{'ln'}\n";
removeChildNodeNicely($node->parentNode, $node);
return 0;
}
if ($spec->{'cdata'} eq 'yes') {
while ($data =~ s/^(.*\])(?=\]>)//sg) {
$node->appendChild($dom->createCDATASection($1));
}
$node->appendChild($dom->createCDATASection($data));
} else {
$node->appendText($data);
}
return 1;
} elsif ($spec->{'type'} eq 'hash') {
if (not ref $data) {
lib/RayApp/DSD.pm view on Meta::CPAN
Specifies the name of attribute which will hold keys of
individual values for multiple values B<hash> and B<hashelement>,
the default is B<id>.
=item hashorder
Order of elements for values binded using multiple values B<hash> or
B<hashelement>. Possible values are B<num>, B<string>, and
(the default) B<natural>.
=item cdata
When set to yes, the scalar content of this element will be
output as a CDATA section.
=back
=head2 Conditions
The non-placeholder elements can have one of the B<if>, B<ifdef>,
B<ifnot> or B<ifnotdef> attributes that specify a top-level value
origlib/RayApp.pm view on Meta::CPAN
'hash' => 'hash',
'hashelement' => 'hashelement',
'' => 'no',
},
'hashorder' => {
'num' => 'num',
'string' => 'string',
'natural' => 'natural',
'' => 'natural',
},
'cdata' => {
'yes' => 'yes',
'no' => 'no',
'' => 'no',
},
);
my %PARAM_ATTRIBUTES = (
'type' => $DATA_ATTRIBUTES{'type'},
'multiple' => {
origlib/RayApp.pm view on Meta::CPAN
and not $data =~ /^[+-]?\d+$/) {
$self->{errstr} .= "Value '$data' of $showname is not integer for data element defined at line $spec->{'ln'}\n";
RayApp::removeChildNodeNicely($node->parentNode, $node);
return 0;
} elsif ($spec->{'type'} eq 'num'
and not $data =~ /^[+-]?\d*\.?\d+$/) {
$self->{errstr} .= "Value '$data' of $showname is not numeric for data element defined at line $spec->{'ln'}\n";
RayApp::removeChildNodeNicely($node->parentNode, $node);
return 0;
}
if ($spec->{'cdata'} eq 'yes') {
while ($data =~ s/^(.*\])(?=\]>)//sg) {
$node->appendChild($dom->createCDATASection($1));
}
$node->appendChild($dom->createCDATASection($data));
} else {
$node->appendText($data);
}
return 1;
} elsif ($spec->{'type'} eq 'hash') {
if (not ref $data) {
origlib/RayApp.pm view on Meta::CPAN
Specifies the name of attribute which will hold keys of
individual values for multiple values B<hash> and B<hashelement>,
the default is B<id>.
=item hashorder
Order of elements for values binded using multiple values B<hash> or
B<hashelement>. Possible values are B<num>, B<string>, and
(the default) B<natural>.
=item cdata
When set to yes, the scalar content of this element will be
output as a CDATA section.
=back
=head2 Conditions
The non-placeholder elements can have one of the B<if>, B<ifdef>,
B<ifnot> or B<ifnotdef> attributes that specify a top-level value
origlib/RayApp/DSD.pm view on Meta::CPAN
'hash' => 'hash',
'hashelement' => 'hashelement',
'' => 'no',
},
'hashorder' => {
'num' => 'num',
'string' => 'string',
'natural' => 'natural',
'' => 'natural',
},
'cdata' => {
'yes' => 'yes',
'no' => 'no',
'' => 'no',
},
);
my %PARAM_ATTRIBUTES = (
'type' => $DATA_ATTRIBUTES{'type'},
'multiple' => {
origlib/RayApp/DSD.pm view on Meta::CPAN
and not $data =~ /^[+-]?\d+$/) {
$self->{errstr} .= "Value '$data' of $showname is not integer for data element defined at line $spec->{'ln'}\n";
removeChildNodeNicely($node->parentNode, $node);
return 0;
} elsif ($spec->{'type'} eq 'num'
and not $data =~ /^[+-]?\d*\.?\d+$/) {
$self->{errstr} .= "Value '$data' of $showname is not numeric for data element defined at line $spec->{'ln'}\n";
removeChildNodeNicely($node->parentNode, $node);
return 0;
}
if ($spec->{'cdata'} eq 'yes') {
while ($data =~ s/^(.*\])(?=\]>)//sg) {
$node->appendChild($dom->createCDATASection($1));
}
$node->appendChild($dom->createCDATASection($data));
} else {
$node->appendText($data);
}
return 1;
} elsif ($spec->{'type'} eq 'hash') {
if (not ref $data) {
origlib/RayApp/DSD.pm view on Meta::CPAN
Specifies the name of attribute which will hold keys of
individual values for multiple values B<hash> and B<hashelement>,
the default is B<id>.
=item hashorder
Order of elements for values binded using multiple values B<hash> or
B<hashelement>. Possible values are B<num>, B<string>, and
(the default) B<natural>.
=item cdata
When set to yes, the scalar content of this element will be
output as a CDATA section.
=back
=head2 Conditions
The non-placeholder elements can have one of the B<if>, B<ifdef>,
B<ifnot> or B<ifnotdef> attributes that specify a top-level value
origlib/RayApp/Source.pm view on Meta::CPAN
and not $data =~ /^[+-]?\d+$/) {
$self->{errstr} .= "Value '$data' of $showname is not integer for data element defined at line $spec->{'ln'}\n";
RayApp::removeChildNodeNicely($node->parentNode, $node);
return 0;
} elsif ($spec->{'type'} eq 'num'
and not $data =~ /^[+-]?\d*\.?\d+$/) {
$self->{errstr} .= "Value '$data' of $showname is not numeric for data element defined at line $spec->{'ln'}\n";
RayApp::removeChildNodeNicely($node->parentNode, $node);
return 0;
}
if ($spec->{'cdata'} eq 'yes') {
while ($data =~ s/^(.*\])(?=\]>)//sg) {
$node->appendChild($dom->createCDATASection($1));
}
$node->appendChild($dom->createCDATASection($data));
} else {
$node->appendText($data);
}
return 1;
} elsif ($spec->{'type'} eq 'hash') {
if (not ref $data) {
origlib/RayApp/Source.pm view on Meta::CPAN
Specifies the name of attribute which will hold keys of
individual values for multiple values B<hash> and B<hashelement>,
the default is B<id>.
=item hashorder
Order of elements for values binded using multiple values B<hash> or
B<hashelement>. Possible values are B<num>, B<string>, and
(the default) B<natural>.
=item cdata
When set to yes, the scalar content of this element will be
output as a CDATA section.
=back
=head2 Conditions
The non-placeholder elements can have one of the B<if>, B<ifdef>,
B<ifnot> or B<ifnotdef> attributes that specify a top-level value