25 |
Namespace: |
Namespace: |
26 |
@c: |
@c: |
27 |
http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core# |
http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core# |
28 |
|
@cfg: |
29 |
|
http://suika.fam.cx/www/2006/dom-config/ |
30 |
@d: |
@d: |
31 |
http://suika.fam.cx/~wakaba/archive/2004/dom/xdt# |
http://suika.fam.cx/~wakaba/archive/2004/dom/xdt# |
32 |
@dis: |
@dis: |
39 |
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/Core/ |
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/Core/ |
40 |
@f: |
@f: |
41 |
http://suika.fam.cx/~wakaba/archive/2004/dom/feature# |
http://suika.fam.cx/~wakaba/archive/2004/dom/feature# |
42 |
|
@fe: |
43 |
|
http://suika.fam.cx/www/2006/feature/ |
44 |
|
@gls: |
45 |
|
http://suika.fam.cx/~wakaba/archive/2004/dom/gls# |
46 |
@idl: |
@idl: |
47 |
http://suika.fam.cx/~wakaba/archive/2004/dis/IDL# |
http://suika.fam.cx/~wakaba/archive/2004/dis/IDL# |
48 |
@infoset: |
@infoset: |
61 |
http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM. |
http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM. |
62 |
@MDOMX: |
@MDOMX: |
63 |
http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception# |
http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception# |
64 |
|
@mn: |
65 |
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/ManakaiNode# |
66 |
@rdf: |
@rdf: |
67 |
http://www.w3.org/1999/02/22-rdf-syntax-ns# |
http://www.w3.org/1999/02/22-rdf-syntax-ns# |
68 |
@rdfs: |
@rdfs: |
201 |
@@@: DOMLS|LSFeature30 |
@@@: DOMLS|LSFeature30 |
202 |
@@For: ManakaiDOM|DOM3 |
@@For: ManakaiDOM|DOM3 |
203 |
|
|
204 |
@DISLang:role: DOMLS|ParserRole |
@DISLang:role: gls|ParserRole |
205 |
|
|
206 |
@enDesc: |
@enDesc: |
207 |
Note that the <Class::ManakaiXMLParser> reports any XML errors |
Note that the <Class::ManakaiXMLParser> reports any XML errors |
243 |
Creates a new instance of the object. |
Creates a new instance of the object. |
244 |
@@Param: |
@@Param: |
245 |
@@@Name: impl |
@@@Name: impl |
246 |
@@@Type: DOMLS|GLSImplementation |
@@@Type: gls|GLSImplementation |
247 |
@@@enDesc: |
@@@enDesc: |
248 |
The implementation from which the parser is created. |
The implementation from which the parser is created. |
249 |
@@Param: |
@@Param: |
286 |
$self->{entity_token} = []; |
$self->{entity_token} = []; |
287 |
$self->{xml_version} = '1.0'; |
$self->{xml_version} = '1.0'; |
288 |
$self->{standalone} = false; |
$self->{standalone} = false; |
289 |
$self->{general_entity} = {}; |
$self->{general_entity} = { |
290 |
|
lt => {is_predefined => true}, |
291 |
|
gt => {is_predefined => true}, |
292 |
|
amp => {is_predefined => true}, |
293 |
|
quot => {is_predefined => true}, |
294 |
|
apos => {is_predefined => true}, |
295 |
|
}; |
296 |
$self->{param_entity} = {}; |
$self->{param_entity} = {}; |
297 |
$self->{attr} = {}; |
$self->{attr} = {}; |
298 |
# $self->{attr}->{$element_type_name}->{$attr_name} = $attr_def |
# $self->{attr}->{$element_type_name}->{$attr_name} = $attr_def |
300 |
## Well-formedness constraint Entity Declared takes effect? |
## Well-formedness constraint Entity Declared takes effect? |
301 |
|
|
302 |
__DEEP{ |
__DEEP{ |
303 |
$r = $self->_parse_DocumentEntity |
$r = $self->{<H::c|implementation>}-><M::DOMImpl.createDocument>; |
304 |
($self->{<H::DOMCore:implementation>}); |
$r-><AS::Document.strictErrorChecking> (false); |
305 |
|
$self->{doc} = $r; |
306 |
|
CORE::delete $self->{docx}; |
307 |
|
CORE::delete $self->{dtdef}; |
308 |
|
$self->{cfg} = $r-><AG::Document.domConfig>; |
309 |
|
local $r->{<H::mn:node>} |
310 |
|
->{<H::cfg|entity-reference-read-only>} = false; |
311 |
|
|
312 |
|
## Document entity -> |Document| node |
313 |
|
$self->_parse_DocumentEntity; |
314 |
|
|
315 |
|
## Replacement tree for general |Entity| nodes |
316 |
|
my @ent = values %{$self->{general_entities}}; |
317 |
|
if (@ent) { |
318 |
|
for my $ent (@ent) { |
319 |
|
if (exists $ent->{reptxt}) { |
320 |
|
my $ent_name = $ent->{name}; |
321 |
|
$self->{entity} = [<Code::getCopyOfEntityState:: |
322 |
|
$entity_type = 'general_entity', |
323 |
|
$entity_name = $ent_name>]; |
324 |
|
$self->{token} = []; |
325 |
|
$self->{char} = []; |
326 |
|
## TODO: External entity support |
327 |
|
$self->_parse_InternalGeneralParsedEntity ($ent->{node}); |
328 |
|
$ent->{node}-><AS::x|Entity.hasReplacementTree> (true); |
329 |
|
} |
330 |
|
## TODO: Read-only if configuration (for all entities) |
331 |
|
} |
332 |
|
} |
333 |
|
|
334 |
|
$r-><AS::Document.strictErrorChecking> (true); |
335 |
}__; |
}__; |
336 |
|
|
337 |
@Method: |
@Method: |
468 |
document := prolog element *Misc |
document := prolog element *Misc |
469 |
- *Char RestrictedChar *Char ;; [1] |
- *Char RestrictedChar *Char ;; [1] |
470 |
*/ |
*/ |
471 |
rule DocumentEntity ($impl) : standalone { |
rule DocumentEntity : standalone { |
|
my $doc : return; |
|
|
|
|
|
lang:Perl { |
|
|
$doc = $impl-><M::DOMImpl.createDocument>; |
|
|
$doc-><AS::Document.strictErrorChecking> (false); |
|
|
} |
|
|
|
|
472 |
/* |
/* |
473 |
prolog := XMLDecl? *Misc [doctypedecl *Misc] ;; [22] |
prolog := XMLDecl? *Misc [doctypedecl *Misc] ;; [22] |
474 |
*/ |
*/ |
475 |
?lexmode 'DocumentStart'; |
?lexmode 'DocumentStart'; |
476 |
|
|
477 |
|
my $doc; |
478 |
|
lang:Perl { |
479 |
|
$doc = $self->{doc}; |
480 |
|
} |
481 |
|
|
482 |
~? (XDO) { |
~? (XDO) { |
483 |
&_XMLDeclaration_ ($doc => $doc); |
&_XMLDeclaration_ ($doc => $doc); |
589 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__EXCEPTION{DOMLS|PARSE_ERR:: |
590 |
}__; |
}__; |
591 |
} |
} |
|
|
|
|
$doc-><AS::Document.strictErrorChecking> (true); |
|
592 |
} |
} |
593 |
} // DocumentEntity |
} // DocumentEntity |
594 |
|
|
595 |
|
/* |
596 |
|
Internal General Parsed Entity |
597 |
|
|
598 |
|
An internal general parsed entity is well-formed if its |
599 |
|
replacement text matches the production labeled |content|. |
600 |
|
*/ |
601 |
|
rule InternalGeneralParsedEntity ($ent) : standalone { |
602 |
|
?lexmode ElementContent; |
603 |
|
|
604 |
|
my $ns; |
605 |
|
lang:Perl { |
606 |
|
$ns = { |
607 |
|
xml => <Q::xml:>, |
608 |
|
xmlns => <Q::xmlns:>, |
609 |
|
}; |
610 |
|
} |
611 |
|
|
612 |
|
&content ($parent => $ent, $ns => $ns); |
613 |
|
|
614 |
|
~ (#EOF) { } |
615 |
|
} // InternalGeneralParsedEntity |
616 |
|
|
617 |
/* |
/* |
618 |
XML Declaration |
XML Declaration |
619 |
|
|
1374 |
|
|
1375 |
~ (#NONE) { } |
~ (#NONE) { } |
1376 |
} // Element_ |
} // Element_ |
1377 |
|
|
1378 |
|
/* |
1379 |
|
content := [CharData] |
1380 |
|
*((element / Reference / CDSect / PI / Comment) [CharData]) |
1381 |
|
*/ |
1382 |
|
rule content ($parent, $ns) { |
1383 |
|
// ?lexmode ElementContent; |
1384 |
|
|
1385 |
|
my $doc; |
1386 |
|
lang:Perl { |
1387 |
|
$doc = $self->{doc}; |
1388 |
|
} |
1389 |
|
|
1390 |
|
~* (CharData) { |
1391 |
|
lang:Perl ($data => $token.value) { |
1392 |
|
$parent-><M::Node.appendChild> |
1393 |
|
($self->{doc}-><M::Document.createTextNode> ($data)); |
1394 |
|
} |
1395 |
|
} (STAGO) { |
1396 |
|
&Element_ ($doc => $doc, $parent => $parent, $ns => $ns) |
1397 |
|
: unshift-current-token; |
1398 |
|
~ (TAGC) { |
1399 |
|
?lexmode ElementContent; |
1400 |
|
} else { |
1401 |
|
?lexmode ElementContent; |
1402 |
|
} |
1403 |
|
} (HCRO) { |
1404 |
|
&_HexadecimalCharacterReference_ |
1405 |
|
($doc => $doc, $parent => $parent); |
1406 |
|
|
1407 |
|
~ (REFC) { |
1408 |
|
?lexmode 'ElementContent'; |
1409 |
|
} else { |
1410 |
|
?lexmode ElementContent; |
1411 |
|
} |
1412 |
|
} (CRO) { |
1413 |
|
&_NumericCharacterReference_ |
1414 |
|
($doc => $doc, $parent => $parent); |
1415 |
|
|
1416 |
|
~ (REFC) { |
1417 |
|
?lexmode 'ElementContent'; |
1418 |
|
} else { |
1419 |
|
?lexmode ElementContent; |
1420 |
|
} |
1421 |
|
} (ERO) { |
1422 |
|
&_GeneralEntityReferenceEC |
1423 |
|
($doc => $doc, $parent => $parent, $ns => $ns); |
1424 |
|
} (CDO) { |
1425 |
|
&_CommentDeclaration_ ($doc => $doc, $parent => $parent); |
1426 |
|
|
1427 |
|
~ (MDC) { |
1428 |
|
?lexmode ElementContent; |
1429 |
|
} else { |
1430 |
|
?lexmode ElementContent; |
1431 |
|
} |
1432 |
|
} (CDSO) { |
1433 |
|
&_CDATASection_ ($doc => $doc, $parent => $parent); |
1434 |
|
|
1435 |
|
~ (MSE) { |
1436 |
|
?lexmode 'ElementContent'; |
1437 |
|
} else { |
1438 |
|
?lexmode ElementContent; |
1439 |
|
} |
1440 |
|
} (PIO) { |
1441 |
|
&_ProcessingInstruction_ ($doc => $doc, $parent => $parent); |
1442 |
|
|
1443 |
|
~ (PIC) { |
1444 |
|
?lexmode 'ElementContent'; |
1445 |
|
} else { |
1446 |
|
?lexmode ElementContent; |
1447 |
|
} |
1448 |
|
} |
1449 |
|
} // content |
1450 |
|
|
1451 |
rule AttributeSpecificationList ($doc, $attrs) |
rule AttributeSpecificationList ($doc, $attrs) |
1452 |
: standalone |
: standalone |
1605 |
} // _AttributeValueSpecificationA_ |
} // _AttributeValueSpecificationA_ |
1606 |
|
|
1607 |
/* |
/* |
1608 |
|
Parsing replacement text of an entity referenced in |
1609 |
|
an attribute value specification. |
1610 |
|
*/ |
1611 |
|
rule AttributeValueLiteralE_ ($parent, $vals) |
1612 |
|
: recursive |
1613 |
|
{ |
1614 |
|
// ?lexmode AttributeValueLiteralE; |
1615 |
|
|
1616 |
|
~* (STRING) { |
1617 |
|
lang:Perl ($value => $token.value) { |
1618 |
|
$value =~ s/[\x09\x0A\x0D]/ /g; |
1619 |
|
my $text = $self->{doc}-><M::Document.createTextNode> ($value); |
1620 |
|
$parent-><M::Node.appendChild> ($text); |
1621 |
|
$vals->{value} .= $value; |
1622 |
|
} |
1623 |
|
} (HCRO) { |
1624 |
|
&_HexadecimalCharacterReferenceAE_ |
1625 |
|
($parent => $parent, $vals => $vals); |
1626 |
|
|
1627 |
|
~ (REFC) { |
1628 |
|
?lexmode AttributeValueLiteralE; |
1629 |
|
} else { |
1630 |
|
?lexmode AttributeValueLiteralE; |
1631 |
|
} |
1632 |
|
} (CRO) { |
1633 |
|
&_NumericCharacterReferenceAE_ |
1634 |
|
($parent => $parent, $vals => $vals); |
1635 |
|
|
1636 |
|
~ (REFC) { |
1637 |
|
?lexmode AttributeValueLiteralE; |
1638 |
|
} else { |
1639 |
|
?lexmode AttributeValueLiteralE; |
1640 |
|
} |
1641 |
|
} (ERO) { |
1642 |
|
&_GeneralEntityReferenceAE_ ($parent => $parent, $vals => $vals); |
1643 |
|
|
1644 |
|
~ (REFC) { |
1645 |
|
?lexmode AttributeValueLiteralE; |
1646 |
|
} else { |
1647 |
|
?lexmode AttributeValueLiteralE; |
1648 |
|
} |
1649 |
|
} |
1650 |
|
|
1651 |
|
// ~ (#EOF) { } |
1652 |
|
} // AttributeValueLiteralE_ |
1653 |
|
|
1654 |
|
/* |
1655 |
CDATA Section Content Parsing Mode |
CDATA Section Content Parsing Mode |
1656 |
*/ |
*/ |
1657 |
rule _CDATASection_ ($doc, $parent) { |
rule _CDATASection_ ($doc, $parent) { |
1761 |
// ~ (REFC) { } |
// ~ (REFC) { } |
1762 |
} // _NumericCharacterReferenceV_ |
} // _NumericCharacterReferenceV_ |
1763 |
|
|
1764 |
|
/* |
1765 |
|
Numeric character reference in the replacement text |
1766 |
|
of the entity referenced in an attribute value specification |
1767 |
|
*/ |
1768 |
|
rule _NumericCharacterReferenceAE_ ($parent, $vals) |
1769 |
|
{ |
1770 |
|
?lexmode NumericCharacterReference; |
1771 |
|
|
1772 |
|
~ (NUMBER) { |
1773 |
|
lang:Perl ($num => $token.value) : has-error { |
1774 |
|
$num += 0; |
1775 |
|
unless ( |
1776 |
|
($self->{xml_version} eq '1.0' and |
1777 |
|
((0x0020 <= $num and $num <= 0xD7FF) or |
1778 |
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1779 |
|
(0x10000 <= $num and $num <= 0x10FFFF) or |
1780 |
|
$num == 0x9 or $num == 0xA or $num == 0xD)) or |
1781 |
|
($self->{xml_version} eq '1.1' and |
1782 |
|
((0x0001 <= $num and $num <= 0xD7FF) or |
1783 |
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1784 |
|
(0x10000 <= $num and $num <= 0x10FFFF))) |
1785 |
|
) { |
1786 |
|
my $location; |
1787 |
|
__CODE{xp|get-location-from-token:: |
1788 |
|
$token => $token, |
1789 |
|
$result => $location, |
1790 |
|
}__; |
1791 |
|
my $continue = __DOMCore:ERROR{xp|wf-legal-character:: |
1792 |
|
DOMCore:location => {$location}, |
1793 |
|
xp|token => {$token}, |
1794 |
|
xp|character-number => {$num}, |
1795 |
|
}__; |
1796 |
|
unless ($continue) { |
1797 |
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
1798 |
|
} |
1799 |
|
$self->{has_error} = true; |
1800 |
|
} |
1801 |
|
my $ncr = $self->{doc}-><M::Document.createTextNode> |
1802 |
|
(my $char = chr $num); |
1803 |
|
$parent-><M::Node.appendChild> ($ncr); |
1804 |
|
$vals->{value} .= $char; |
1805 |
|
} |
1806 |
|
} |
1807 |
|
|
1808 |
|
// ~ (REFC) { } |
1809 |
|
} // _NumericCharacterReferenceAE_ |
1810 |
|
|
1811 |
|
rule _NumericCharacterReferenceEV_ ($vals) |
1812 |
|
{ |
1813 |
|
?lexmode 'NumericCharacterReference'; |
1814 |
|
|
1815 |
|
~ (NUMBER) { |
1816 |
|
lang:Perl ($num => $token.value) : has-error { |
1817 |
|
$num += 0; |
1818 |
|
unless ( |
1819 |
|
($self->{xml_version} eq '1.0' and |
1820 |
|
((0x0020 <= $num and $num <= 0xD7FF) or |
1821 |
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1822 |
|
(0x10000 <= $num and $num <= 0x10FFFF) or |
1823 |
|
$num == 0x9 or $num == 0xA or $num == 0xD)) or |
1824 |
|
($self->{xml_version} eq '1.1' and |
1825 |
|
((0x0001 <= $num and $num <= 0xD7FF) or |
1826 |
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1827 |
|
(0x10000 <= $num and $num <= 0x10FFFF))) |
1828 |
|
) { |
1829 |
|
my $location; |
1830 |
|
__CODE{xp|get-location-from-token:: |
1831 |
|
$token => $token, |
1832 |
|
$result => $location, |
1833 |
|
}__; |
1834 |
|
my $continue = __DOMCore:ERROR{xp|wf-legal-character:: |
1835 |
|
DOMCore:location => {$location}, |
1836 |
|
xp|token => {$token}, |
1837 |
|
xp|character-number => {$num}, |
1838 |
|
}__; |
1839 |
|
unless ($continue) { |
1840 |
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
1841 |
|
} |
1842 |
|
$self->{has_error} = true; |
1843 |
|
} |
1844 |
|
push @{$vals}, chr $num; |
1845 |
|
} |
1846 |
|
} |
1847 |
|
|
1848 |
|
// ~ (REFC) { } |
1849 |
|
} // _NumericCharacterReferenceEV_ |
1850 |
|
|
1851 |
rule _HexadecimalCharacterReference_ ($doc, $parent) { |
rule _HexadecimalCharacterReference_ ($doc, $parent) { |
1852 |
?lexmode 'HexadecimalCharacterReference'; |
?lexmode 'HexadecimalCharacterReference'; |
1853 |
|
|
1933 |
} // _HexadecimalCharacterReferenceV_ |
} // _HexadecimalCharacterReferenceV_ |
1934 |
|
|
1935 |
/* |
/* |
1936 |
|
Hexadecimal character reference in the replacement text |
1937 |
|
of the entity referenced in an attribute value literal |
1938 |
|
*/ |
1939 |
|
rule _HexadecimalCharacterReferenceAE_ ($parent, $vals) |
1940 |
|
{ |
1941 |
|
?lexmode HexadecimalCharacterReference; |
1942 |
|
|
1943 |
|
~ (Hex) { |
1944 |
|
lang:Perl ($v => $token.value) : has-error { |
1945 |
|
my $num = hex $v; |
1946 |
|
unless ( |
1947 |
|
($self->{xml_version} eq '1.0' and |
1948 |
|
((0x0020 <= $num and $num <= 0xD7FF) or |
1949 |
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1950 |
|
(0x10000 <= $num and $num <= 0x10FFFF) or |
1951 |
|
$num == 0x9 or $num == 0xA or $num == 0xD)) or |
1952 |
|
($self->{xml_version} eq '1.1' and |
1953 |
|
((0x0001 <= $num and $num <= 0xD7FF) or |
1954 |
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1955 |
|
(0x10000 <= $num and $num <= 0x10FFFF))) |
1956 |
|
) { |
1957 |
|
my $location; |
1958 |
|
__CODE{xp|get-location-from-token:: |
1959 |
|
$token => $token, |
1960 |
|
$result => $location, |
1961 |
|
}__; |
1962 |
|
my $continue = __DOMCore:ERROR{xp|wf-legal-character:: |
1963 |
|
DOMCore:location => {$location}, |
1964 |
|
xp|token => {$token}, |
1965 |
|
xp|character-number => {$num}, |
1966 |
|
}__; |
1967 |
|
unless ($continue) { |
1968 |
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
1969 |
|
} |
1970 |
|
$self->{has_error} = true; |
1971 |
|
} |
1972 |
|
my $ncr = $self->{doc}-><M::Document.createTextNode> |
1973 |
|
(my $char = chr $num); |
1974 |
|
$parent-><M::Node.appendChild> ($ncr); |
1975 |
|
$vals->{value} .= $char; |
1976 |
|
} |
1977 |
|
} |
1978 |
|
|
1979 |
|
// ~ (REFC) { } |
1980 |
|
} // _HexadecimalCharacterReferenceAE_ |
1981 |
|
|
1982 |
|
rule _HexadecimalCharacterReferenceEV_ ($vals) { |
1983 |
|
?lexmode HexadecimalCharacterReference; |
1984 |
|
|
1985 |
|
~ (Hex) { |
1986 |
|
lang:Perl ($v => $token.value) : has-error { |
1987 |
|
my $num = hex $v; |
1988 |
|
unless ( |
1989 |
|
($self->{xml_version} eq '1.0' and |
1990 |
|
((0x0020 <= $num and $num <= 0xD7FF) or |
1991 |
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1992 |
|
(0x10000 <= $num and $num <= 0x10FFFF) or |
1993 |
|
$num == 0x9 or $num == 0xA or $num == 0xD)) or |
1994 |
|
($self->{xml_version} eq '1.1' and |
1995 |
|
((0x0001 <= $num and $num <= 0xD7FF) or |
1996 |
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1997 |
|
(0x10000 <= $num and $num <= 0x10FFFF))) |
1998 |
|
) { |
1999 |
|
my $location; |
2000 |
|
__CODE{xp|get-location-from-token:: |
2001 |
|
$token => $token, |
2002 |
|
$result => $location, |
2003 |
|
}__; |
2004 |
|
my $continue = __DOMCore:ERROR{xp|wf-legal-character:: |
2005 |
|
DOMCore:location => {$location}, |
2006 |
|
xp|token => {$token}, |
2007 |
|
xp|character-number => {$num}, |
2008 |
|
}__; |
2009 |
|
unless ($continue) { |
2010 |
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
2011 |
|
} |
2012 |
|
$self->{has_error} = true; |
2013 |
|
} |
2014 |
|
push @{$vals}, chr $num; |
2015 |
|
} |
2016 |
|
} |
2017 |
|
|
2018 |
|
// ~ (REFC) { } |
2019 |
|
} // _HexadecimalCharacterReferenceEV_ |
2020 |
|
|
2021 |
|
/* |
2022 |
General entity reference in element's content |
General entity reference in element's content |
2023 |
*/ |
*/ |
2024 |
rule _GeneralEntityReferenceEC ($doc, $parent, $ns) |
rule _GeneralEntityReferenceEC ($doc, $parent, $ns) |
2026 |
{ |
{ |
2027 |
?lexmode 'EntityReference'; |
?lexmode 'EntityReference'; |
2028 |
|
|
2029 |
~ (Name) { |
~ (Name == 'lt') { |
2030 |
|
lang:Perl { |
2031 |
|
$parent-><M::Node.appendChild> |
2032 |
|
($self->{doc}-><M::Document.createTextNode> ('<')); |
2033 |
|
} |
2034 |
|
} (Name == 'gt') { |
2035 |
|
lang:Perl { |
2036 |
|
$parent-><M::Node.appendChild> |
2037 |
|
($self->{doc}-><M::Document.createTextNode> ('>')); |
2038 |
|
} |
2039 |
|
} (Name == 'amp') { |
2040 |
|
lang:Perl { |
2041 |
|
$parent-><M::Node.appendChild> |
2042 |
|
($self->{doc}-><M::Document.createTextNode> ('&')); |
2043 |
|
} |
2044 |
|
} (Name == 'quot') { |
2045 |
|
lang:Perl { |
2046 |
|
$parent-><M::Node.appendChild> |
2047 |
|
($self->{doc}-><M::Document.createTextNode> ('"')); |
2048 |
|
} |
2049 |
|
} (Name == 'apos') { |
2050 |
|
lang:Perl { |
2051 |
|
$parent-><M::Node.appendChild> |
2052 |
|
($self->{doc}-><M::Document.createTextNode> ("'")); |
2053 |
|
} |
2054 |
|
} (Name) { |
2055 |
my $er; |
my $er; |
2056 |
lang:Perl ($name => $token.value) { |
lang:Perl ($name => $token.value) { |
2057 |
## TODO: Namespace well-formedness |
## TODO: Namespace well-formedness |
2069 |
} |
} |
2070 |
|
|
2071 |
?lexmode ElementContent; |
?lexmode ElementContent; |
2072 |
~* (CharData) { |
&content ($doc => $doc, $parent => $er, $ns => $ns); |
|
lang:Perl ($data => $token.value) { |
|
|
$er-><M::Node.appendChild> |
|
|
($doc-><M::Document.createTextNode> ($data)); |
|
|
} |
|
|
} (STAGO) { |
|
|
&Element_ ($doc => $doc, $parent => $er, $ns => $ns) |
|
|
: unshift-current-token; |
|
|
~ (TAGC) { |
|
|
?lexmode ElementContent; |
|
|
} else { |
|
|
?lexmode ElementContent; |
|
|
} |
|
|
} (HCRO) { |
|
|
&_HexadecimalCharacterReference_ |
|
|
($doc => $doc, $parent => $er); |
|
|
|
|
|
~ (REFC) { |
|
|
?lexmode 'ElementContent'; |
|
|
} else { |
|
|
?lexmode ElementContent; |
|
|
} |
|
|
} (CRO) { |
|
|
&_NumericCharacterReference_ |
|
|
($doc => $doc, $parent => $er); |
|
|
|
|
|
~ (REFC) { |
|
|
?lexmode 'ElementContent'; |
|
|
} else { |
|
|
?lexmode ElementContent; |
|
|
} |
|
|
} (ERO) { |
|
|
&_GeneralEntityReferenceEC |
|
|
($doc => $doc, $parent => $er, $ns => $ns); |
|
|
} (CDO) { |
|
|
&_CommentDeclaration_ ($doc => $doc, $parent => $er); |
|
|
|
|
|
~ (MDC) { |
|
|
?lexmode ElementContent; |
|
|
} else { |
|
|
?lexmode ElementContent; |
|
|
} |
|
|
} (CDSO) { |
|
|
&_CDATASection_ ($doc => $doc, $parent => $er); |
|
|
|
|
|
~ (MSE) { |
|
|
?lexmode 'ElementContent'; |
|
|
} else { |
|
|
?lexmode ElementContent; |
|
|
} |
|
|
} (PIO) { |
|
|
&_ProcessingInstruction_ ($doc => $doc, $parent => $er); |
|
|
|
|
|
~ (PIC) { |
|
|
?lexmode 'ElementContent'; |
|
|
} else { |
|
|
?lexmode ElementContent; |
|
|
} |
|
|
} |
|
|
|
|
2073 |
~ (#EOF) { } |
~ (#EOF) { } |
2074 |
lang:Perl { |
lang:Perl { |
2075 |
$self->{token} = pop @{$self->{entity_token}}; |
$self->{token} = pop @{$self->{entity_token}}; |
2077 |
pop @{$self->{entity}}; |
pop @{$self->{entity}}; |
2078 |
} |
} |
2079 |
|
|
2080 |
|
// TODO: Set read-only flag |
2081 |
|
|
2082 |
?lexmode EntityReference; |
?lexmode EntityReference; |
2083 |
?requires-next-token; |
?requires-next-token; |
2084 |
} |
} |
2090 |
} |
} |
2091 |
} // _GeneralEntityReferenceEC |
} // _GeneralEntityReferenceEC |
2092 |
|
|
2093 |
rule _GeneralEntityReferenceV_ ($doc, $vals) { |
/* |
2094 |
// TODO: Expansion |
General entity reference in an attribute value literal |
2095 |
?lexmode 'EntityReference'; |
*/ |
2096 |
|
rule _GeneralEntityReferenceV_ ($vals) { |
2097 |
|
?lexmode EntityReference; |
2098 |
|
|
2099 |
~ (Name) { |
~ (Name == 'lt') { |
2100 |
|
lang:Perl { |
2101 |
|
push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode> |
2102 |
|
('<'); |
2103 |
|
$vals->{value} .= '<'; |
2104 |
|
} |
2105 |
|
} (Name == 'gt') { |
2106 |
|
lang:Perl { |
2107 |
|
push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode> |
2108 |
|
('>'); |
2109 |
|
$vals->{value} .= '>'; |
2110 |
|
} |
2111 |
|
} (Name == 'amp') { |
2112 |
|
lang:Perl { |
2113 |
|
push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode> |
2114 |
|
('&'); |
2115 |
|
$vals->{value} .= '&'; |
2116 |
|
} |
2117 |
|
} (Name == 'quot') { |
2118 |
|
lang:Perl { |
2119 |
|
push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode> |
2120 |
|
('"'); |
2121 |
|
$vals->{value} .= '"'; |
2122 |
|
} |
2123 |
|
} (Name == 'apos') { |
2124 |
|
lang:Perl { |
2125 |
|
push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode> |
2126 |
|
("'"); |
2127 |
|
$vals->{value} .= "'"; |
2128 |
|
} |
2129 |
|
} (Name) { |
2130 |
|
my $er; |
2131 |
lang:Perl ($name => $token.value) { |
lang:Perl ($name => $token.value) { |
2132 |
## TODO: Namespace well-formedness |
## TODO: Namespace well-formedness |
2133 |
## TODO: Entity declared constraints |
## TODO: Entity declared constraints |
2134 |
my $er = $doc-><M::Document.createEntityReference> |
## TODO: No external entity constraint |
2135 |
($name); |
$er = $self->{doc}-><M::Document.createEntityReference> ($name); |
2136 |
push @{$vals->{nodes}}, $er; |
push @{$vals->{nodes}}, $er; |
2137 |
|
push @{$self->{entity}}, <Code::getCopyOfEntityState:: |
2138 |
|
$entity_type = 'general_entity', |
2139 |
|
$entity_name = $name>; |
2140 |
|
push @{$self->{entity_token}}, $self->{token}; |
2141 |
|
$self->{token} = []; |
2142 |
|
push @{$self->{entity_char}}, $self->{char}; |
2143 |
|
$self->{char} = []; |
2144 |
|
} |
2145 |
|
|
2146 |
|
?lexmode AttributeValueLiteralE; |
2147 |
|
&AttributeValueLiteralE_ ($parent => $er, $vals => $vals); |
2148 |
|
~ (#EOF) { } |
2149 |
|
lang:Perl { |
2150 |
|
$self->{token} = pop @{$self->{entity_token}}; |
2151 |
|
$self->{char} = pop @{$self->{entity_char}}; |
2152 |
|
pop @{$self->{entity}}; |
2153 |
} |
} |
2154 |
|
|
2155 |
|
// TODO: Set read-only flag |
2156 |
|
|
2157 |
|
?lexmode EntityReference; |
2158 |
|
?requires-next-token; |
2159 |
} |
} |
2160 |
|
|
2161 |
// ~ (REFC) { } |
// ~ (REFC) { } |
2162 |
} // _GeneralEntityReferenceV_ |
} // _GeneralEntityReferenceV_ |
2163 |
|
|
2164 |
/* |
/* |
2165 |
|
General entity reference in the replacement text |
2166 |
|
of the entity referenced in an attribute value literal |
2167 |
|
*/ |
2168 |
|
rule _GeneralEntityReferenceAE_ ($parent, $vals) |
2169 |
|
{ |
2170 |
|
?lexmode EntityReference; |
2171 |
|
|
2172 |
|
~ (Name == 'lt') { |
2173 |
|
lang:Perl { |
2174 |
|
$parent-><M::Node.appendChild> |
2175 |
|
($self->{doc}-><M::Document.createTextNode> ('<')); |
2176 |
|
$vals->{value} .= '<'; |
2177 |
|
} |
2178 |
|
} (Name == 'gt') { |
2179 |
|
lang:Perl { |
2180 |
|
$parent-><M::Node.appendChild> |
2181 |
|
($self->{doc}-><M::Document.createTextNode> ('>')); |
2182 |
|
$vals->{value} .= '>'; |
2183 |
|
} |
2184 |
|
} (Name == 'amp') { |
2185 |
|
lang:Perl { |
2186 |
|
$parent-><M::Node.appendChild> |
2187 |
|
($self->{doc}-><M::Document.createTextNode> ('&')); |
2188 |
|
$vals->{value} .= '&'; |
2189 |
|
} |
2190 |
|
} (Name == 'quot') { |
2191 |
|
lang:Perl { |
2192 |
|
$parent-><M::Node.appendChild> |
2193 |
|
($self->{doc}-><M::Document.createTextNode> ('"')); |
2194 |
|
$vals->{value} .= '"'; |
2195 |
|
} |
2196 |
|
} (Name == 'apos') { |
2197 |
|
lang:Perl { |
2198 |
|
$parent-><M::Node.appendChild> |
2199 |
|
($self->{doc}-><M::Document.createTextNode> ("'")); |
2200 |
|
$vals->{value} .= "'"; |
2201 |
|
} |
2202 |
|
} (Name) { |
2203 |
|
my $er; |
2204 |
|
lang:Perl ($name => $token.value) { |
2205 |
|
## TODO: Namespace well-formedness |
2206 |
|
## TODO: Entity declared constraints |
2207 |
|
## TODO: No external entity constraint |
2208 |
|
$er = $self->{doc}-><M::Document.createEntityReference> ($name); |
2209 |
|
$parent-><M::Node.appendChild> ($er); |
2210 |
|
push @{$self->{entity}}, <Code::getCopyOfEntityState:: |
2211 |
|
$entity_type = 'general_entity', |
2212 |
|
$entity_name = $name>; |
2213 |
|
push @{$self->{entity_token}}, $self->{token}; |
2214 |
|
$self->{token} = []; |
2215 |
|
push @{$self->{entity_char}}, $self->{char}; |
2216 |
|
$self->{char} = []; |
2217 |
|
} |
2218 |
|
|
2219 |
|
?lexmode AttributeValueLiteralE; |
2220 |
|
&AttributeValueLiteralE_ ($parent => $er, $vals => $vals); |
2221 |
|
~ (#EOF) { } |
2222 |
|
lang:Perl { |
2223 |
|
$self->{token} = pop @{$self->{entity_token}}; |
2224 |
|
$self->{char} = pop @{$self->{entity_char}}; |
2225 |
|
pop @{$self->{entity}}; |
2226 |
|
} |
2227 |
|
|
2228 |
|
// TODO: Set read-only flag |
2229 |
|
|
2230 |
|
?lexmode EntityReference; |
2231 |
|
?requires-next-token; |
2232 |
|
} |
2233 |
|
|
2234 |
|
// ~ (REFC) { } |
2235 |
|
} // _GeneralEntityReferenceAE_ |
2236 |
|
|
2237 |
|
/* |
2238 |
General entity reference in literal entity value |
General entity reference in literal entity value |
2239 |
*/ |
*/ |
2240 |
rule _GeneralEntityReferenceEV_ ($doc, $vals) { |
rule _GeneralEntityReferenceEV_ ($vals) { |
2241 |
?lexmode 'EntityReference'; |
?lexmode 'EntityReference'; |
2242 |
|
|
2243 |
~ (Name) { |
~ (Name) { |
2247 |
push @$vals, $name; |
push @$vals, $name; |
2248 |
} |
} |
2249 |
} |
} |
2250 |
|
|
2251 |
|
// No expansion |
2252 |
|
|
2253 |
// ~ (REFC) { } |
// ~ (REFC) { } |
2254 |
} // _GeneralEntityReferenceEV_ |
} // _GeneralEntityReferenceEV_ |
2272 |
} |
} |
2273 |
} |
} |
2274 |
lang:Perl { |
lang:Perl { |
2275 |
$node = $doc-><M::DocumentXDoctype.createDocumentTypeDefinition> ($name); |
$self->{docx} = $self->{doc} |
2276 |
$doc-><M::Node.appendChild> ($node); |
-><M::Node.getFeature> (<Q::fe:XDoctype>, '3.0'); |
2277 |
$doc-><AG::Document.domConfig> |
$node = $self->{docx}-><M::DocumentXDoctype.createDocumentTypeDefinition> |
2278 |
-><M::c|DOMConfiguration.setParameter> |
($name); |
|
('schema-type' => <Q::xml-dtd:>); |
|
2279 |
} |
} |
2280 |
|
|
2281 |
~? (S) { |
~? (S) { |
2298 |
} |
} |
2299 |
} |
} |
2300 |
|
|
2301 |
|
lang:Perl { |
2302 |
|
$self->{dtdef} = $node; |
2303 |
|
$doc-><M::Node.appendChild> ($node); |
2304 |
|
$doc-><AG::Document.domConfig> |
2305 |
|
-><M::c|DOMConfiguration.setParameter> |
2306 |
|
('schema-type' => <Q::xml-dtd:>); |
2307 |
|
} |
2308 |
|
|
2309 |
~? (DSO) { |
~? (DSO) { |
2310 |
&InternalSubset ($doc => $doc, $doctype => $node); |
&InternalSubset ($doc => $doc, $doctype => $node); |
2311 |
|
|
2597 |
lang:Perl { |
lang:Perl { |
2598 |
$et = $doctype-><M::DTDef.getElementTypeDefinitionNode> ($name); |
$et = $doctype-><M::DTDef.getElementTypeDefinitionNode> ($name); |
2599 |
unless ($et) { |
unless ($et) { |
2600 |
$docxd = $doc-><M::Node.getFeature> (<Q::ManakaiDOM:XDoctype>, '3.0'); |
$docxd = $doc-><M::Node.getFeature> (<Q::fe:XDoctype>, '3.0'); |
2601 |
$et = $docxd-><M::DocumentXDoctype.createElementTypeDefinition> |
$et = $docxd-><M::DocumentXDoctype.createElementTypeDefinition> |
2602 |
($name); |
($name); |
2603 |
$doctype-><M::DTDef.setElementTypeDefinitionNode> ($et) |
$doctype-><M::DTDef.setElementTypeDefinitionNode> ($et) |
2611 |
my $at; |
my $at; |
2612 |
lang:Perl ($v => $token.value) { |
lang:Perl ($v => $token.value) { |
2613 |
$docxd ||= $doc-><M::Node.getFeature> |
$docxd ||= $doc-><M::Node.getFeature> |
2614 |
(<Q::ManakaiDOM:XDoctype>, '3.0'); |
(<Q::fe:XDoctype>, '3.0'); |
2615 |
$at = $docxd-><M::DocumentXDoctype.createAttributeDefinition> ($v); |
$at = $docxd-><M::DocumentXDoctype.createAttributeDefinition> ($v); |
2616 |
unless (exists $et-><AG::ETDef.attributeDefinitions>->{$v}) { |
unless (exists $et-><AG::ETDef.attributeDefinitions>->{$v}) { |
2617 |
$et-><M::ETDef.setAttributeDefinitionNode> ($at); |
$et-><M::ETDef.setAttributeDefinitionNode> ($at); |
2809 |
} |
} |
2810 |
} // _AttlistDeclaration |
} // _AttlistDeclaration |
2811 |
|
|
2812 |
|
/* |
2813 |
|
Entity declaration |
2814 |
|
*/ |
2815 |
rule _EntityDeclaration ($doc) { |
rule _EntityDeclaration ($doc) { |
2816 |
// ~ (MDO) { } |
// ~ (MDO) { } |
2817 |
// ~ (Name == ENTITY) { } |
// ~ (Name == ENTITY) { } |
2819 |
~ (S) { } |
~ (S) { } |
2820 |
|
|
2821 |
my $decl; |
my $decl; |
2822 |
lang:Perl { $decl = {}; } |
lang:Perl { $decl = { name => '#ILLEGAL' }; } |
2823 |
|
|
2824 |
~? (PERO) { |
~? (PERO) { |
2825 |
~ (S) { } |
~ (S) { } |
2834 |
} |
} |
2835 |
} |
} |
2836 |
|
|
2837 |
|
lang:Perl { |
2838 |
|
$decl->{node} = $self->{docx}-><M::DocumentXDoctype.createGeneralEntity> |
2839 |
|
($decl->{name}); |
2840 |
|
## TODO: Parameter entity... |
2841 |
|
} |
2842 |
|
|
2843 |
~ (S) { } |
~ (S) { } |
2844 |
|
|
2845 |
~ (LIT) { |
~ (LIT) { |
2869 |
~ (Name) { |
~ (Name) { |
2870 |
lang:Perl ($v => $token.value) { |
lang:Perl ($v => $token.value) { |
2871 |
$decl->{notation} = $v; |
$decl->{notation} = $v; |
2872 |
|
$decl->{node}-><AG::x|Entity.notationName> ($v); |
2873 |
} |
} |
2874 |
} |
} |
2875 |
|
|
2880 |
lang:Perl { |
lang:Perl { |
2881 |
if ($self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'} |
if ($self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'} |
2882 |
->{$decl->{name}}) { |
->{$decl->{name}}) { |
2883 |
## TODO: error |
## TODO: warning |
2884 |
|
## TODO: predefined entity error check |
2885 |
} else { |
} else { |
2886 |
$self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'} |
$self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'} |
2887 |
->{$decl->{name}} = $decl; |
->{$decl->{name}} = $decl; |
2888 |
|
$self->{dtdef}-><M::DTDef.setGeneralEntityNode> ($decl->{node}) |
2889 |
|
unless $decl->{is_param_entity}; |
2890 |
} |
} |
2891 |
} |
} |
2892 |
|
|
2942 |
} |
} |
2943 |
} // _NotationDeclaration |
} // _NotationDeclaration |
2944 |
|
|
2945 |
rule _EntityValue ($doc, $decl) { |
rule _EntityValue ($decl) { |
2946 |
?lexmode EntityValue; |
?lexmode EntityValue; |
2947 |
|
|
2948 |
my $vals; |
my $vals; |
2971 |
?lexmode EntityValue; |
?lexmode EntityValue; |
2972 |
} |
} |
2973 |
} (HCRO) { |
} (HCRO) { |
2974 |
&_HexadecimalCharacterReferenceV_ |
&_HexadecimalCharacterReferenceEV_ ($vals => $vals); |
|
($doc => $doc, $vals => $vals); |
|
2975 |
|
|
2976 |
lang:Perl { |
lang:Perl { |
2977 |
$reptxt .= $vals->[0]-><AG::Node.textContent>; |
$reptxt .= $vals->[-1]; |
|
$vals = []; |
|
2978 |
} |
} |
2979 |
|
|
2980 |
~ (REFC) { |
~ (REFC) { |
2983 |
?lexmode EntityValue; |
?lexmode EntityValue; |
2984 |
} |
} |
2985 |
} (CRO) { |
} (CRO) { |
2986 |
&_NumericCharacterReferenceV_ |
&_NumericCharacterReferenceEV_ ($vals => $vals); |
|
($doc => $doc, $vals => $vals); |
|
2987 |
|
|
2988 |
lang:Perl { |
lang:Perl { |
2989 |
$reptxt .= $vals->[0]-><AG::Node.textContent>; |
$reptxt .= $vals->[-1]; |
|
$vals = []; |
|
2990 |
} |
} |
2991 |
|
|
2992 |
~ (REFC) { |
~ (REFC) { |
2995 |
?lexmode EntityValue; |
?lexmode EntityValue; |
2996 |
} |
} |
2997 |
} (ERO) { |
} (ERO) { |
2998 |
&_GeneralEntityReferenceEV_ |
&_GeneralEntityReferenceEV_ ($vals => $vals); |
|
($doc => $doc, $vals => $vals); |
|
2999 |
|
|
3000 |
lang:Perl { |
lang:Perl { |
3001 |
$reptxt .= '&' . $vals->[0] . ';'; |
$reptxt .= '&' . $vals->[-1] . ';'; |
|
$vals = []; |
|
3002 |
} |
} |
3003 |
|
|
3004 |
~ (REFC) { |
~ (REFC) { |
3021 |
} |
} |
3022 |
} // _EntityValue |
} // _EntityValue |
3023 |
|
|
3024 |
rule _EntityValueA ($doc, $decl) { |
rule _EntityValueA ($decl) { |
3025 |
?lexmode EntityValueA; |
?lexmode EntityValueA; |
3026 |
|
|
3027 |
my $vals; |
my $vals; |
3049 |
?lexmode EntityValueA; |
?lexmode EntityValueA; |
3050 |
} |
} |
3051 |
} (HCRO) { |
} (HCRO) { |
3052 |
&_HexadecimalCharacterReferenceV_ |
&_HexadecimalCharacterReferenceEV_ ($vals => $vals); |
|
($doc => $doc, $vals => $vals); |
|
3053 |
|
|
3054 |
lang:Perl { |
lang:Perl { |
3055 |
$reptxt .= $vals->[0]-><AG::Node.textContent>; |
$reptxt .= $vals->[-1]; |
|
$vals = []; |
|
3056 |
} |
} |
3057 |
|
|
3058 |
|
|
3062 |
?lexmode EntityValueA; |
?lexmode EntityValueA; |
3063 |
} |
} |
3064 |
} (CRO) { |
} (CRO) { |
3065 |
&_NumericCharacterReferenceV_ |
&_NumericCharacterReferenceEV_ ($vals => $vals); |
|
($doc => $doc, $vals => $vals); |
|
3066 |
|
|
3067 |
lang:Perl { |
lang:Perl { |
3068 |
$reptxt .= $vals->[0]-><AG::Node.textContent>; |
$reptxt .= $vals->[-1]; |
|
$vals = []; |
|
3069 |
} |
} |
3070 |
|
|
3071 |
~ (REFC) { |
~ (REFC) { |
3074 |
?lexmode EntityValueA; |
?lexmode EntityValueA; |
3075 |
} |
} |
3076 |
} (ERO) { |
} (ERO) { |
3077 |
&_GeneralEntityReferenceEV_ |
&_GeneralEntityReferenceEV_ ($vals => $vals); |
|
($doc => $doc, $vals => $vals); |
|
3078 |
|
|
3079 |
lang:Perl { |
lang:Perl { |
3080 |
$reptxt .= '&' . $vals->[0] . ';'; |
$reptxt .= '&' . $vals->[-1] . ';'; |
|
$vals = []; |
|
3081 |
} |
} |
3082 |
|
|
3083 |
~ (REFC) { |
~ (REFC) { |
3641 |
LITA := [U+0027]; |
LITA := [U+0027]; |
3642 |
STRING : value := [^U+0027 '&' '<']+; |
STRING : value := [^U+0027 '&' '<']+; |
3643 |
} // AttributeValueLiteralA |
} // AttributeValueLiteralA |
3644 |
|
|
3645 |
|
lexmode AttributeValueLiteralE |
3646 |
|
: standalone |
3647 |
|
: extends => 'AttributeValueLiteral_' |
3648 |
|
{ |
3649 |
|
STRING : value := [^'&' '<']+; |
3650 |
|
} // AttributeValueLiteralE |
3651 |
|
|
3652 |
lexmode EntityValue_ { |
lexmode EntityValue_ { |
3653 |
PERO := ['%']; |
PERO := ['%']; |
3981 |
xml-standalone: false; |
xml-standalone: false; |
3982 |
document-type { |
document-type { |
3983 |
node-name: 'a'; |
node-name: 'a'; |
3984 |
|
general-entity { |
3985 |
|
node-name: 'entity'; |
3986 |
|
text-content: 'entity value'; |
3987 |
|
has-replacement-tree: true; |
3988 |
|
} |
3989 |
} |
} |
3990 |
element { |
element { |
3991 |
namespace-uri: null; |
namespace-uri: null; |
4033 |
xml-standalone: false; |
xml-standalone: false; |
4034 |
document-type { |
document-type { |
4035 |
node-name: 'a'; |
node-name: 'a'; |
4036 |
|
general-entity { |
4037 |
|
node-name: 'entity'; |
4038 |
|
text-content: 'entity value'; |
4039 |
|
has-replacement-tree: true; |
4040 |
|
} |
4041 |
} |
} |
4042 |
element { |
element { |
4043 |
namespace-uri: null; |
namespace-uri: null; |
4066 |
xml-standalone: false; |
xml-standalone: false; |
4067 |
document-type { |
document-type { |
4068 |
node-name: 'a'; |
node-name: 'a'; |
4069 |
|
general-entity { |
4070 |
|
node-name: 'entity'; |
4071 |
|
text-content: 'entity value'; |
4072 |
|
has-replacement-tree: true; |
4073 |
|
} |
4074 |
} |
} |
4075 |
element { |
element { |
4076 |
namespace-uri: null; |
namespace-uri: null; |
4106 |
xml-standalone: false; |
xml-standalone: false; |
4107 |
document-type { |
document-type { |
4108 |
node-name: 'a'; |
node-name: 'a'; |
4109 |
|
general-entity { |
4110 |
|
node-name: 'entity'; |
4111 |
|
has-replacement-tree: true; |
4112 |
|
text { data: 'entity '; } |
4113 |
|
element { |
4114 |
|
node-name: 'p'; |
4115 |
|
text-content: 'value'; |
4116 |
|
} |
4117 |
|
text { data: ' with '; } |
4118 |
|
element { |
4119 |
|
node-name: 'e'; |
4120 |
|
text-content: 'element'; |
4121 |
|
} |
4122 |
|
} |
4123 |
} |
} |
4124 |
element { |
element { |
4125 |
namespace-uri: null; |
namespace-uri: null; |
4171 |
xml-standalone: false; |
xml-standalone: false; |
4172 |
document-type { |
document-type { |
4173 |
node-name: 'a'; |
node-name: 'a'; |
4174 |
|
general-entity { |
4175 |
|
node-name: 'entity1'; |
4176 |
|
text-content: 'entity value'; |
4177 |
|
} |
4178 |
|
general-entity { |
4179 |
|
node-name: 'entity2'; |
4180 |
|
text { data: 'e'; } |
4181 |
|
general-entity-reference { |
4182 |
|
node-name: 'entity1'; |
4183 |
|
text-content: 'entity value'; |
4184 |
|
is-expanded: true; |
4185 |
|
} |
4186 |
|
text { data: 'n'; } |
4187 |
|
} |
4188 |
} |
} |
4189 |
element { |
element { |
4190 |
namespace-uri: null; |
namespace-uri: null; |
4203 |
} |
} |
4204 |
} |
} |
4205 |
} |
} |
4206 |
|
|
4207 |
|
@@XMLTest: |
4208 |
|
@@@QName: xp.doctype.entity.value.charref.test |
4209 |
|
@@@DEnt: |
4210 |
|
@@@@test:value: |
4211 |
|
<!DOCTYPE a [ |
4212 |
|
<!ENTITY entity1 "entity !value#"> |
4213 |
|
<!ENTITY entity2 '!value#'> |
4214 |
|
]> |
4215 |
|
<a></a> |
4216 |
|
@@@test:domTree: |
4217 |
|
document { |
4218 |
|
document-type { |
4219 |
|
general-entity { |
4220 |
|
node-name: 'entity1'; |
4221 |
|
text-content: 'entity !value#'; |
4222 |
|
has-replacement-tree: true; |
4223 |
|
} |
4224 |
|
general-entity { |
4225 |
|
node-name: 'entity2'; |
4226 |
|
text-content: '!value#'; |
4227 |
|
has-replacement-tree: true; |
4228 |
|
} |
4229 |
|
} |
4230 |
|
element { } |
4231 |
|
} |
4232 |
|
|
4233 |
|
@@XMLTest: |
4234 |
|
@@@QName: xp.predefined.in.content.test |
4235 |
|
@@@DEnt: |
4236 |
|
@@@@test:value: |
4237 |
|
<a>_<_>_"_'_&_</a> |
4238 |
|
@@@test:domTree: |
4239 |
|
document { |
4240 |
|
element { |
4241 |
|
text-content: '_<_>_"_' U+0027 '_&_'; |
4242 |
|
} |
4243 |
|
} |
4244 |
|
@@XMLTest: |
4245 |
|
@@@QName: xp.predefined.in.attr.test |
4246 |
|
@@@DEnt: |
4247 |
|
@@@@test:value: |
4248 |
|
<a at="_<_>_"_'_&_"></a> |
4249 |
|
@@@test:domTree: |
4250 |
|
document { |
4251 |
|
element { |
4252 |
|
attribute { |
4253 |
|
node-name: 'at'; |
4254 |
|
text-content: '_<_>_"_' U+0027 '_&_'; |
4255 |
|
} |
4256 |
|
} |
4257 |
|
} |
4258 |
|
@@XMLTest: |
4259 |
|
@@@QName: xp.predefined.in.content.in.entity.test |
4260 |
|
@@@DEnt: |
4261 |
|
@@@@test:value: |
4262 |
|
<!DOCTYPE a [ |
4263 |
|
<!ENTITY ent "_<_>_"_'_&_"> |
4264 |
|
]> |
4265 |
|
<a>&ent;</a> |
4266 |
|
@@@test:domTree: |
4267 |
|
document { |
4268 |
|
document-type { |
4269 |
|
general-entity { |
4270 |
|
node-name: 'ent'; |
4271 |
|
text-content: '_<_>_"_' U+0027 '_&_'; |
4272 |
|
} |
4273 |
|
} |
4274 |
|
element { |
4275 |
|
text-content: '_<_>_"_' U+0027 '_&_'; |
4276 |
|
} |
4277 |
|
} |
4278 |
|
@@XMLTest: |
4279 |
|
@@@QName: xp.predefined.decl.ignore.test |
4280 |
|
@@@DEnt: |
4281 |
|
@@@@test:value: |
4282 |
|
<!DOCTYPE a [ |
4283 |
|
<!ENTITY lt "&#x3C;"> |
4284 |
|
<!ENTITY gt ">"> |
4285 |
|
<!ENTITY amp "&#x26;"> |
4286 |
|
<!ENTITY quot """> |
4287 |
|
<!ENTITY apos "'"> |
4288 |
|
<!ENTITY other "other"> |
4289 |
|
]> |
4290 |
|
<a>_<_>_"_'_&_&other;_</a> |
4291 |
|
@@@test:domTree: |
4292 |
|
document { |
4293 |
|
document-type { |
4294 |
|
general-entity { |
4295 |
|
node-name: 'other'; |
4296 |
|
text-content: 'other'; |
4297 |
|
} |
4298 |
|
} |
4299 |
|
element { |
4300 |
|
text-content: '_<_>_"_' U+0027 '_&_other_'; |
4301 |
|
} |
4302 |
|
} |
4303 |
|
|
4304 |
@@XMLTest: |
@@XMLTest: |
4305 |
@@@QName: xp.doctype.internal.attr.empty.test |
@@@QName: xp.doctype.internal.attr.empty.test |
4306 |
@@@DEnt: |
@@@DEnt: |
4834 |
} |
} |
4835 |
} |
} |
4836 |
} |
} |
4837 |
|
|
4838 |
|
@@XMLTest: |
4839 |
|
@@@QName: xp.attr.literal.charref.test |
4840 |
|
@@@DEnt: |
4841 |
|
@@@@test:value: |
4842 |
|
<a at1 = "value!_%value" |
4843 |
|
at2 = 'value%_!value'></a> |
4844 |
|
@@@test:domTree: |
4845 |
|
document { |
4846 |
|
element { |
4847 |
|
attribute { |
4848 |
|
node-name: 'at1'; |
4849 |
|
text-content: 'value!_%value'; |
4850 |
|
} |
4851 |
|
attribute { |
4852 |
|
node-name: 'at2'; |
4853 |
|
text-content: 'value%_!value'; |
4854 |
|
} |
4855 |
|
} |
4856 |
|
} |
4857 |
|
@@XMLTest: |
4858 |
|
@@@QName: xp.attr.literal.entref.test |
4859 |
|
@@@DEnt: |
4860 |
|
@@@@test:value: |
4861 |
|
<!DOCTYPE a [ |
4862 |
|
<!ENTITY ent "entity&#33;_&#x29;value"> |
4863 |
|
]> |
4864 |
|
<a at1 = "value&ent;value" |
4865 |
|
at2 = 'value&ent;value'></a> |
4866 |
|
@@@test:domTree: |
4867 |
|
document { |
4868 |
|
document-type { |
4869 |
|
general-entity { |
4870 |
|
node-name: 'ent'; |
4871 |
|
text-content: 'entity!_)value'; |
4872 |
|
} |
4873 |
|
} |
4874 |
|
element { |
4875 |
|
attribute { |
4876 |
|
node-name: 'at1'; |
4877 |
|
text-content: 'valueentity!_)valuevalue'; |
4878 |
|
} |
4879 |
|
attribute { |
4880 |
|
node-name: 'at2'; |
4881 |
|
text-content: 'valueentity!_)valuevalue'; |
4882 |
|
} |
4883 |
|
} |
4884 |
|
} |
4885 |
|
@@XMLTest: |
4886 |
|
@@@QName: xp.attr.literal.entref.nest.test |
4887 |
|
@@@DEnt: |
4888 |
|
@@@@test:value: |
4889 |
|
<!DOCTYPE a [ |
4890 |
|
<!ENTITY ent1 "entity&#33;_&#x29;value"> |
4891 |
|
<!ENTITY ent2 "@&ent1;@"> |
4892 |
|
]> |
4893 |
|
<a at1 = "value&ent2;value" |
4894 |
|
at2 = 'value&ent2;value'></a> |
4895 |
|
@@@test:domTree: |
4896 |
|
document { |
4897 |
|
document-type { |
4898 |
|
general-entity { |
4899 |
|
node-name: 'ent1'; |
4900 |
|
text-content: 'entity!_)value'; |
4901 |
|
} |
4902 |
|
general-entity { |
4903 |
|
node-name: 'ent2'; |
4904 |
|
text-content: '@entity!_)value@'; |
4905 |
|
} |
4906 |
|
} |
4907 |
|
element { |
4908 |
|
attribute { |
4909 |
|
node-name: 'at1'; |
4910 |
|
text-content: 'value@entity!_)value@value'; |
4911 |
|
} |
4912 |
|
attribute { |
4913 |
|
node-name: 'at2'; |
4914 |
|
text-content: 'value@entity!_)value@value'; |
4915 |
|
} |
4916 |
|
} |
4917 |
|
} |
4918 |
|
|
4919 |
@@PerlDef: |
@@PerlDef: |
4920 |
my $impl = $Message::DOM::ImplementationRegistry->get_implementation ({ |
my $impl = $Message::DOM::ImplementationRegistry->get_implementation ({ |