1495 |
(CharData) { |
(CharData) { |
1496 |
// Character data |
// Character data |
1497 |
lang:Perl ($data => $token.value) { |
lang:Perl ($data => $token.value) { |
1498 |
$node-><M::Node.appendChild> |
$node-><M::Node.manakaiAppendText> (\($data)); |
|
($doc-><M::Document.createTextNode> ($data)); |
|
1499 |
} |
} |
1500 |
} (STAGO) { |
} (STAGO) { |
1501 |
// Start tag or empty element tag |
// Start tag or empty element tag |
1773 |
my $attr = $doc-><M::Document.createAttributeNS> |
my $attr = $doc-><M::Document.createAttributeNS> |
1774 |
(<Q::xmlns:>, 'xmlns'); |
(<Q::xmlns:>, 'xmlns'); |
1775 |
for (@{$attrs->{xmlns}->{nodes}}) { |
for (@{$attrs->{xmlns}->{nodes}}) { |
1776 |
$attr-><M::Node.appendChild> ($_); |
if ($_-><AG::Node.nodeType> == <C::Node.TEXT_NODE>) { |
1777 |
|
$attr-><M::Node.manakaiAppendText> |
1778 |
|
(\($_-><AG::Node.textContent>)); |
1779 |
|
} else { |
1780 |
|
$attr-><M::Node.appendChild> ($_); |
1781 |
|
} |
1782 |
} |
} |
1783 |
if ($attrs->{xmlns}->{def}) { |
if ($attrs->{xmlns}->{def}) { |
1784 |
__CODE{t|setAttrType:: |
__CODE{t|setAttrType:: |
1795 |
my $attr = $doc-><M::Document.createAttributeNS> |
my $attr = $doc-><M::Document.createAttributeNS> |
1796 |
(null, $lname); |
(null, $lname); |
1797 |
for (@{$lattr{$lname}->{nodes}}) { |
for (@{$lattr{$lname}->{nodes}}) { |
1798 |
$attr-><M::Node.appendChild> ($_); |
if ($_-><AG::Node.nodeType> == <C::Node.TEXT_NODE>) { |
1799 |
|
$attr-><M::Node.manakaiAppendText> |
1800 |
|
(\($_-><AG::Node.textContent>)); |
1801 |
|
} else { |
1802 |
|
$attr-><M::Node.appendChild> ($_); |
1803 |
|
} |
1804 |
} |
} |
1805 |
if ($attrs->{$lname}->{def}) { |
if ($attrs->{$lname}->{def}) { |
1806 |
__CODE{t|setAttrType:: |
__CODE{t|setAttrType:: |
1871 |
($ns->{$pfx}, $name); |
($ns->{$pfx}, $name); |
1872 |
} |
} |
1873 |
for (@{$gattr{$pfx}->{$lname}->{nodes}}) { |
for (@{$gattr{$pfx}->{$lname}->{nodes}}) { |
1874 |
$attr-><M::Node.appendChild> ($_); |
if ($_-><AG::Node.nodeType> == <C::Node.TEXT_NODE>) { |
1875 |
|
$attr-><M::Node.manakaiAppendText> |
1876 |
|
(\($_-><AG::Node.textContent>)); |
1877 |
|
} else { |
1878 |
|
$attr-><M::Node.appendChild> ($_); |
1879 |
|
} |
1880 |
} |
} |
1881 |
if ($gattr{$pfx}->{$lname}->{def}) { |
if ($gattr{$pfx}->{$lname}->{def}) { |
1882 |
__CODE{t|setAttrType:: |
__CODE{t|setAttrType:: |
2058 |
|
|
2059 |
~* (CharData) { |
~* (CharData) { |
2060 |
lang:Perl ($data => $token.value) { |
lang:Perl ($data => $token.value) { |
2061 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> (\($data)); |
|
($self->{doc}-><M::Document.createTextNode> ($data)); |
|
2062 |
} |
} |
2063 |
} (STAGO) { |
} (STAGO) { |
2064 |
&Element_ ($doc => $doc, $parent => $parent, $ns => $ns) |
&Element_ ($doc => $doc, $parent => $parent, $ns => $ns) |
2069 |
?lexmode ElementContent; |
?lexmode ElementContent; |
2070 |
} |
} |
2071 |
} (HCRO) { |
} (HCRO) { |
2072 |
&_HexadecimalCharacterReference_ |
&_HexadecimalCharacterReference_ ($parent => $parent); |
|
($doc => $doc, $parent => $parent); |
|
2073 |
|
|
2074 |
~ (REFC) { |
~ (REFC) { |
2075 |
?lexmode 'ElementContent'; |
?lexmode 'ElementContent'; |
2077 |
?lexmode ElementContent; |
?lexmode ElementContent; |
2078 |
} |
} |
2079 |
} (CRO) { |
} (CRO) { |
2080 |
&_NumericCharacterReference_ |
&_NumericCharacterReference_ ($parent => $parent); |
|
($doc => $doc, $parent => $parent); |
|
2081 |
|
|
2082 |
~ (REFC) { |
~ (REFC) { |
2083 |
?lexmode 'ElementContent'; |
?lexmode 'ElementContent'; |
2282 |
~* (STRING) { |
~* (STRING) { |
2283 |
lang:Perl ($value => $token.value) { |
lang:Perl ($value => $token.value) { |
2284 |
$value =~ s/[\x09\x0A\x0D]/ /g; |
$value =~ s/[\x09\x0A\x0D]/ /g; |
2285 |
my $text = $self->{doc}-><M::Document.createTextNode> ($value); |
$parent-><M::Node.manakaiAppendText> (\($value)); |
|
$parent-><M::Node.appendChild> ($text); |
|
2286 |
$vals->{value} .= $value; |
$vals->{value} .= $value; |
2287 |
} |
} |
2288 |
} (HCRO) { |
} (HCRO) { |
2326 |
__CODE{ParseError}__; |
__CODE{ParseError}__; |
2327 |
} |
} |
2328 |
|
|
2329 |
my $text = $self->{doc}-><M::Document.createTextNode> ('<'); |
$parent-><M::Node.manakaiAppendText> ('<'); |
|
$parent-><M::Node.appendChild> ($text); |
|
2330 |
$vals->{value} .= '<'; |
$vals->{value} .= '<'; |
2331 |
} |
} |
2332 |
} |
} |
2361 |
// ~ (MSE) { } |
// ~ (MSE) { } |
2362 |
} // _CDATASection_ |
} // _CDATASection_ |
2363 |
|
|
2364 |
rule _NumericCharacterReference_ ($doc, $parent) { |
rule _NumericCharacterReference_ ($parent) { |
2365 |
?lexmode 'NumericCharacterReference'; |
?lexmode 'NumericCharacterReference'; |
2366 |
|
|
2367 |
~ (NUMBER) { |
~ (NUMBER) { |
2393 |
__CODE{ParseError}__; |
__CODE{ParseError}__; |
2394 |
} |
} |
2395 |
} |
} |
2396 |
my $ncr = $doc-><M::Document.createTextNode> (chr $num); |
$parent-><M::Node.manakaiAppendText> (chr $num); |
|
$parent-><M::Node.appendChild> ($ncr); |
|
2397 |
} |
} |
2398 |
} |
} |
2399 |
|
|
2477 |
__CODE{ParseError}__; |
__CODE{ParseError}__; |
2478 |
} |
} |
2479 |
} |
} |
2480 |
my $ncr = $self->{doc}-><M::Document.createTextNode> |
my $char = chr $num; |
2481 |
(my $char = chr $num); |
$parent-><M::Node.manakaiAppendText> (\$char); |
|
$parent-><M::Node.appendChild> ($ncr); |
|
2482 |
$vals->{value} .= $char; |
$vals->{value} .= $char; |
2483 |
} |
} |
2484 |
} |
} |
2525 |
// ~ (REFC) { } |
// ~ (REFC) { } |
2526 |
} // _NumericCharacterReferenceEV_ |
} // _NumericCharacterReferenceEV_ |
2527 |
|
|
2528 |
rule _HexadecimalCharacterReference_ ($doc, $parent) { |
rule _HexadecimalCharacterReference_ ($parent) { |
2529 |
?lexmode 'HexadecimalCharacterReference'; |
?lexmode 'HexadecimalCharacterReference'; |
2530 |
|
|
2531 |
~ (Hex) { |
~ (Hex) { |
2557 |
__CODE{ParseError}__; |
__CODE{ParseError}__; |
2558 |
} |
} |
2559 |
} |
} |
2560 |
my $ncr = $doc-><M::Document.createTextNode> |
$parent-><M::Node.manakaiAppendText> (chr $num); |
|
(chr $num); |
|
|
$parent-><M::Node.appendChild> ($ncr); |
|
2561 |
} |
} |
2562 |
} |
} |
2563 |
|
|
2641 |
__CODE{ParseError}__; |
__CODE{ParseError}__; |
2642 |
} |
} |
2643 |
} |
} |
2644 |
my $ncr = $self->{doc}-><M::Document.createTextNode> |
my $char = chr $num; |
2645 |
(my $char = chr $num); |
$parent-><M::Node.manakaiAppendText> (\$char); |
|
$parent-><M::Node.appendChild> ($ncr); |
|
2646 |
$vals->{value} .= $char; |
$vals->{value} .= $char; |
2647 |
} |
} |
2648 |
} |
} |
2698 |
|
|
2699 |
~ (Name == 'lt') { |
~ (Name == 'lt') { |
2700 |
lang:Perl { |
lang:Perl { |
2701 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> ('<'); |
|
($self->{doc}-><M::Document.createTextNode> ('<')); |
|
2702 |
} |
} |
2703 |
} (Name == 'gt') { |
} (Name == 'gt') { |
2704 |
lang:Perl { |
lang:Perl { |
2705 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> ('>'); |
|
($self->{doc}-><M::Document.createTextNode> ('>')); |
|
2706 |
} |
} |
2707 |
} (Name == 'amp') { |
} (Name == 'amp') { |
2708 |
lang:Perl { |
lang:Perl { |
2709 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> ('&'); |
|
($self->{doc}-><M::Document.createTextNode> ('&')); |
|
2710 |
} |
} |
2711 |
} (Name == 'quot') { |
} (Name == 'quot') { |
2712 |
lang:Perl { |
lang:Perl { |
2713 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> ('"'); |
|
($self->{doc}-><M::Document.createTextNode> ('"')); |
|
2714 |
} |
} |
2715 |
} (Name == 'apos') { |
} (Name == 'apos') { |
2716 |
lang:Perl { |
lang:Perl { |
2717 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> ("'"); |
|
($self->{doc}-><M::Document.createTextNode> ("'")); |
|
2718 |
} |
} |
2719 |
} (Name) { |
} (Name) { |
2720 |
my $er; |
my $er; |
3016 |
|
|
3017 |
~ (Name == 'lt') { |
~ (Name == 'lt') { |
3018 |
lang:Perl { |
lang:Perl { |
3019 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> ('<'); |
|
($self->{doc}-><M::Document.createTextNode> ('<')); |
|
3020 |
$vals->{value} .= '<'; |
$vals->{value} .= '<'; |
3021 |
} |
} |
3022 |
} (Name == 'gt') { |
} (Name == 'gt') { |
3023 |
lang:Perl { |
lang:Perl { |
3024 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> ('>'); |
|
($self->{doc}-><M::Document.createTextNode> ('>')); |
|
3025 |
$vals->{value} .= '>'; |
$vals->{value} .= '>'; |
3026 |
} |
} |
3027 |
} (Name == 'amp') { |
} (Name == 'amp') { |
3028 |
lang:Perl { |
lang:Perl { |
3029 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> ('&'); |
|
($self->{doc}-><M::Document.createTextNode> ('&')); |
|
3030 |
$vals->{value} .= '&'; |
$vals->{value} .= '&'; |
3031 |
} |
} |
3032 |
} (Name == 'quot') { |
} (Name == 'quot') { |
3033 |
lang:Perl { |
lang:Perl { |
3034 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> ('"'); |
|
($self->{doc}-><M::Document.createTextNode> ('"')); |
|
3035 |
$vals->{value} .= '"'; |
$vals->{value} .= '"'; |
3036 |
} |
} |
3037 |
} (Name == 'apos') { |
} (Name == 'apos') { |
3038 |
lang:Perl { |
lang:Perl { |
3039 |
$parent-><M::Node.appendChild> |
$parent-><M::Node.manakaiAppendText> ("'"); |
|
($self->{doc}-><M::Document.createTextNode> ("'")); |
|
3040 |
$vals->{value} .= "'"; |
$vals->{value} .= "'"; |
3041 |
} |
} |
3042 |
} (Name) { |
} (Name) { |
9324 |
document { |
document { |
9325 |
element { |
element { |
9326 |
text-content: 'aaaa!bbbb'; |
text-content: 'aaaa!bbbb'; |
9327 |
|
text { |
9328 |
|
text-content: 'aaaa!bbbb'; |
9329 |
|
} |
9330 |
} |
} |
9331 |
} |
} |
9332 |
@@XMLTest: |
@@XMLTest: |
9354 |
attribute { |
attribute { |
9355 |
node-name: 'a'; |
node-name: 'a'; |
9356 |
text-content: 'aaaaa!bbbbb'; |
text-content: 'aaaaa!bbbbb'; |
9357 |
|
text { |
9358 |
|
text-content: 'aaaaa!bbbbb'; |
9359 |
|
} |
9360 |
} |
} |
9361 |
} |
} |
9362 |
} |
} |
9505 |
node-name: 'ent'; |
node-name: 'ent'; |
9506 |
text-content: 'aa!bb'; |
text-content: 'aa!bb'; |
9507 |
is-expanded: true; |
is-expanded: true; |
9508 |
|
text { |
9509 |
|
text-content: 'aa!bb'; |
9510 |
|
} |
9511 |
} |
} |
9512 |
is-expanded: true; |
is-expanded: true; |
9513 |
} |
} |
9553 |
node-name: 'ent'; |
node-name: 'ent'; |
9554 |
text-content: 'aaaaa!bbbbb'; |
text-content: 'aaaaa!bbbbb'; |
9555 |
is-expanded: true; |
is-expanded: true; |
9556 |
|
text { |
9557 |
|
text-content: 'aaaaa!bbbbb'; |
9558 |
|
} |
9559 |
} |
} |
9560 |
} |
} |
9561 |
} |
} |
9635 |
document { |
document { |
9636 |
element { |
element { |
9637 |
text-content: 'aaaa!bbbb'; |
text-content: 'aaaa!bbbb'; |
9638 |
|
text { |
9639 |
|
text-content: 'aaaa!bbbb'; |
9640 |
|
} |
9641 |
} |
} |
9642 |
} |
} |
9643 |
@@XMLTest: |
@@XMLTest: |
9665 |
attribute { |
attribute { |
9666 |
node-name: 'a'; |
node-name: 'a'; |
9667 |
text-content: 'aaaaa!bbbbb'; |
text-content: 'aaaaa!bbbbb'; |
9668 |
|
text { |
9669 |
|
text-content: 'aaaaa!bbbbb'; |
9670 |
|
} |
9671 |
} |
} |
9672 |
} |
} |
9673 |
} |
} |
9731 |
general-entity { |
general-entity { |
9732 |
node-name: 'ent'; |
node-name: 'ent'; |
9733 |
text-content: 'aaaaa!bbbbb'; |
text-content: 'aaaaa!bbbbb'; |
9734 |
|
text { |
9735 |
|
text-content: 'aaaaa!bbbbb'; |
9736 |
|
} |
9737 |
} |
} |
9738 |
} |
} |
9739 |
element { } |
element { } |
9864 |
node-name: 'ent'; |
node-name: 'ent'; |
9865 |
is-expanded: true; |
is-expanded: true; |
9866 |
text-content: 'aaaaa!bbbbb'; |
text-content: 'aaaaa!bbbbb'; |
9867 |
|
text { |
9868 |
|
text-content: 'aaaaa!bbbbb'; |
9869 |
|
} |
9870 |
} |
} |
9871 |
} |
} |
9872 |
} |
} |
15035 |
system_id => $doc_ent->{<Q::test:uri>}, |
system_id => $doc_ent->{<Q::test:uri>}, |
15036 |
base_uri => $doc_ent->{<Q::test:baseURI>}}; |
base_uri => $doc_ent->{<Q::test:baseURI>}}; |
15037 |
if ($test_data->{dom_tree}) { # Successful test |
if ($test_data->{dom_tree}) { # Successful test |
15038 |
|
my $doc; |
15039 |
try { |
try { |
15040 |
my $doc = $parser->parse ($input); |
$doc = $parser->parse ($input); |
15041 |
$test->assert_dom_tree_equals |
$test->assert_dom_tree_equals |
15042 |
(actual_value => $doc, |
(actual_value => $doc, |
15043 |
expected_hash => $test_data->{dom_tree}); |
expected_hash => $test_data->{dom_tree}); |
15050 |
} |
} |
15051 |
} |
} |
15052 |
$not_ok ? $test->not_ok : $test->ok; |
$not_ok ? $test->not_ok : $test->ok; |
15053 |
|
undef $doc; |
15054 |
} catch Message::Util::IF::DTException with { |
} catch Message::Util::IF::DTException with { |
15055 |
# |
require 'manakai/mndebug.pl'; |
15056 |
|
manakai::mndebug::dump ($doc); |
15057 |
} catch Message::DOM::IF::LSException with { |
} catch Message::DOM::IF::LSException with { |
15058 |
# not_ok |
# not_ok |
15059 |
} otherwise { |
} otherwise { |
15062 |
$test->not_ok; |
$test->not_ok; |
15063 |
}; |
}; |
15064 |
} else { |
} else { |
15065 |
|
my $doc; |
15066 |
try { |
try { |
15067 |
my $doc = $parser->parse ($input); |
$doc = $parser->parse ($input); |
15068 |
} catch Message::Util::IF::DTException with { |
} catch Message::Util::IF::DTException with { |
15069 |
# |
require 'manakai/mndebug.pl'; |
15070 |
|
manakai::mndebug::dump ($doc); |
15071 |
} catch Message::DOM::IF::LSException with { |
} catch Message::DOM::IF::LSException with { |
15072 |
# |
# |
15073 |
} otherwise { |
} otherwise { |