1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
use strict; |
use strict; |
3 |
require Test::Simple; |
require Test::Simple; |
4 |
use Message::Markup::XML; |
use Message::Markup::XML::Node qw(SGML_NCR SGML_HEX_CHAR_REF |
5 |
use Message::Markup::XML::QName qw:DEFAULT_PFX UNDEF_URI NULL_URI:; |
SGML_ATTLIST SGML_ELEMENT |
6 |
my $NODEMOD = 'Message::Markup::XML'; |
SGML_GENERAL_ENTITY SGML_PARAM_ENTITY |
7 |
my $NS_SGML = $Message::Markup::XML::NS{SGML}; |
SGML_NOTATION SGML_DOCTYPE |
8 |
my $NS_XML = $Message::Markup::XML::NS{XML}; |
XML_ATTLIST); |
9 |
|
use Message::Markup::XML::QName qw:DEFAULT_PFX NS_xml_URI NULL_URI:; |
10 |
|
my $NODEMOD = 'Message::Markup::XML::Node'; |
11 |
|
|
12 |
sub OK ($$;$) { |
sub OK ($$;$) { |
13 |
my ($result, $expect, $testname) = @_; |
my ($result, $expect, $testname) = @_; |
14 |
my @expect = ref $expect ?@ $expect : ($expect); |
my @expect = ref $expect ?@ $expect : ($expect); |
43 |
{ |
{ |
44 |
main => sub { |
main => sub { |
45 |
my $n = $NODEMOD->new (type => '#element', |
my $n = $NODEMOD->new (type => '#element', |
46 |
|
local_name => 'foo'); |
47 |
|
OK $n->outer_xml, q<<foo xmlns=""></foo>>, |
48 |
|
'Simple default-null-ns element'; |
49 |
|
}, |
50 |
|
}, |
51 |
|
{ |
52 |
|
main => sub { |
53 |
|
my $n = $NODEMOD->new (type => '#element', |
54 |
namespace_uri => q<http://uri.example/>, |
namespace_uri => q<http://uri.example/>, |
55 |
local_name => 'foo'); |
local_name => 'foo'); |
56 |
OK $n->outer_xml, |
OK $n->outer_xml, |
631 |
{ |
{ |
632 |
main => sub { |
main => sub { |
633 |
my $n = $NODEMOD->new (type => '#reference', |
my $n = $NODEMOD->new (type => '#reference', |
634 |
namespace_uri => $NS_SGML.'entity', |
namespace_uri => SGML_GENERAL_ENTITY, |
635 |
local_name => 'ent'); |
local_name => 'ent'); |
636 |
OK $n->outer_xml, |
OK $n->outer_xml, |
637 |
[q<&ent;>], |
[q<&ent;>], |
641 |
{ |
{ |
642 |
main => sub { |
main => sub { |
643 |
my $n = $NODEMOD->new (type => '#reference', |
my $n = $NODEMOD->new (type => '#reference', |
644 |
namespace_uri => $NS_SGML.'entity:parameter', |
namespace_uri => SGML_PARAM_ENTITY, |
645 |
local_name => 'ent'); |
local_name => 'ent'); |
646 |
OK $n->outer_xml, |
OK $n->outer_xml, |
647 |
[q<%ent;>], |
[q<%ent;>], |
651 |
{ |
{ |
652 |
main => sub { |
main => sub { |
653 |
my $n = $NODEMOD->new (type => '#reference', |
my $n = $NODEMOD->new (type => '#reference', |
654 |
namespace_uri => $NS_SGML.'char:ref', |
namespace_uri => SGML_NCR, |
655 |
value => 0x0020); |
value => 0x0020); |
656 |
OK $n->outer_xml, |
OK $n->outer_xml, |
657 |
[q< >], |
[q< >], |
661 |
{ |
{ |
662 |
main => sub { |
main => sub { |
663 |
my $n = $NODEMOD->new (type => '#reference', |
my $n = $NODEMOD->new (type => '#reference', |
664 |
namespace_uri => $NS_SGML.'char:ref', |
namespace_uri => SGML_NCR, |
665 |
value => 0x0000); |
value => 0x0000); |
666 |
OK $n->outer_xml, |
OK $n->outer_xml, |
667 |
[q<�>, q<�>], |
[q<�>, q<�>], |
671 |
{ |
{ |
672 |
main => sub { |
main => sub { |
673 |
my $n = $NODEMOD->new (type => '#reference', |
my $n = $NODEMOD->new (type => '#reference', |
674 |
namespace_uri => $NS_SGML.'char:ref:hex', |
namespace_uri => SGML_HEX_CHAR_REF, |
675 |
value => 0x0020); |
value => 0x0020); |
676 |
OK $n->outer_xml, |
OK $n->outer_xml, |
677 |
[q< >, q< >, q< >, q< >], |
[q< >, q< >, q< >, q< >], |
681 |
{ |
{ |
682 |
main => sub { |
main => sub { |
683 |
my $n = $NODEMOD->new (type => '#reference', |
my $n = $NODEMOD->new (type => '#reference', |
684 |
namespace_uri => $NS_SGML.'char:ref:hex', |
namespace_uri => SGML_HEX_CHAR_REF, |
685 |
value => 0x0000); |
value => 0x0000); |
686 |
OK $n->outer_xml, |
OK $n->outer_xml, |
687 |
[q<�>, q<�>, q<�>, q<�>, |
[q<�>, q<�>, q<�>, q<�>, |
693 |
{ |
{ |
694 |
main => sub { |
main => sub { |
695 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
696 |
namespace_uri => $NS_SGML.'entity', |
namespace_uri => SGML_GENERAL_ENTITY, |
697 |
local_name => 'foo'); |
local_name => 'foo'); |
698 |
OK $n->outer_xml, |
OK $n->outer_xml, |
699 |
[q<<!ENTITY foo "">>], |
[q<<!ENTITY foo "">>], |
703 |
{ |
{ |
704 |
main => sub { |
main => sub { |
705 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
706 |
namespace_uri => $NS_SGML.'entity', |
namespace_uri => SGML_GENERAL_ENTITY, |
707 |
local_name => 'foo'); |
local_name => 'foo'); |
708 |
$n->set_attribute (value => '<Entity&Value>'); |
$n->set_attribute (value => '<Entity&Value>'); |
709 |
OK $n->outer_xml, |
OK $n->outer_xml, |
714 |
{ |
{ |
715 |
main => sub { |
main => sub { |
716 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
717 |
namespace_uri => $NS_SGML.'entity', |
namespace_uri => SGML_GENERAL_ENTITY, |
718 |
local_name => 'foo'); |
local_name => 'foo'); |
719 |
$n->append_new_node (type => '#reference', |
$n->append_new_node (type => '#reference', |
720 |
namespace_uri => $NS_SGML.'entity:parameter', |
namespace_uri => SGML_PARAM_ENTITY, |
721 |
local_name => 'foo.val'); |
local_name => 'foo.val'); |
722 |
OK $n->outer_xml, |
OK $n->outer_xml, |
723 |
[q<<!ENTITY foo %foo.val;>>], |
[q<<!ENTITY foo %foo.val;>>], |
727 |
{ |
{ |
728 |
main => sub { |
main => sub { |
729 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
730 |
namespace_uri => $NS_SGML.'entity'); |
namespace_uri => SGML_GENERAL_ENTITY); |
731 |
$n->append_new_node (type => '#reference', |
$n->append_new_node (type => '#reference', |
732 |
namespace_uri => $NS_SGML.'entity:parameter', |
namespace_uri => SGML_PARAM_ENTITY, |
733 |
local_name => 'foo.val'); |
local_name => 'foo.val'); |
734 |
OK $n->outer_xml, |
OK $n->outer_xml, |
735 |
[q<<!ENTITY %foo.val;>>], |
[q<<!ENTITY %foo.val;>>], |
739 |
{ |
{ |
740 |
main => sub { |
main => sub { |
741 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
742 |
namespace_uri => $NS_SGML.'entity:parameter'); |
namespace_uri => SGML_PARAM_ENTITY); |
743 |
$n->append_new_node (type => '#reference', |
$n->append_new_node (type => '#reference', |
744 |
namespace_uri => $NS_SGML.'entity:parameter', |
namespace_uri => SGML_PARAM_ENTITY, |
745 |
local_name => 'foo.val'); |
local_name => 'foo.val'); |
746 |
OK $n->outer_xml, |
OK $n->outer_xml, |
747 |
[q<<!ENTITY % %foo.val;>>], |
[q<<!ENTITY % %foo.val;>>], |
751 |
{ |
{ |
752 |
main => sub { |
main => sub { |
753 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
754 |
namespace_uri => $NS_SGML.'entity', |
namespace_uri => SGML_GENERAL_ENTITY, |
755 |
local_name => 'foo'); |
local_name => 'foo'); |
756 |
$n->set_attribute (SYSTEM => q<http://foo.example/xml>); |
$n->set_attribute (SYSTEM => q<http://foo.example/xml>); |
757 |
OK $n->outer_xml, |
OK $n->outer_xml, |
762 |
{ |
{ |
763 |
main => sub { |
main => sub { |
764 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
765 |
namespace_uri => $NS_SGML.'entity', |
namespace_uri => SGML_GENERAL_ENTITY, |
766 |
local_name => 'foo'); |
local_name => 'foo'); |
767 |
$n->set_attribute (PUBLIC => q"+//IDN foo.example//DTD foo//EN"); |
$n->set_attribute (PUBLIC => q"+//IDN foo.example//DTD foo//EN"); |
768 |
$n->set_attribute (SYSTEM => q<http://foo.example/xml>); |
$n->set_attribute (SYSTEM => q<http://foo.example/xml>); |
775 |
{ |
{ |
776 |
main => sub { |
main => sub { |
777 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
778 |
namespace_uri => $NS_SGML.'notation', |
namespace_uri => SGML_NOTATION, |
779 |
local_name => 'f'); |
local_name => 'f'); |
780 |
$n->set_attribute (PUBLIC => q"+//IDN f.example//NOTATION f//EN"); |
$n->set_attribute (PUBLIC => q"+//IDN f.example//NOTATION f//EN"); |
781 |
OK $n->outer_xml, |
OK $n->outer_xml, |
786 |
{ |
{ |
787 |
main => sub { |
main => sub { |
788 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
789 |
namespace_uri => $NS_SGML.'notation', |
namespace_uri => SGML_NOTATION, |
790 |
local_name => 'f'); |
local_name => 'f'); |
791 |
$n->set_attribute (SYSTEM => q<http://f.example/>); |
$n->set_attribute (SYSTEM => q<http://f.example/>); |
792 |
OK $n->outer_xml, |
OK $n->outer_xml, |
797 |
{ |
{ |
798 |
main => sub { |
main => sub { |
799 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
800 |
namespace_uri => $NS_SGML.'notation', |
namespace_uri => SGML_NOTATION, |
801 |
local_name => 'f'); |
local_name => 'f'); |
802 |
$n->set_attribute (PUBLIC => q"+//IDN f.example//NOTATION f//EN"); |
$n->set_attribute (PUBLIC => q"+//IDN f.example//NOTATION f//EN"); |
803 |
$n->set_attribute (SYSTEM => q<http://f.example/>); |
$n->set_attribute (SYSTEM => q<http://f.example/>); |
810 |
{ |
{ |
811 |
main => sub { |
main => sub { |
812 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
813 |
namespace_uri => $NS_SGML.'attlist'); |
namespace_uri => SGML_ATTLIST); |
814 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
815 |
OK $n->outer_xml, |
OK $n->outer_xml, |
816 |
[q<<!ATTLIST foo>>, q<<!ATTLIST foo >>], |
[q<<!ATTLIST foo>>, q<<!ATTLIST foo >>], |
820 |
{ |
{ |
821 |
main => sub { |
main => sub { |
822 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
823 |
namespace_uri => $NS_SGML.'attlist'); |
namespace_uri => SGML_ATTLIST); |
824 |
$n->set_attribute (qname => 'foo:bar'); |
$n->set_attribute (qname => 'foo:bar'); |
825 |
OK $n->outer_xml, |
OK $n->outer_xml, |
826 |
[q<<!ATTLIST foo:bar>>, q<<!ATTLIST foo:bar >>], |
[q<<!ATTLIST foo:bar>>, q<<!ATTLIST foo:bar >>], |
830 |
{ |
{ |
831 |
main => sub { |
main => sub { |
832 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
833 |
namespace_uri => $NS_SGML.'attlist'); |
namespace_uri => SGML_ATTLIST); |
834 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
835 |
my $attr = $n->append_new_node (type => '#element', |
my $attr = $n->append_new_node (type => '#element', |
836 |
namespace_uri => $NS_XML.'attlist', |
namespace_uri => XML_ATTLIST, |
837 |
local_name => 'AttDef'); |
local_name => 'AttDef'); |
838 |
$attr->set_attribute (qname => 'bar'); |
$attr->set_attribute (qname => 'bar'); |
839 |
$attr->set_attribute (type => 'CDATA'); |
$attr->set_attribute (type => 'CDATA'); |
845 |
{ |
{ |
846 |
main => sub { |
main => sub { |
847 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
848 |
namespace_uri => $NS_SGML.'attlist'); |
namespace_uri => SGML_ATTLIST); |
849 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
850 |
my $attr = $n->append_new_node (type => '#element', |
my $attr = $n->append_new_node (type => '#element', |
851 |
namespace_uri => $NS_XML.'attlist', |
namespace_uri => XML_ATTLIST, |
852 |
local_name => 'AttDef'); |
local_name => 'AttDef'); |
853 |
$attr->set_attribute (qname => 'bar'); |
$attr->set_attribute (qname => 'bar'); |
854 |
my $att2 = $n->append_new_node (type => '#element', |
my $att2 = $n->append_new_node (type => '#element', |
855 |
namespace_uri => $NS_XML.'attlist', |
namespace_uri => XML_ATTLIST, |
856 |
local_name => 'AttDef'); |
local_name => 'AttDef'); |
857 |
$att2->set_attribute (qname => 'ba2'); |
$att2->set_attribute (qname => 'ba2'); |
858 |
OK $n->outer_xml, |
OK $n->outer_xml, |
862 |
{ |
{ |
863 |
main => sub { |
main => sub { |
864 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
865 |
namespace_uri => $NS_SGML.'attlist'); |
namespace_uri => SGML_ATTLIST); |
866 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
867 |
my $attr = $n->append_new_node (type => '#element', |
my $attr = $n->append_new_node (type => '#element', |
868 |
namespace_uri => $NS_XML.'attlist', |
namespace_uri => XML_ATTLIST, |
869 |
local_name => 'AttDef'); |
local_name => 'AttDef'); |
870 |
$attr->set_attribute (qname => 'bar'); |
$attr->set_attribute (qname => 'bar'); |
871 |
$attr->set_attribute (type => 'enum'); |
$attr->set_attribute (type => 'enum'); |
872 |
$attr->append_new_node (type => '#element', |
$attr->append_new_node (type => '#element', |
873 |
namespace_uri => $NS_XML.'attlist', |
namespace_uri => XML_ATTLIST, |
874 |
local_name => 'enum') |
local_name => 'enum') |
875 |
->append_text ('enum1'); |
->append_text ('enum1'); |
876 |
$attr->append_new_node (type => '#element', |
$attr->append_new_node (type => '#element', |
877 |
namespace_uri => $NS_XML.'attlist', |
namespace_uri => XML_ATTLIST, |
878 |
local_name => 'enum') |
local_name => 'enum') |
879 |
->append_text ('enum2'); |
->append_text ('enum2'); |
880 |
$attr->set_attribute (default_value => 'enum2'); |
$attr->set_attribute (default_value => 'enum2'); |
885 |
{ |
{ |
886 |
main => sub { |
main => sub { |
887 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
888 |
namespace_uri => $NS_SGML.'attlist'); |
namespace_uri => SGML_ATTLIST); |
889 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
890 |
my $attr = $n->append_new_node (type => '#element', |
my $attr = $n->append_new_node (type => '#element', |
891 |
namespace_uri => $NS_XML.'attlist', |
namespace_uri => XML_ATTLIST, |
892 |
local_name => 'AttDef'); |
local_name => 'AttDef'); |
893 |
$attr->set_attribute (qname => 'bar'); |
$attr->set_attribute (qname => 'bar'); |
894 |
$attr->set_attribute (type => 'NOTATION'); |
$attr->set_attribute (type => 'NOTATION'); |
895 |
$attr->append_new_node (type => '#element', |
$attr->append_new_node (type => '#element', |
896 |
namespace_uri => $NS_XML.'attlist', |
namespace_uri => XML_ATTLIST, |
897 |
local_name => 'enum') |
local_name => 'enum') |
898 |
->append_text ('enum1'); |
->append_text ('enum1'); |
899 |
$attr->set_attribute (default_type => 'FIXED'); |
$attr->set_attribute (default_type => 'FIXED'); |
905 |
{ |
{ |
906 |
main => sub { |
main => sub { |
907 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
908 |
namespace_uri => $NS_SGML.'attlist'); |
namespace_uri => SGML_ATTLIST); |
909 |
$n->append_new_node (type => '#reference', |
$n->append_new_node (type => '#reference', |
910 |
namespace_uri => $NS_SGML.'entity:parameter', |
namespace_uri => SGML_PARAM_ENTITY, |
911 |
local_name => 'bar'); |
local_name => 'bar'); |
912 |
OK $n->outer_xml, |
OK $n->outer_xml, |
913 |
[qq<<!ATTLIST %bar;>>]; |
[qq<<!ATTLIST %bar;>>]; |
917 |
{ |
{ |
918 |
main => sub { |
main => sub { |
919 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
920 |
namespace_uri => $NS_SGML.'element'); |
namespace_uri => SGML_ELEMENT); |
921 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
922 |
OK $n->outer_xml, |
OK $n->outer_xml, |
923 |
[qq<<!ELEMENT foo EMPTY>>]; |
[qq<<!ELEMENT foo EMPTY>>]; |
926 |
{ |
{ |
927 |
main => sub { |
main => sub { |
928 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
929 |
namespace_uri => $NS_SGML.'element'); |
namespace_uri => SGML_ELEMENT); |
930 |
$n->set_attribute (qname => 'foo:bar'); |
$n->set_attribute (qname => 'foo:bar'); |
931 |
OK $n->outer_xml, |
OK $n->outer_xml, |
932 |
[qq<<!ELEMENT foo:bar EMPTY>>]; |
[qq<<!ELEMENT foo:bar EMPTY>>]; |
935 |
{ |
{ |
936 |
main => sub { |
main => sub { |
937 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
938 |
namespace_uri => $NS_SGML.'element'); |
namespace_uri => SGML_ELEMENT); |
939 |
$n->append_new_node (type => '#reference', |
$n->append_new_node (type => '#reference', |
940 |
namespace_uri => $NS_SGML.'entity:parameter', |
namespace_uri => SGML_PARAM_ENTITY, |
941 |
local_name => 'bar'); |
local_name => 'bar'); |
942 |
OK $n->outer_xml, |
OK $n->outer_xml, |
943 |
[qq<<!ELEMENT %bar;>>]; |
[qq<<!ELEMENT %bar;>>]; |
946 |
{ |
{ |
947 |
main => sub { |
main => sub { |
948 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
949 |
namespace_uri => $NS_SGML.'element'); |
namespace_uri => SGML_ELEMENT); |
950 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
951 |
$n->set_attribute (content => 'element'); |
$n->set_attribute (content => 'element'); |
952 |
my $g = $n->append_new_node (type => '#element', |
my $g = $n->append_new_node (type => '#element', |
953 |
namespace_uri => $NS_SGML.'element', |
namespace_uri => SGML_ELEMENT, |
954 |
local_name => 'group'); |
local_name => 'group'); |
955 |
$g->append_new_node (type => '#element', |
$g->append_new_node (type => '#element', |
956 |
namespace_uri => $NS_SGML.'element', |
namespace_uri => SGML_ELEMENT, |
957 |
local_name => 'element') |
local_name => 'element') |
958 |
->set_attribute (qname => 'e'); |
->set_attribute (qname => 'e'); |
959 |
OK $n->outer_xml, |
OK $n->outer_xml, |
963 |
{ |
{ |
964 |
main => sub { |
main => sub { |
965 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
966 |
namespace_uri => $NS_SGML.'element'); |
namespace_uri => SGML_ELEMENT); |
967 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
968 |
$n->set_attribute (content => 'element'); |
$n->set_attribute (content => 'element'); |
969 |
my $g = $n->append_new_node (type => '#element', |
my $g = $n->append_new_node (type => '#element', |
970 |
namespace_uri => $NS_SGML.'element', |
namespace_uri => SGML_ELEMENT, |
971 |
local_name => 'group'); |
local_name => 'group'); |
972 |
my $e = $g->append_new_node (type => '#element', |
my $e = $g->append_new_node (type => '#element', |
973 |
namespace_uri => $NS_SGML.'element', |
namespace_uri => SGML_ELEMENT, |
974 |
local_name => 'element'); |
local_name => 'element'); |
975 |
$e->set_attribute (qname => 'e'); |
$e->set_attribute (qname => 'e'); |
976 |
$e->set_attribute (occurence => '?'); |
$e->set_attribute (occurence => '?'); |
982 |
{ |
{ |
983 |
main => sub { |
main => sub { |
984 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
985 |
namespace_uri => $NS_SGML.'element'); |
namespace_uri => SGML_ELEMENT); |
986 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
987 |
$n->set_attribute (content => 'element'); |
$n->set_attribute (content => 'element'); |
988 |
my $g = $n->append_new_node (type => '#element', |
my $g = $n->append_new_node (type => '#element', |
989 |
namespace_uri => $NS_SGML.'element', |
namespace_uri => SGML_ELEMENT, |
990 |
local_name => 'group'); |
local_name => 'group'); |
991 |
my $e = $g->append_new_node (type => '#element', |
my $e = $g->append_new_node (type => '#element', |
992 |
namespace_uri => $NS_SGML.'element', |
namespace_uri => SGML_ELEMENT, |
993 |
local_name => 'element'); |
local_name => 'element'); |
994 |
$e->set_attribute (qname => 'e'); |
$e->set_attribute (qname => 'e'); |
995 |
my $f = $g->append_new_node (type => '#element', |
my $f = $g->append_new_node (type => '#element', |
996 |
namespace_uri => $NS_SGML.'element', |
namespace_uri => SGML_ELEMENT, |
997 |
local_name => 'element'); |
local_name => 'element'); |
998 |
$f->set_attribute (qname => 'f'); |
$f->set_attribute (qname => 'f'); |
999 |
$g->set_attribute (connector => ','); |
$g->set_attribute (connector => ','); |
1004 |
{ |
{ |
1005 |
main => sub { |
main => sub { |
1006 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
1007 |
namespace_uri => $NS_SGML.'element'); |
namespace_uri => SGML_ELEMENT); |
1008 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
1009 |
$n->set_attribute (content => 'mixed'); |
$n->set_attribute (content => 'mixed'); |
1010 |
my $g = $n->append_new_node (type => '#element', |
my $g = $n->append_new_node (type => '#element', |
1011 |
namespace_uri => $NS_SGML.'element', |
namespace_uri => SGML_ELEMENT, |
1012 |
local_name => 'group'); |
local_name => 'group'); |
1013 |
my $e = $g->append_new_node (type => '#element', |
my $e = $g->append_new_node (type => '#element', |
1014 |
namespace_uri => $NS_SGML.'element', |
namespace_uri => SGML_ELEMENT, |
1015 |
local_name => 'element'); |
local_name => 'element'); |
1016 |
$e->set_attribute (qname => 'e'); |
$e->set_attribute (qname => 'e'); |
1017 |
$g->set_attribute (occurence => '+'); # Oops! |
$g->set_attribute (occurence => '+'); # Oops! |
1023 |
{ |
{ |
1024 |
main => sub { |
main => sub { |
1025 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
1026 |
namespace_uri => $NS_SGML.'doctype'); |
namespace_uri => SGML_DOCTYPE); |
1027 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
1028 |
OK $n->outer_xml, |
OK $n->outer_xml, |
1029 |
[q<<!DOCTYPE foo>>, q<<!DOCTYPE foo []>>]; |
[q<<!DOCTYPE foo>>, q<<!DOCTYPE foo []>>]; |
1032 |
{ |
{ |
1033 |
main => sub { |
main => sub { |
1034 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
1035 |
namespace_uri => $NS_SGML.'doctype'); |
namespace_uri => SGML_DOCTYPE); |
1036 |
$n->set_attribute (qname => 'foo:bar'); |
$n->set_attribute (qname => 'foo:bar'); |
1037 |
OK $n->outer_xml, |
OK $n->outer_xml, |
1038 |
[q<<!DOCTYPE foo:bar>>, q<<!DOCTYPE foo:bar []>>]; |
[q<<!DOCTYPE foo:bar>>, q<<!DOCTYPE foo:bar []>>]; |
1041 |
{ |
{ |
1042 |
main => sub { |
main => sub { |
1043 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
1044 |
namespace_uri => $NS_SGML.'doctype'); |
namespace_uri => SGML_DOCTYPE); |
1045 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
1046 |
$n->append_new_node (type => '#comment'); |
$n->append_new_node (type => '#comment'); |
1047 |
OK $n->outer_xml, |
OK $n->outer_xml, |
1051 |
{ |
{ |
1052 |
main => sub { |
main => sub { |
1053 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
1054 |
namespace_uri => $NS_SGML.'doctype'); |
namespace_uri => SGML_DOCTYPE); |
1055 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
1056 |
$n->set_attribute (SYSTEM => q<http://dtd.example/>); |
$n->set_attribute (SYSTEM => q<http://dtd.example/>); |
1057 |
OK $n->outer_xml, |
OK $n->outer_xml, |
1061 |
{ |
{ |
1062 |
main => sub { |
main => sub { |
1063 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
1064 |
namespace_uri => $NS_SGML.'doctype'); |
namespace_uri => SGML_DOCTYPE); |
1065 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
1066 |
$n->set_attribute (PUBLIC => q<+//IDN dtd.example//DTD ex//EN>); |
$n->set_attribute (PUBLIC => q<+//IDN dtd.example//DTD ex//EN>); |
1067 |
$n->set_attribute (SYSTEM => q<http://dtd.example/>); |
$n->set_attribute (SYSTEM => q<http://dtd.example/>); |
1072 |
{ |
{ |
1073 |
main => sub { |
main => sub { |
1074 |
my $n = $NODEMOD->new (type => '#declaration', |
my $n = $NODEMOD->new (type => '#declaration', |
1075 |
namespace_uri => $NS_SGML.'doctype'); |
namespace_uri => SGML_DOCTYPE); |
1076 |
$n->set_attribute (qname => 'foo'); |
$n->set_attribute (qname => 'foo'); |
1077 |
$n->set_attribute (SYSTEM => q<http://dtd.example/>); |
$n->set_attribute (SYSTEM => q<http://dtd.example/>); |
1078 |
$n->append_new_node (type => '#comment'); |
$n->append_new_node (type => '#comment'); |
1100 |
main => sub { |
main => sub { |
1101 |
my $n = $NODEMOD->new (type => '#document'); |
my $n = $NODEMOD->new (type => '#document'); |
1102 |
my $d = $n->append_new_node (type => '#declaration', |
my $d = $n->append_new_node (type => '#declaration', |
1103 |
namespace_uri => $NS_SGML.'doctype'); |
namespace_uri => SGML_DOCTYPE); |
1104 |
$d->set_attribute (qname => 'foo'); |
$d->set_attribute (qname => 'foo'); |
1105 |
$d->append_new_node (type => '#comment'); |
$d->append_new_node (type => '#comment'); |
1106 |
OK $n->outer_xml, |
OK $n->outer_xml, |
1111 |
main => sub { |
main => sub { |
1112 |
my $n = $NODEMOD->new (type => '#document'); |
my $n = $NODEMOD->new (type => '#document'); |
1113 |
my $d = $n->append_new_node (type => '#declaration', |
my $d = $n->append_new_node (type => '#declaration', |
1114 |
namespace_uri => $NS_SGML.'doctype'); |
namespace_uri => SGML_DOCTYPE); |
1115 |
$d->append_new_node (type => '#comment'); |
$d->append_new_node (type => '#comment'); |
1116 |
$n->append_new_node (type => '#element', |
$n->append_new_node (type => '#element', |
1117 |
namespace_uri => NULL_URI, |
namespace_uri => NULL_URI, |
1198 |
[qq<a=" abc def ">]; |
[qq<a=" abc def ">]; |
1199 |
}, |
}, |
1200 |
}, |
}, |
1201 |
|
|
1202 |
|
{ |
1203 |
|
main => sub { |
1204 |
|
my $n = $NODEMOD->new (type => '#element', |
1205 |
|
local_name => 'ex', |
1206 |
|
namespace_uri => NS_xml_URI); |
1207 |
|
$n->append_new_node (type => '#attribute', |
1208 |
|
local_name => 'lang', |
1209 |
|
namespace_uri => NS_xml_URI, |
1210 |
|
value => 'ja'); |
1211 |
|
OK $n->outer_xml, |
1212 |
|
[qq<<xml:ex xml:lang="ja"></xml:ex>>]; |
1213 |
|
}, |
1214 |
|
}, |
1215 |
); |
); |
1216 |
$tests += @s; |
$tests += @s; |
1217 |
|
|