/[suikacvs]/messaging/manakai/lib/Message/DOM/XMLParser.dis
Suika

Contents of /messaging/manakai/lib/Message/DOM/XMLParser.dis

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.20 - (hide annotations) (download)
Sun Feb 12 06:42:15 2006 UTC (18 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.19: +845 -34 lines
++ manakai/lib/Message/Util/DIS/ChangeLog	12 Feb 2006 06:42:07 -0000
2006-02-12  Wakaba  <wakaba@suika.fam.cx>

	* Test.dis (assertDOMTreeEquals): |general_entities| attribute
	support is added.

++ manakai/lib/Message/DOM/ChangeLog	12 Feb 2006 06:41:26 -0000
2006-02-12  Wakaba  <wakaba@suika.fam.cx>

	* XMLParser.dis (parseString): General |Entity| replacement
	tree is not constructed because of a typo.  Clears |EntityReference|
	content before constructing |Entity| replacement tree.
	The |xp:wf-entity-declared| well-formedness constraint
	for entity references in attribute value literal is implemented.

1 wakaba 1.1 Module:
2     @QName: MDOM|XMLParser
3     @Namespace:
4     http://suika.fam.cx/~wakaba/archive/2004/dom/xml-parser#
5    
6     @FullName:
7     @@lang:en
8     @@@: XML Parser
9    
10     @DISCore:author: DISCore|Wakaba
11     @License: license|Perl+MPL
12     @Date:
13 wakaba 1.20 $Date: 2006/02/11 13:41:48 $
14 wakaba 1.1
15     @DefaultFor: ManakaiDOM|ManakaiDOMLatest
16    
17     @Require:
18     @@Module:
19     @@@QName: MDOM|DOMLS
20     @@@WithFor: ManakaiDOM|ManakaiDOMLatest
21 wakaba 1.6 @@Module:
22     @@@QName: MDOM|XDoctype
23     @@@WithFor: ManakaiDOM|ManakaiDOMLatest
24 wakaba 1.1
25     Namespace:
26 wakaba 1.8 @c:
27     http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#
28 wakaba 1.11 @cfg:
29     http://suika.fam.cx/www/2006/dom-config/
30 wakaba 1.6 @d:
31     http://suika.fam.cx/~wakaba/archive/2004/dom/xdt#
32 wakaba 1.1 @dis:
33     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
34 wakaba 1.5 @dtest:
35     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#Test/
36 wakaba 1.1 @dx:
37     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#
38     @ecore:
39     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/Core/
40     @f:
41     http://suika.fam.cx/~wakaba/archive/2004/dom/feature#
42 wakaba 1.11 @fe:
43     http://suika.fam.cx/www/2006/feature/
44     @gls:
45     http://suika.fam.cx/~wakaba/archive/2004/dom/gls#
46 wakaba 1.1 @idl:
47     http://suika.fam.cx/~wakaba/archive/2004/dis/IDL#
48     @infoset:
49     http://www.w3.org/2001/04/infoset#
50     @lang:
51     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
52     @license:
53     http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
54     @LSEV:
55     http://www.w3.org/2002/DOMLS
56     @ManakaiDOM:
57     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
58     @ManakaiDOMLS:
59     http://suika.fam.cx/~wakaba/archive/2004/mdom-ls#
60     @MDOM:
61     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.
62     @MDOMX:
63     http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#
64 wakaba 1.11 @mn:
65     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/ManakaiNode#
66 wakaba 1.1 @rdf:
67     http://www.w3.org/1999/02/22-rdf-syntax-ns#
68     @rdfs:
69     http://www.w3.org/2000/01/rdf-schema#
70     @t:
71     http://suika.fam.cx/~wakaba/archive/2004/dom/tree#
72 wakaba 1.5 @test:
73     http://suika.fam.cx/~wakaba/archive/2004/dis/Test#
74 wakaba 1.8 @x:
75     http://suika.fam.cx/~wakaba/archive/2004/dom/xml#
76 wakaba 1.1 @xml:
77     http://www.w3.org/XML/1998/namespace
78 wakaba 1.9 @xml-dtd:
79     http://www.w3.org/TR/REC-xml
80 wakaba 1.1 @xmlns:
81     http://www.w3.org/2000/xmlns/
82     @xp:
83     http://suika.fam.cx/~wakaba/archive/2004/dom/xml-parser#
84    
85     ## -- Features
86    
87     ElementTypeBinding:
88     @Name: FeatureDef
89     @ElementType:
90     dis:ResourceDef
91     @ShadowContent:
92     @@rdf:type: f|Feature
93     @@For: =ManakaiDOM|all
94    
95     ElementTypeBinding:
96     @Name: FeatureVerDef
97     @ElementType:
98     dis:ResourceDef
99     @ShadowContent:
100     @@rdf:type: f|Feature
101    
102     ElementTypeBinding:
103     @Name: featureQName
104     @ElementType:
105     f:name
106     @ShadowContent:
107     @@ContentType: DISCore|QName
108    
109     ResourceDef:
110     @QName: DOMString
111     @AliasFor: DOMMain|DOMString
112     @For: ManakaiDOM|DOM
113    
114     ResourceDef:
115     @QName: Node
116     @AliasFor: t|Node
117     @For: ManakaiDOM|DOM
118    
119     ResourceDef:
120     @QName: Element
121     @AliasFor: t|Element
122     @For: ManakaiDOM|DOM
123    
124     ResourceDef:
125     @QName: Document
126     @AliasFor: t|Document
127     @For: ManakaiDOM|DOM
128    
129 wakaba 1.6 ResourceDef:
130     @QName: DocumentXDoctype
131     @AliasFor: d|DocumentXDoctype
132     @For: ManakaiDOM|DOM
133    
134 wakaba 1.8 ResourceDef:
135     @QName: DTDef
136     @AliasFor: d|DocumentTypeDefinition
137     @For: ManakaiDOM|DOM
138    
139     ResourceDef:
140     @QName: ETDef
141     @AliasFor: d|ElementTypeDefinition
142     @For: ManakaiDOM|DOM
143    
144     ResourceDef:
145     @QName: ATDef
146     @AliasFor: d|AttributeDefinition
147     @For: ManakaiDOM|DOM
148    
149 wakaba 1.1 ElementTypeBinding:
150     @Name: ClsDef
151     @ElementType:
152     dis:ResourceDef
153     @ShadowContent:
154     @@rdf:type:
155     @@@@: dis|MultipleResource
156     @@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
157     @@resourceFor:
158     @@@@: ManakaiDOM|ForClass
159     @@@ForCheck: ManakaiDOM|ManakaiDOM !=ManakaiDOM|ManakaiDOM
160     @@For: ManakaiDOM|DOM3
161     @@For: =ManakaiDOM|ManakaiDOM
162    
163     @@rdf:type:
164     @@@@: DISLang|Class
165     @@@ForCheck: ManakaiDOM|ForClass
166    
167     ElementTypeBinding:
168     @Name: ClsQName
169     @ElementType:
170     dis:QName
171     @ShadowContent:
172     @@ForCheck: ManakaiDOM|ForClass
173    
174     ElementTypeBinding:
175     @Name: ClsISA
176     @ElementType:
177     dis:ISA
178     @ShadowContent:
179     @@ForCheck: ManakaiDOM|ForClass
180    
181     ElementTypeBinding:
182     @Name: nullCase
183     @ElementType:
184     dis:ResourceDef
185     @ShadowContent:
186     @@rdf:type: ManakaiDOM|InCase
187     @@Value:
188     @@@is-null:1
189    
190     ResourceDef:
191     @QName: LSParser
192     @AliasFor: DOMLS|LSParser
193     @For: ManakaiDOM|DOM3
194    
195     ClsDef:
196     @ClsQName: ManakaiXMLParser
197    
198     @Implement: DOMLS|LSParser
199    
200     @f:implements:
201     @@@: DOMLS|LSFeature30
202     @@For: ManakaiDOM|DOM3
203    
204 wakaba 1.11 @DISLang:role: gls|ParserRole
205 wakaba 1.1
206 wakaba 1.3 @enDesc:
207     Note that the <Class::ManakaiXMLParser> reports any XML errors
208     (syntax errors and / or well-formedness constraint errors)
209     via the <IF::DOMCore:error-handler> registered to
210     the <A::DOMLS:LSParser.domConfig> object. Each error has
211     its <A::DOMCore:DOMError.severity>, either <C::DOMCore:SEVERITY_ERROR>
212     or <C::DOMCore:SEVERITY_FATAL_ERROR>. However, their semantics
213     are slight different from the ones of <QUOTE::error> and
214     <QUOTE::fatal error> in XML; in this implemenetation,
215     <C::DOMCore:SEVERITY_ERROR> implies that the parsing process
216     can effectively be continued to detect more errors while
217     <C::DOMCore:SEVERITY_FATAL_ERROR> implies that the error
218     is serious so that the result document tree and any errors
219     might be far from the ones obtained when the error would not
220     be found.
221    
222 wakaba 1.1 @Attr:
223     @@Name: domConfig
224     @@enDesc:
225     The configuration of the parser.
226    
227     @@Get:
228     @@@Type: DOMCore|DOMConfiguration
229     @@@enDesc: The DOM configuration object.
230     @@@PerlDef:
231     __CODE{DOMCore|getConfigObject::
232     $target => $self,
233     $targetHash => $self,
234     $targetType => {<IFName::LSParser>},
235     $result => $r,
236     }__;
237    
238     @Method:
239     @@ManakaiDOM:isForInternal:1
240     @@ForCheck: ManakaiDOM|ForClass
241     @@Operator: DISPerl|NewMethod
242     @@enDesc:
243     Creates a new instance of the object.
244     @@Param:
245     @@@Name: impl
246 wakaba 1.11 @@@Type: gls|GLSImplementation
247 wakaba 1.1 @@@enDesc:
248     The implementation from which the parser is created.
249     @@Param:
250     @@@Name: features
251     @@@Type: DOMString
252     @@@dis:actualType: f|FeaturesString
253     @@@enDesc:
254     The set of features requested for the parser.
255     @@Return:
256     @@@Type: DOMMain|DOMObject
257     @@@dis:actualType: LSParser
258     @@@enDesc:
259     The newly created parser.
260     @@@PerlDef:
261     $r = bless {
262     <H::DOMCore:implementation> => $impl,
263     }, $self;
264    
265     @Method:
266     @@Name: parseString
267     @@enImplNote:
268     Non-standard - to be removed
269    
270     @@Param:
271     @@@Name: sourceText
272     @@@Type: DOMString
273     @@Return:
274     @@@Type: Document
275     @@@PerlDef:
276    
277     $self->{char} = [];
278     $self->{token} = [];
279 wakaba 1.6 $self->{entity} = [{
280     reptxt => \$sourceText,
281     line => 1,
282     column => 1,
283     pos => 0,
284     }];
285 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
286 wakaba 1.6 $self->{entity_char} = [];
287     $self->{entity_token} = [];
288 wakaba 1.3 $self->{xml_version} = '1.0';
289     $self->{standalone} = false;
290 wakaba 1.19 $self->{has_xref} = false;
291 wakaba 1.11 $self->{general_entity} = {
292     lt => {is_predefined => true},
293     gt => {is_predefined => true},
294     amp => {is_predefined => true},
295     quot => {is_predefined => true},
296     apos => {is_predefined => true},
297     };
298 wakaba 1.6 $self->{param_entity} = {};
299 wakaba 1.9 $self->{attr} = {};
300     # $self->{attr}->{$element_type_name}->{$attr_name} = $attr_def
301 wakaba 1.17
302 wakaba 1.3 ## Well-formedness constraint Entity Declared takes effect?
303 wakaba 1.1
304     __DEEP{
305 wakaba 1.11 $r = $self->{<H::c|implementation>}-><M::DOMImpl.createDocument>;
306     $r-><AS::Document.strictErrorChecking> (false);
307     $self->{doc} = $r;
308     CORE::delete $self->{docx};
309     CORE::delete $self->{dtdef};
310 wakaba 1.17 CORE::delete $self->{dtdecl};
311 wakaba 1.11 $self->{cfg} = $r-><AG::Document.domConfig>;
312     local $r->{<H::mn:node>}
313     ->{<H::cfg|entity-reference-read-only>} = false;
314    
315     ## Document entity -> |Document| node
316     $self->_parse_DocumentEntity;
317    
318     ## Replacement tree for general |Entity| nodes
319 wakaba 1.20 my @ent = values %{$self->{general_entity}};
320     for my $ent (@ent) {
321     if (exists $ent->{has_replacement_text}) {
322 wakaba 1.11 my $ent_name = $ent->{name};
323     $self->{entity} = [<Code::getCopyOfEntityState::
324     $entity_type = 'general_entity',
325     $entity_name = $ent_name>];
326 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
327 wakaba 1.11 $self->{token} = [];
328     $self->{char} = [];
329     ## TODO: External entity support
330     $self->_parse_InternalGeneralParsedEntity ($ent->{node});
331     $ent->{node}-><AS::x|Entity.hasReplacementTree> (true);
332 wakaba 1.20 }
333 wakaba 1.11 ## TODO: Read-only if configuration (for all entities)
334     }
335    
336     $r-><AS::Document.strictErrorChecking> (true);
337 wakaba 1.1 }__;
338    
339     @Method:
340     @@Name: shiftChar
341     @@ManakaiDOM:isForInternal:1
342     @@ForCheck: ManakaiDOM|ForClass
343     @@enDesc:
344     Returns the next character.
345     @@Return:
346     @@@Type: idl|long||ManakaiDOM|all
347     @@@enDesc:
348     The code position number of the next character, if any,
349 wakaba 1.6 or <CODE::-1>.
350 wakaba 1.1 @@@PerlDef:
351     if (@{$self->{char}}) {
352     $r = shift @{$self->{char}};
353     } else {
354 wakaba 1.7 no warnings 'substr';
355     ## substr outside length warnings at the end of the string
356 wakaba 1.6 GETCHAR: {
357     my $char = substr (${$self->{entity}->[-1]->{reptxt}},
358     $self->{entity}->[-1]->{pos}, 1);
359    
360 wakaba 1.7 if (defined $char and length $char) {
361 wakaba 1.13 $self->{entity}->[-1]->{pos}++;
362 wakaba 1.6 $r = ord $char;
363     if ($r == 0x000A) {
364     $self->{entity}->[-1]->{line}++;
365     $self->{entity}->[-1]->{column} = 1;
366     } elsif ($r == 0x000D) {
367     my $next_char = substr (${$self->{entity}->[-1]->{reptxt}},
368     $self->{entity}->[-1]->{pos}, 1);
369     if ($next_char eq "\x0A") {
370     $self->{entity}->[-1]->{pos}++;
371 wakaba 1.13 $self->{entity}->[-1]->{line}++;
372 wakaba 1.6 $self->{entity}->[-1]->{column} = 1;
373     } elsif ($next_char eq "\x85") {
374     if ($self->{xml_version} eq '1.1') {
375 wakaba 1.16 if ($self->{entity}->[-1]->{no_xml11_eol}) {
376     my $location = {
377     utf32_offset => $self->{entity}->[-1]->{pos} - 1,
378     line_number => $self->{entity}->[-1]->{line},
379     column_number => $self->{entity}->[-1]->{column},
380     };
381     my $continue = __DOMCore:ERROR{
382     xp|fatal-xml11-end-of-line-in-xml-declaration::
383     DOMCore|location => {$location},
384     xp|character-number => {$r},
385     }__;
386     unless ($continue) {
387     __EXCEPTION{DOMLS|PARSE_ERR}__;
388     }
389     } # no_xml11_eol
390 wakaba 1.6 $self->{entity}->[-1]->{pos}++;
391 wakaba 1.13 $self->{entity}->[-1]->{line}++;
392 wakaba 1.6 $self->{entity}->[-1]->{column} = 1;
393     } else {
394 wakaba 1.16 ## |no_xml11_eol| will be tested later.
395 wakaba 1.13 $self->{entity}->[-1]->{column}++;
396     ## Line number will be increased by next |shiftChar| call.
397 wakaba 1.6 }
398 wakaba 1.3 } else {
399 wakaba 1.13 $self->{entity}->[-1]->{line}++;
400 wakaba 1.6 $self->{entity}->[-1]->{column} = 1;
401     }
402     $r = 0x000A;
403     } elsif (
404     not ((0x0020 <= $r and $r <= 0x007E) or
405     (0x00A0 <= $r and $r <= 0xD7FF) or
406     (0xE000 <= $r and $r <= 0xFFFD) or
407     (0x10000 <= $r and $r <= 0x10FFFF)) and
408     $r != 0x0009 and $r != 0x0085 and
409     not ($self->{xml_version} eq '1.0' and
410     (0x007F <= $r and $r <= 0x009F))
411     ) {
412     my $location = {
413 wakaba 1.13 utf32_offset => $self->{entity}->[-1]->{pos} - 1,
414 wakaba 1.6 line_number => $self->{entity}->[-1]->{line},
415     column_number => $self->{entity}->[-1]->{column},
416     };
417     my $continue = __DOMCore:ERROR{xp|wf-legal-literal-character::
418     DOMCore|location => {$location},
419     xp|character-number => {$r},
420     }__;
421     unless ($continue) {
422     __EXCEPTION{DOMLS|PARSE_ERR}__;
423 wakaba 1.3 }
424 wakaba 1.6 $self->{entity}->[-1]->{column}++;
425     } elsif ($r == 0x0085 or $r == 0x2028) {
426 wakaba 1.16 if ($self->{entity}->[-1]->{no_xml11_eol}) {
427     my $location = {
428     utf32_offset => $self->{entity}->[-1]->{pos} - 1,
429     line_number => $self->{entity}->[-1]->{line},
430     column_number => $self->{entity}->[-1]->{column},
431     };
432     my $continue = __DOMCore:ERROR{
433     xp|fatal-xml11-end-of-line-in-xml-declaration::
434     DOMCore|location => {$location},
435     xp|character-number => {$r},
436     }__;
437     unless ($continue) {
438     __EXCEPTION{DOMLS|PARSE_ERR}__;
439     }
440     } # no_xml11_eol
441 wakaba 1.6 $r = 0x000A if $self->{xml_version} eq '1.1';
442 wakaba 1.13 ## Even in XML 1.0 it increases the line number.
443 wakaba 1.6 $self->{entity}->[-1]->{line}++;
444     $self->{entity}->[-1]->{column} = 1;
445 wakaba 1.3 } else {
446 wakaba 1.6 $self->{entity}->[-1]->{column}++;
447 wakaba 1.3 }
448     } else {
449 wakaba 1.6 $r = -1;
450 wakaba 1.3 }
451 wakaba 1.6 } # GETCHAR
452 wakaba 1.1 }
453    
454     @Method:
455     @@ManakaiDOM:isForInternal: 1
456     @@Operator: ManakaiDOM|MUErrorHandler
457     @@enDesc:
458     When a <IF::ecore|ErrorInterface||ManakaiDOM|Perl> is <Perl::report>ed,
459     then this method is invoked.
460    
461     The method calls the <cfg::DOMCore|error-handler> if the error is of
462     <IF::DOMCore|DOMError>. Otherwise, the error is re-thrown so that
463     corresponding <Perl::catch> clause, if any, can catch the error.
464     @@Param:
465     @@@Name: err
466     @@@Type: ecore|ErrorInterface||ManakaiDOM|Perl
467     @@@enDesc:
468     The reported error object.
469     @@Return:
470     @@@Type: DISPerl|Any
471     @@@enDesc:
472     If the <P::err> is a <IF::DOMCore|DOMError>, then the return value
473     of the error handler.
474    
475     {NOTE:: If the error is thrown, the method never returns.
476     }
477     @@@nullCase:
478     @@@@enDesc:
479     No error handler.
480     @@@PerlDef:
481     if ($err->isa (<IFName::DOMCore|DOMError||ManakaiDOM|ManakaiDOM>)) {
482     __DEEP{
483     A: {
484     my $cfg = $self-><AG::LSParser.domConfig>;
485     my $h = $cfg-><M::DOMCore|DOMConfiguration.getParameter>
486     ('error-handler');
487     $r = $h-><M::DOMCore|DOMErrorHandler.handleError> ($err);
488     } # A
489     }__;
490     } else {
491     $err-><M::ecore|ErrorInterface||ManakaiDOM|Perl.throw>;
492     }
493    
494     @DISPerl:dpgDef:
495    
496     /*
497     XML Document Entity
498    
499     document := prolog element *Misc
500     - *Char RestrictedChar *Char ;; [1]
501     */
502 wakaba 1.11 rule DocumentEntity : standalone {
503 wakaba 1.1 /*
504     prolog := XMLDecl? *Misc [doctypedecl *Misc] ;; [22]
505     */
506 wakaba 1.16 ?lexmode DocumentStart;
507 wakaba 1.11
508     my $doc;
509     lang:Perl {
510     $doc = $self->{doc};
511     }
512 wakaba 1.1
513 wakaba 1.3 ~? (XDO) {
514 wakaba 1.16 ?lexmode XMLDeclarationOrPI;
515     lang:Perl {
516     $self->{entity}->[-1]->{no_xml11_eol} = true;
517     }
518     ~ (S) { // XML declaration
519     &_XMLDeclaration_ ($doc => $doc);
520     ~ (PIC2) {
521     ?lexmode DocumentProlog;
522     } else {
523     ?lexmode DocumentProlog;
524     }
525     } (NameChar) { // Processing instruction whose target begins with |xml|
526     my $target_token;
527     lang:Perl ($v => $token.value) {
528     $target_token = $token;
529     $target_token->{value} = 'xml'.$target_token->{value};
530     $self->{entity}->[-1]->{no_xml11_eol} = false;
531     }
532     ?lexmode PINmtoken;
533     ~? (Nmtoken) {
534     lang:Perl ($v => $token.value) {
535     $target_token->{value} .= $v;
536     }
537     ?lexmode PIName;
538     }
539     lang:Perl {
540     $target_token->{type} = 'Name';
541     $target_token->{location_d} += 3; # 'xml'
542     unshift @{$self->{token}}, $token;
543     $token = $target_token;
544     }
545     &_ProcessingInstruction_ ($doc => $doc, $parent => $doc);
546     ~ (PIC) {
547     ?lexmode DocumentProlog;
548     } else {
549     ?lexmode DocumentProlog;
550     }
551 wakaba 1.3 } else {
552 wakaba 1.16 lang:Perl {
553     $self->{entity}->[-1]->{no_xml11_eol} = false;
554     }
555 wakaba 1.3 }
556     } else {
557     ?lexmode 'DocumentProlog';
558     }
559 wakaba 1.1
560     // *Misc
561 wakaba 1.2 ~* (CDO) {
562 wakaba 1.1 &_CommentDeclaration_ ($doc => $doc, $parent => $doc);
563    
564     ~ (MDC) {
565     ?lexmode DocumentProlog;
566     } else {
567     ?lexmode DocumentProlog;
568     }
569     } (PIO) {
570     &_ProcessingInstruction_ ($doc => $doc, $parent => $doc);
571    
572     ~ (PIC) {
573     ?lexmode 'DocumentProlog';
574     } else {
575     ?lexmode DocumentProlog;
576     }
577     } (S) {
578     //
579     }
580    
581     // doctypedecl
582     ~? (MDO) {
583     &_DocumentTypeDeclaration_ ($doc => $doc);
584    
585 wakaba 1.3 ~ (MDC) {
586     ?lexmode DocumentMisc;
587     } else {
588     ?lexmode DocumentMisc;
589     }
590     } else {
591     ?lexmode DocumentMisc;
592 wakaba 1.1 }
593    
594     // *Misc
595 wakaba 1.2 ~* (CDO) {
596 wakaba 1.1 &_CommentDeclaration_ ($doc => $doc, $parent => $doc);
597    
598     ~ (MDC) {
599     ?lexmode DocumentMisc;
600     } else {
601     ?lexmode DocumentMisc;
602     }
603     } (PIO) {
604     &_ProcessingInstruction_ ($doc => $doc, $parent => $doc);
605    
606     ~ (PIC) {
607     ?lexmode 'DocumentMisc';
608     } else {
609     ?lexmode DocumentMisc;
610     }
611     } (S) {
612     //
613     }
614    
615     // Document element
616     ~ (STAGO) {
617     &Element_ ($doc => $doc, $parent => $doc)
618     : unshift-current-token;
619     ~ (TAGC) {
620     ?lexmode DocumentEnd;
621     } else {
622     ?lexmode DocumentEnd;
623     }
624     } else {
625     ?lexmode 'DocumentEnd';
626     }
627    
628     // *Misc
629 wakaba 1.2 ~* (CDO) {
630 wakaba 1.1 &_CommentDeclaration_ ($doc => $doc, $parent => $doc);
631    
632     ~ (MDC) {
633     ?lexmode DocumentEnd;
634     } else {
635     ?lexmode DocumentEnd;
636     }
637     } (PIO) {
638     &_ProcessingInstruction_ ($doc => $doc, $parent => $doc);
639     ~ (PIC) {
640     ?lexmode 'DocumentEnd';
641     } else {
642     ?lexmode DocumentEnd;
643     }
644     } (S) {
645     //
646     }
647    
648     ~ (#EOF) { }
649     } // DocumentEntity
650 wakaba 1.11
651     /*
652     Internal General Parsed Entity
653    
654     An internal general parsed entity is well-formed if its
655     replacement text matches the production labeled |content|.
656     */
657     rule InternalGeneralParsedEntity ($ent) : standalone {
658     ?lexmode ElementContent;
659    
660     my $ns;
661     lang:Perl {
662     $ns = {
663     xml => <Q::xml:>,
664     xmlns => <Q::xmlns:>,
665     };
666     }
667    
668     &content ($parent => $ent, $ns => $ns);
669    
670     ~ (#EOF) { }
671     } // InternalGeneralParsedEntity
672    
673 wakaba 1.1 /*
674     XML Declaration
675    
676     XMLDecl := '<?xml' VersionInfo
677     [EncodingDecl]
678     [SDDecl]
679     [S] '?>' ;; [23]
680    
681     NOTE: XML declaration is optional in XML 1.0
682     while it is required in XML 1.1.
683     */
684 wakaba 1.16 rule _XMLDeclaration_ {
685     // ~ (XDO) { }
686 wakaba 1.3 ?lexmode XMLDeclaration;
687 wakaba 1.16 //lang:Perl {
688     // $self->{entity}->[-1]->{no_xml11_eol} = true;
689     //}
690     //~ (S) { }
691 wakaba 1.3
692     ~ (Name == 'version') {
693     ~? (S) { }
694     ~ (VI) { }
695     ~? (S) { }
696 wakaba 1.1
697 wakaba 1.3 my $ver;
698     my $bad_token;
699    
700     ~ (LIT) {
701     ?lexmode AttributeValueLiteral;
702    
703     ~ (STRING) {
704     lang:Perl ($version => $token.value) {
705     $ver = $version;
706     $bad_token = $token;
707     }
708     }
709    
710     ~ (LIT) {
711     ?lexmode XMLDeclaration;
712     }
713     } (LITA) {
714     ?lexmode AttributeValueLiteralA;
715    
716     ~ (STRING) {
717     lang:Perl ($version => $token.value) {
718     $ver = $version;
719     $bad_token = $token;
720     }
721     }
722    
723     ~ (LITA) {
724     ?lexmode XMLDeclaration;
725     }
726     }
727    
728     lang:Perl : has-error {
729     unless ($ver eq '1.0' or $ver eq '1.1') {
730     my $location;
731     __CODE{xp|get-location-from-token::
732     $token => {$bad_token},
733     $result => {$location},
734     }__;
735     my $continue = __DOMCore:ERROR{xp|wf-unsupported-xml-version::
736     DOMCore|location => {$location},
737 wakaba 1.16 xp|parent => {$self->{doc}},
738 wakaba 1.3 infoset|version => {$ver},
739     xp|error-token => {$bad_token},
740     }__;
741     unless ($continue) {
742     __EXCEPTION{DOMLS|PARSE_ERR}__;
743     }
744     }
745 wakaba 1.16 $self->{doc}-><AS::Document.xmlVersion> ($ver);
746 wakaba 1.3 $self->{xml_version} = $ver;
747     }
748    
749     ~? (S) { }
750 wakaba 1.1 }
751    
752 wakaba 1.3 ~? (Name == 'encoding') {
753     ~? (S) { }
754     ~ (VI) { }
755     ~? (S) { }
756    
757     my $ver;
758     my $bad_token;
759    
760     ~ (LIT) {
761     ?lexmode AttributeValueLiteral;
762    
763     ~ (STRING) {
764     lang:Perl ($version => $token.value) {
765     $ver = $version;
766     $bad_token = $token;
767     }
768     }
769    
770     ~ (LIT) {
771     ?lexmode XMLDeclaration;
772     }
773     } (LITA) {
774     ?lexmode AttributeValueLiteralA;
775    
776     ~ (STRING) {
777     lang:Perl ($version => $token.value) {
778     $ver = $version;
779     $bad_token = $token;
780     }
781     }
782    
783     ~ (LITA) {
784     ?lexmode XMLDeclaration;
785     }
786     }
787    
788     lang:Perl : has-error {
789     unless ($ver =~ /\A[A-Za-z][A-Za-z0-9._-]*\z/) {
790     my $location;
791     __CODE{xp|get-location-from-token::
792     $token => {$bad_token},
793     $result => {$location},
794     }__;
795     my $continue = __DOMCore:ERROR{xp|wf-malformed-enc-name::
796     DOMCore|location => {$location},
797 wakaba 1.16 xp|parent => {$self->{doc}},
798 wakaba 1.3 xp|name => {$ver},
799     xp|error-token => {$bad_token},
800     }__;
801     unless ($continue) {
802     __EXCEPTION{DOMLS|PARSE_ERR}__;
803     }
804     }
805 wakaba 1.16 $self->{doc}-><AS::Document.xmlEncoding> ($ver);
806 wakaba 1.3 }
807    
808     ~? (S) { }
809 wakaba 1.1 }
810 wakaba 1.3
811     ~? (Name == 'standalone') {
812     ~? (S) { }
813     ~ (VI) { }
814     ~? (S) { }
815    
816     my $ver;
817     my $bad_token;
818    
819     ~ (LIT) {
820     ?lexmode AttributeValueLiteral;
821    
822     ~ (STRING) {
823     lang:Perl ($version => $token.value) {
824     $ver = $version;
825     $bad_token = $token;
826     }
827     }
828    
829     ~ (LIT) {
830     ?lexmode XMLDeclaration;
831     }
832     } (LITA) {
833     ?lexmode AttributeValueLiteralA;
834    
835     ~ (STRING) {
836     lang:Perl ($version => $token.value) {
837     $ver = $version;
838     $bad_token = $token;
839     }
840     }
841 wakaba 1.1
842 wakaba 1.3 ~ (LITA) {
843     ?lexmode XMLDeclaration;
844     }
845     }
846    
847     lang:Perl : has-error {
848     unless ($ver eq 'yes' or $ver eq 'no') {
849     my $location;
850     __CODE{xp|get-location-from-token::
851     $token => {$bad_token},
852     $result => {$location},
853     }__;
854     my $continue = __DOMCore:ERROR{xp|wf-malformed-xml-standalone::
855     DOMCore|location => {$location},
856 wakaba 1.16 xp|parent => {$self->{doc}},
857 wakaba 1.3 xp|name => {$ver},
858     xp|error-token => {$bad_token},
859     }__;
860     unless ($continue) {
861     __EXCEPTION{DOMLS|PARSE_ERR}__;
862     }
863     }
864 wakaba 1.13 if ($ver eq 'yes') {
865 wakaba 1.16 $self->{doc}-><AS::Document.xmlStandalone> (true);
866 wakaba 1.13 $self->{standalone} = true;
867     }
868 wakaba 1.3 }
869    
870     ~? (S) { }
871     }
872    
873 wakaba 1.16 ~ (PIC1) {
874     lang:Perl {
875     $self->{entity}->[-1]->{no_xml11_eol} = false;
876     }
877     } else {
878     lang:Perl {
879     $self->{entity}->[-1]->{no_xml11_eol} = false;
880     }
881     }
882    
883     // ~ (PIC2) { }
884 wakaba 1.3 } // _XMLDeclaration_
885 wakaba 1.1
886     /*
887     Comment Declaration
888    
889     Comment := '<!--' *(Char - '-' / '-' (Char - '-'))
890     '-->' ;; [15]
891 wakaba 1.4 */
892 wakaba 1.1 rule _CommentDeclaration_ ($doc, $parent) {
893     ?lexmode 'CommentDeclaration';
894    
895     ~? (STRING) {
896     lang:Perl ($data => $token.value) {
897     my $com = $doc-><M::Document.createComment> ($data);
898     $parent-><M::Node.appendChild> ($com);
899     }
900     } else {
901     lang:Perl {
902     my $com = $doc-><M::Document.createComment> ('');
903     $parent-><M::Node.appendChild> ($com);
904     }
905     }
906    
907     ~ (COM) {
908     ?lexmode MarkupDeclaration;
909     } else {
910     ?lexmode MarkupDeclaration;
911     }
912    
913     // ~ (MDC) { }
914 wakaba 1.4 } // _CommentDeclaration
915 wakaba 1.15
916     rule _CommentDeclarationDTD {
917     ?lexmode CommentDeclaration;
918 wakaba 1.4
919     ~? (STRING) {
920     //
921     }
922    
923     ~ (COM) {
924     ?lexmode MarkupDeclaration;
925     } else {
926     ?lexmode MarkupDeclaration;
927     }
928    
929     ~ (MDC) {
930     ?lexmode DTD;
931     } else {
932     ?lexmode DTD;
933     }
934     } // _CommentDeclarationDTD
935    
936 wakaba 1.1 /*
937     Processing Instruction
938    
939     PI := '<?' PITarget [S *Char - *Char '?>' *Char]
940     '?>' ;; [16]
941     */
942     rule _ProcessingInstruction_ ($doc, $parent) {
943     ?lexmode 'PIName';
944    
945     my $pi;
946    
947     ~ (Name) {
948 wakaba 1.3 lang:Perl ($name => $token.value) : has-error {
949 wakaba 1.1 if (lc $name eq 'xml') {
950 wakaba 1.3 my $location;
951     __CODE{xp|get-location-from-token::
952     $token => {$token},
953     $result => {$location},
954     }__;
955     my $continue = __DOMCore:ERROR{xp|wf-pi-target-is-xml::
956     xp|name => {$name},
957     DOMCore|location => {$location},
958     xp|parent => {$parent},
959     }__;
960     unless ($continue) {
961     __EXCEPTION{DOMLS|PARSE_ERR::
962     }__;
963     }
964 wakaba 1.1 }
965     ## TODO: Namespace well-formedness
966     $pi = $doc-><M::Document.createProcessingInstruction>
967     ($name);
968     }
969 wakaba 1.14 } else {
970     lang:Perl {
971     $pi = $doc-><M::Document.createProcessingInstruction> ('#INVALID');
972     }
973 wakaba 1.1 }
974    
975 wakaba 1.14 ~? (S) {
976 wakaba 1.1 ?lexmode 'PIData';
977    
978     my $tdata;
979    
980     ~? (DATA) {
981     lang:Perl ($data => $token.value) {
982     $tdata = $data;
983     }
984     } else {
985     lang:Perl {
986     $tdata = '';
987     }
988     }
989    
990     lang:Perl {
991     $pi-><AS::Node.nodeValue> ($tdata);
992     }
993     }
994    
995     lang:Perl {
996     $parent-><M::Node.appendChild> ($pi);
997     }
998    
999     // ~ (PIC) { }
1000     } // _ProcessingInstruction_
1001 wakaba 1.4
1002 wakaba 1.6 /*
1003     Processing instruction in DTD
1004     */
1005     rule _ProcessingInstructionDTD ($doc, $doctype) {
1006 wakaba 1.4 ?lexmode 'PIName';
1007 wakaba 1.6
1008     my $pi;
1009 wakaba 1.4
1010     ~ (Name) {
1011 wakaba 1.6 lang:Perl ($name => $token.value) : has-error {
1012     if (lc $name eq 'xml') {
1013     my $location;
1014     __CODE{xp|get-location-from-token::
1015     $token => {$token},
1016     $result => {$location},
1017     }__;
1018     my $continue = __DOMCore:ERROR{xp|wf-pi-target-is-xml::
1019     xp|name => {$name},
1020     DOMCore|location => {$location},
1021     xp|parent => {$doctype},
1022     }__;
1023     unless ($continue) {
1024     __EXCEPTION{DOMLS|PARSE_ERR::
1025     }__;
1026     }
1027     }
1028     ## TODO: Namespace well-formedness
1029     $pi = $doc-><M::Document.createProcessingInstruction>
1030     ($name);
1031     }
1032 wakaba 1.14 } else {
1033     lang:Perl {
1034     $pi = $doc-><M::Document.createProcessingInstruction> ('#INVALID');
1035     }
1036 wakaba 1.4 }
1037    
1038 wakaba 1.14 ~? (S) {
1039 wakaba 1.4 ?lexmode 'PIData';
1040    
1041 wakaba 1.6 my $tdata;
1042    
1043 wakaba 1.4 ~? (DATA) {
1044 wakaba 1.6 lang:Perl ($data => $token.value) {
1045     $tdata = $data;
1046     }
1047     } else {
1048     lang:Perl {
1049     $tdata = '';
1050     }
1051     }
1052    
1053     lang:Perl {
1054     $pi-><AS::Node.nodeValue> ($tdata);
1055 wakaba 1.4 }
1056     }
1057    
1058 wakaba 1.6 lang:Perl {
1059     $doctype-><M::Node.appendChild> ($pi);
1060     }
1061    
1062 wakaba 1.4 ~ (PIC) {
1063     ?lexmode DTD;
1064     } else {
1065     ?lexmode DTD;
1066     }
1067     } // _ProcessingInstructionDTD
1068 wakaba 1.1
1069     /*
1070     Element content parsing mode
1071    
1072     element := EmptyElemTag /
1073     STag content ETag ;; [39]
1074     content := (CharData / element / Reference / CDSect /
1075     PI / Comment) ;; [43]
1076     */
1077 wakaba 1.6 rule Element_ ($doc, $parent, $ns) : standalone {
1078 wakaba 1.1 ?lexmode 'ElementContent';
1079    
1080     my $node; // Current "parent" node
1081     my $nodes; // Node stack (w/o $current_node)
1082     my $type; // Current "parent" element type QName
1083     my $types; // Element type stack (w/o $current_type)
1084 wakaba 1.6 //my $ns; // Current in-scope namespace bindings
1085 wakaba 1.1 my $nses; // Namespace binding stack (w/o $current_ns)
1086    
1087     lang:Perl {
1088     $node = $parent;
1089     $nodes = [];
1090     $type = '';
1091     $types = [];
1092 wakaba 1.6 $ns ||= {
1093 wakaba 1.1 xml => <Q::xml:>,
1094     xmlns => <Q::xmlns:>,
1095     };
1096     $nses = [];
1097     }
1098    
1099     ~* : name => CONTENT
1100     (CharData) {
1101     // Character data
1102     lang:Perl ($data => $token.value) {
1103     $node-><M::Node.appendChild>
1104     ($doc-><M::Document.createTextNode> ($data));
1105     }
1106     } (STAGO) {
1107     // Start tag or empty element tag
1108    
1109     ?lexmode 'StartTag';
1110    
1111     ~ (Name) {
1112     my $attrs;
1113     lang:Perl ($name => $token.value) {
1114     push @{$types}, $type;
1115     $type = $name;
1116     $attrs = {};
1117     }
1118    
1119     ~? (S) {
1120     &AttributeSpecificationList
1121     ($doc => $doc, $attrs => $attrs);
1122     }
1123    
1124     my $el;
1125 wakaba 1.9
1126     /*
1127     Note that this implementation does not perform
1128     attribute value tokenization (but does white space
1129     normalization common to attribute types) and
1130     construct the tree as is. DOM Level 3 Core spec
1131     is unclear on this point. With tokenization,
1132     entity references cannot be preserved.
1133    
1134     The manakai Node.nodeValue and Attr.value attributes
1135     do tokenization according to attribute types.
1136     */
1137    
1138     /*
1139     ISSUE: Should |xml:id| attribute be typed?
1140     */
1141 wakaba 1.1
1142     lang:Perl {
1143     push @{$nses}, $ns;
1144     $ns = {%$ns};
1145    
1146     my %gattr;
1147     my %lattr;
1148     for my $atqname (keys %$attrs) {
1149     my ($pfx, $lname) = split /:/, $atqname;
1150 wakaba 1.9 $attrs->{$atqname}->{def} = $self->{attr}->{$type}->{$atqname};
1151 wakaba 1.1 if (defined $lname) { ## Global attribute
1152     ## TODO: Namespace well-formedness (lname is NCName)
1153     if ($pfx eq 'xmlns') {
1154     my $nsuri = $attrs->{$atqname}->{value};
1155     if ($lname eq 'xml' and
1156     $nsuri ne <Q::xml:>) {
1157     ## TODO: error
1158     } elsif ($lname eq 'xmlns') {
1159     ## TODO: error
1160     }
1161     if ($nsuri eq '') {
1162     ## TODO: error in XML 1.0
1163     } elsif ($nsuri eq <Q::xml:> and
1164     $lname ne 'xml') {
1165     ## TODO: error
1166     } elsif ($nsuri eq <Q::xmlns:>) {
1167     ## TODO: error
1168     }
1169     $ns->{$lname} = $attrs->{$atqname}->{value};
1170 wakaba 1.9 if ($attrs->{$atqname}->{def}) {
1171     my $dt = $attrs->{$atqname}->{def}-><AG::ATDef.declaredType>;
1172     if ({
1173     <C::ATDef.ID_ATTR> => true,
1174     <C::ATDef.IDREF_ATTR> => true,
1175     <C::ATDef.IDREFS_ATTR> => true,
1176     <C::ATDef.ENTITY_ATTR> => true,
1177     <C::ATDef.ENTITIES_ATTR> => true,
1178     <C::ATDef.NMTOKEN_ATTR> => true,
1179     <C::ATDef.NMTOKENS_ATTR> => true,
1180     <C::ATDef.NOTATION_ATTR> => true,
1181     <C::ATDef.ENUMERATION_ATTR> => true,
1182     }->{$dt}) {
1183     ## Tokenization (XML 1 3.3.3)
1184     for ($ns->{$lname}) {
1185     s/^\x20+//;
1186     s/\x20+\z//;
1187     s/\x20+/ /g;
1188     }
1189     }
1190     }
1191 wakaba 1.1 delete $ns->{$lname} unless length $ns->{$lname};
1192     } elsif ($pfx eq '') {
1193     ## TODO: pfx is not NCName error
1194     } else {
1195     if ($gattr{$pfx}->{$lname}) {
1196     ## TODO: Namespace well-formedness error
1197     }
1198     }
1199     $gattr{$pfx}->{$lname} = $attrs->{$atqname};
1200     } else { ## Local attribute
1201     if ($pfx eq 'xmlns') {
1202     $ns->{''} = $attrs->{xmlns}->{value};
1203 wakaba 1.9 if ($attrs->{$atqname}->{def}) {
1204     my $dt = $attrs->{$atqname}->{def}-><AG::ATDef.declaredType>;
1205     if ({
1206     <C::ATDef.ID_ATTR> => true,
1207     <C::ATDef.IDREF_ATTR> => true,
1208     <C::ATDef.IDREFS_ATTR> => true,
1209     <C::ATDef.ENTITY_ATTR> => true,
1210     <C::ATDef.ENTITIES_ATTR> => true,
1211     <C::ATDef.NMTOKEN_ATTR> => true,
1212     <C::ATDef.NMTOKENS_ATTR> => true,
1213     <C::ATDef.NOTATION_ATTR> => true,
1214     <C::ATDef.ENUMERATION_ATTR> => true,
1215     }->{$dt}) {
1216     ## Tokenization (XML 1 3.3.3)
1217     for ($ns->{''}) {
1218     s/^\x20+//;
1219     s/\x20+\z//;
1220     s/\x20+/ /g;
1221     }
1222     }
1223     }
1224 wakaba 1.1 delete $ns->{''} unless length $ns->{''};
1225     } else {
1226     $lattr{$pfx} = $attrs->{$atqname};
1227     }
1228     }
1229     }
1230    
1231     my ($pfx, $lname) = split /:/, $type;
1232     my $nsuri;
1233     ## TODO: lname is NCName?
1234     if (defined $lname) { ## Prefixed namespace
1235     if ($pfx eq '') {
1236     ## TODO: pfx is not NCName error
1237     }
1238     if (defined $ns->{$pfx}) {
1239     $nsuri = $ns->{$pfx};
1240     } else {
1241     ## TODO: namespace ill-formed
1242     }
1243     } else { ## Default namespace
1244     $nsuri = $ns->{''};
1245     }
1246    
1247     $el = $doc-><M::Document.createElementNS>
1248     ($nsuri, $type);
1249    
1250     if ($attrs->{xmlns}) {
1251     my $attr = $doc-><M::Document.createAttributeNS>
1252     (<Q::xmlns:>, 'xmlns');
1253     for (@{$attrs->{xmlns}->{nodes}}) {
1254     $attr-><M::Node.appendChild> ($_);
1255     }
1256 wakaba 1.9 if ($attrs->{xmlns}->{def}) {
1257     __CODE{t|setAttrType::
1258     $attr => $attr,
1259     $type => {$attrs->{xmlns}->{def}-><AG::ATDef.declaredType>},
1260     }__;
1261     }
1262 wakaba 1.1 $el-><M::Element.setAttributeNodeNS> ($attr);
1263     }
1264    
1265     for my $lname (keys %lattr) {
1266     my $attr = $doc-><M::Document.createAttributeNS>
1267     (null, $lname);
1268     for (@{$lattr{$lname}->{nodes}}) {
1269     $attr-><M::Node.appendChild> ($_);
1270     }
1271 wakaba 1.9 if ($attrs->{$lname}->{def}) {
1272     __CODE{t|setAttrType::
1273     $attr => $attr,
1274     $type => {$attrs->{$lname}->{def}-><AG::ATDef.declaredType>},
1275     }__;
1276     }
1277 wakaba 1.1 $el-><M::Element.setAttributeNodeNS> ($attr);
1278     }
1279    
1280     for my $pfx (keys %gattr) {
1281     for my $lname (keys %{$gattr{$pfx}}) {
1282     my $attr = $doc-><M::Document.createAttributeNS>
1283     ($ns->{$pfx}, $pfx.':'.$lname);
1284     for (@{$gattr{$pfx}->{$lname}->{nodes}}) {
1285     $attr-><M::Node.appendChild> ($_);
1286     }
1287 wakaba 1.9 if ($attrs->{$pfx}->{$lname}->{def}) {
1288     __CODE{t|setAttrType::
1289     $attr => $attr,
1290     $type => {$attrs->{$pfx}->{$lname}
1291     ->{def}-><AG::ATDef.declaredType>},
1292     }__;
1293     }
1294 wakaba 1.1 $el-><M::Element.setAttributeNodeNS> ($attr);
1295     }
1296     }
1297    
1298     $node-><M::Node.appendChild> ($el);
1299     }
1300    
1301     ~ (TAGC) {
1302     lang:Perl {
1303     push @{$nodes}, $node;
1304     $node = $el;
1305     }
1306     ?lexmode ElementContent;
1307 wakaba 1.6 } (NESTC) {
1308     my $is_docel;
1309 wakaba 1.1 lang:Perl {
1310     $ns = pop @{$nses};
1311     $type = pop @{$types};
1312 wakaba 1.6 $is_docel = (@{$types} == 0);
1313     }
1314    
1315     if-true ($is_docel) {
1316     return;
1317     }
1318    
1319     ~ (TAGC) {
1320     ?lexmode ElementContent;
1321     } else {
1322     ?lexmode ElementContent;
1323 wakaba 1.1 }
1324     } else {
1325     ?lexmode ElementContent;
1326     }
1327     } else {
1328     ?lexmode ElementContent;
1329     }
1330    
1331     } (ETAGO) {
1332     // End tag
1333    
1334     ?lexmode 'EndTag';
1335    
1336     my $is_docel;
1337    
1338     ~ (Name) {
1339 wakaba 1.3 lang:Perl ($name => $token.value) : has-error {
1340 wakaba 1.1 if ($name eq $type) {
1341     $type = pop @{$types};
1342     if ($type eq '') {
1343     $is_docel = true;
1344     }
1345     $node = pop @{$nodes};
1346     $ns = pop @{$nses};
1347     } else {
1348 wakaba 1.3 my $location;
1349     __CODE{xp|get-location-from-token::
1350     $token => $token,
1351     $result => $location,
1352     }__;
1353     my $continue = __DOMCore:ERROR{xp|wf-element-type-match::
1354     DOMCore:location => {$location},
1355     xp|token => {$token},
1356     xp|expected-element-type => {$type},
1357     xp|actual-element-type => {$name},
1358     xp|node => {$node},
1359     }__;
1360     unless ($continue) {
1361     __EXCEPTION{DOMLS|PARSE_ERR}__;
1362     }
1363 wakaba 1.1 }
1364     }
1365     }
1366    
1367     ~? (S) { }
1368    
1369     if-true ($is_docel) {
1370 wakaba 1.3 lang:Perl : has-error {
1371 wakaba 1.1 if (@{$types}) {
1372 wakaba 1.3 my $location;
1373     __CODE{xp|get-location-from-token::
1374     $token => $token,
1375     $result => $location,
1376     }__;
1377     for my $type (reverse @{$types}) {
1378     my $continue = __DOMCore:ERROR{xp|wf-no-end-tag::
1379     DOMCore:location => {$location},
1380     xp|token => {$token},
1381     xp|expected-element-type => {$type},
1382     xp|node => {$node},
1383     }__;
1384     unless ($continue) {
1385     __EXCEPTION{DOMLS|PARSE_ERR}__;
1386     }
1387     $node = shift @{$nodes};
1388     }
1389 wakaba 1.1 }
1390     }
1391     return;
1392     }
1393    
1394     ~ (TAGC) {
1395     ?lexmode ElementContent;
1396     } else {
1397     ?lexmode 'ElementContent';
1398     }
1399    
1400     } (HCRO) {
1401     &_HexadecimalCharacterReference_
1402     ($doc => $doc, $parent => $node);
1403    
1404     ~ (REFC) {
1405     ?lexmode 'ElementContent';
1406     } else {
1407     ?lexmode ElementContent;
1408     }
1409     } (CRO) {
1410     &_NumericCharacterReference_
1411     ($doc => $doc, $parent => $node);
1412    
1413     ~ (REFC) {
1414     ?lexmode 'ElementContent';
1415     } else {
1416     ?lexmode ElementContent;
1417     }
1418     } (ERO) {
1419 wakaba 1.6 &_GeneralEntityReferenceEC
1420     ($doc => $doc, $parent => $node, $ns => $ns);
1421 wakaba 1.1 } (CDO) {
1422     &_CommentDeclaration_ ($doc => $doc, $parent => $node);
1423    
1424     ~ (MDC) {
1425     ?lexmode ElementContent;
1426     } else {
1427     ?lexmode ElementContent;
1428     }
1429     } (CDSO) {
1430     &_CDATASection_ ($doc => $doc, $parent => $node);
1431    
1432     ~ (MSE) {
1433     ?lexmode 'ElementContent';
1434     } else {
1435     ?lexmode ElementContent;
1436     }
1437     } (PIO) {
1438     &_ProcessingInstruction_ ($doc => $doc, $parent => $node);
1439    
1440     ~ (PIC) {
1441     ?lexmode 'ElementContent';
1442     } else {
1443     ?lexmode ElementContent;
1444     }
1445     }
1446 wakaba 1.3
1447     ~ (#NONE) { }
1448 wakaba 1.1 } // Element_
1449 wakaba 1.11
1450     /*
1451     content := [CharData]
1452     *((element / Reference / CDSect / PI / Comment) [CharData])
1453     */
1454     rule content ($parent, $ns) {
1455     // ?lexmode ElementContent;
1456    
1457     my $doc;
1458     lang:Perl {
1459     $doc = $self->{doc};
1460     }
1461    
1462     ~* (CharData) {
1463     lang:Perl ($data => $token.value) {
1464     $parent-><M::Node.appendChild>
1465     ($self->{doc}-><M::Document.createTextNode> ($data));
1466     }
1467     } (STAGO) {
1468     &Element_ ($doc => $doc, $parent => $parent, $ns => $ns)
1469     : unshift-current-token;
1470     ~ (TAGC) {
1471     ?lexmode ElementContent;
1472     } else {
1473     ?lexmode ElementContent;
1474     }
1475     } (HCRO) {
1476     &_HexadecimalCharacterReference_
1477     ($doc => $doc, $parent => $parent);
1478    
1479     ~ (REFC) {
1480     ?lexmode 'ElementContent';
1481     } else {
1482     ?lexmode ElementContent;
1483     }
1484     } (CRO) {
1485     &_NumericCharacterReference_
1486     ($doc => $doc, $parent => $parent);
1487    
1488     ~ (REFC) {
1489     ?lexmode 'ElementContent';
1490     } else {
1491     ?lexmode ElementContent;
1492     }
1493     } (ERO) {
1494     &_GeneralEntityReferenceEC
1495     ($doc => $doc, $parent => $parent, $ns => $ns);
1496     } (CDO) {
1497     &_CommentDeclaration_ ($doc => $doc, $parent => $parent);
1498    
1499     ~ (MDC) {
1500     ?lexmode ElementContent;
1501     } else {
1502     ?lexmode ElementContent;
1503     }
1504     } (CDSO) {
1505     &_CDATASection_ ($doc => $doc, $parent => $parent);
1506    
1507     ~ (MSE) {
1508     ?lexmode 'ElementContent';
1509     } else {
1510     ?lexmode ElementContent;
1511     }
1512     } (PIO) {
1513     &_ProcessingInstruction_ ($doc => $doc, $parent => $parent);
1514    
1515     ~ (PIC) {
1516     ?lexmode 'ElementContent';
1517     } else {
1518     ?lexmode ElementContent;
1519     }
1520     }
1521     } // content
1522 wakaba 1.1
1523     rule AttributeSpecificationList ($doc, $attrs)
1524     : standalone
1525     {
1526     ?lexmode 'StartTag';
1527    
1528     my $i;
1529     lang:Perl {
1530     $i = 0;
1531     }
1532    
1533     ~* (Name) {
1534     my $atqname;
1535     lang:Perl ($name => $token.value) {
1536     $atqname = $name;
1537     }
1538    
1539     my $vals;
1540 wakaba 1.18 lang:Perl : has-error {
1541 wakaba 1.1 if ($attrs->{$atqname}) {
1542 wakaba 1.3 my $location;
1543     __CODE{xp|get-location-from-token::
1544     $token => $token,
1545     $result => $location,
1546     }__;
1547     my $continue = __DOMCore:ERROR{xp|wf-unique-att-spec::
1548     DOMCore:location => {$location},
1549     xp|token => {$token},
1550     xp|name => {$atqname},
1551     }__;
1552     unless ($continue) {
1553     __EXCEPTION{DOMLS|PARSE_ERR}__;
1554     }
1555 wakaba 1.1 }
1556    
1557     $vals = $attrs->{$atqname} = {
1558     nodes => [],
1559     value => '',
1560     index => $i++,
1561     };
1562     }
1563 wakaba 1.3
1564     ~? (S) { }
1565     ~ (VI) { }
1566     ~? (S) { }
1567 wakaba 1.1
1568     ~ (LIT) {
1569     &_AttributeValueSpecification_
1570     ($doc => $doc, $vals => $vals);
1571    
1572     ~ (LIT) {
1573     ?lexmode StartTag;
1574     } else {
1575     ?lexmode StartTag;
1576     }
1577     } (LITA) {
1578     &_AttributeValueSpecificationA_
1579     ($doc => $doc, $vals => $vals);
1580    
1581     ~ (LITA) {
1582     ?lexmode StartTag;
1583     } else {
1584     ?lexmode StartTag;
1585     }
1586     }
1587     } (S) : separator : terminator? { }
1588     } // AttributeSpecificationList
1589    
1590     rule _AttributeValueSpecification_ ($doc, $vals) {
1591     // ~ (LIT) { }
1592     ?lexmode 'AttributeValueLiteral';
1593    
1594     ~* (STRING) {
1595     lang:Perl ($value => $token.value) {
1596     $value =~ s/[\x09\x0A\x0D]/ /g;
1597     my $text = $doc-><M::Document.createTextNode> ($value);
1598     push @{$vals->{nodes}}, $text;
1599     $vals->{value} .= $value;
1600     }
1601     } (HCRO) {
1602     &_HexadecimalCharacterReferenceV_
1603     ($doc => $doc, $vals => $vals);
1604    
1605     ~ (REFC) {
1606     ?lexmode AttributeValueLiteral;
1607     } else {
1608     ?lexmode AttributeValueLiteral;
1609     }
1610     } (CRO) {
1611     &_NumericCharacterReferenceV_
1612     ($doc => $doc, $vals => $vals);
1613    
1614     ~ (REFC) {
1615     ?lexmode AttributeValueLiteral;
1616     } else {
1617     ?lexmode AttributeValueLiteral;
1618     }
1619     } (ERO) {
1620     // TODO: Attribute value normalization
1621     &_GeneralEntityReferenceV_
1622     ($doc => $doc, $vals => $vals);
1623    
1624     ~ (REFC) {
1625     ?lexmode AttributeValueLiteral;
1626     } else {
1627     ?lexmode AttributeValueLiteral;
1628     }
1629     }
1630    
1631     // ~ (LIT) { } (LITA) { }
1632     } // _AttributeValueSpecification_
1633    
1634     rule _AttributeValueSpecificationA_ ($doc, $vals) {
1635     // ~ (LITA) { }
1636     ?lexmode 'AttributeValueLiteralA';
1637    
1638     ~* (STRING) {
1639     lang:Perl ($value => $token.value) {
1640     $value =~ s/[\x09\x0A\x0D]/ /g;
1641     my $text = $doc-><M::Document.createTextNode> ($value);
1642     push @{$vals->{nodes}}, $text;
1643     $vals->{value} .= $value;
1644     }
1645     } (HCRO) {
1646     &_HexadecimalCharacterReferenceV_
1647     ($doc => $doc, $vals => $vals);
1648    
1649     ~ (REFC) {
1650     ?lexmode AttributeValueLiteralA;
1651     } else {
1652     ?lexmode AttributeValueLiteralA;
1653     }
1654     } (CRO) {
1655     &_NumericCharacterReferenceV_
1656     ($doc => $doc, $vals => $vals);
1657    
1658     ~ (REFC) {
1659     ?lexmode AttributeValueLiteralA;
1660     } else {
1661     ?lexmode AttributeValueLiteralA;
1662     }
1663     } (ERO) {
1664     // TODO: Attribute value normalization
1665     &_GeneralEntityReferenceV_
1666     ($doc => $doc, $vals => $vals);
1667    
1668     ~ (REFC) {
1669     ?lexmode AttributeValueLiteralA;
1670     } else {
1671     ?lexmode AttributeValueLiteralA;
1672     }
1673     }
1674    
1675     // ~ (LITA) { }
1676     } // _AttributeValueSpecificationA_
1677    
1678     /*
1679 wakaba 1.11 Parsing replacement text of an entity referenced in
1680     an attribute value specification.
1681     */
1682     rule AttributeValueLiteralE_ ($parent, $vals)
1683     : recursive
1684     {
1685     // ?lexmode AttributeValueLiteralE;
1686    
1687     ~* (STRING) {
1688     lang:Perl ($value => $token.value) {
1689     $value =~ s/[\x09\x0A\x0D]/ /g;
1690     my $text = $self->{doc}-><M::Document.createTextNode> ($value);
1691     $parent-><M::Node.appendChild> ($text);
1692     $vals->{value} .= $value;
1693     }
1694     } (HCRO) {
1695     &_HexadecimalCharacterReferenceAE_
1696     ($parent => $parent, $vals => $vals);
1697    
1698     ~ (REFC) {
1699     ?lexmode AttributeValueLiteralE;
1700     } else {
1701     ?lexmode AttributeValueLiteralE;
1702     }
1703     } (CRO) {
1704     &_NumericCharacterReferenceAE_
1705     ($parent => $parent, $vals => $vals);
1706    
1707     ~ (REFC) {
1708     ?lexmode AttributeValueLiteralE;
1709     } else {
1710     ?lexmode AttributeValueLiteralE;
1711     }
1712     } (ERO) {
1713     &_GeneralEntityReferenceAE_ ($parent => $parent, $vals => $vals);
1714    
1715     ~ (REFC) {
1716     ?lexmode AttributeValueLiteralE;
1717     } else {
1718     ?lexmode AttributeValueLiteralE;
1719     }
1720 wakaba 1.18 } (#INVALID == '<') {
1721     lang:Perl : has-error {
1722     my $location;
1723     __CODE{xp|get-location-from-token::
1724     $token => $token,
1725     $result => $location,
1726     }__;
1727     my $continue = __DOMCore:ERROR{xp|wf-no-lt-in-attribute-values::
1728     c|location => {$location},
1729     xp|token => {$token},
1730     }__;
1731     unless ($continue) {
1732     __EXCEPTION{DOMLS|PARSE_ERR}__;
1733     }
1734    
1735     my $text = $self->{doc}-><M::Document.createTextNode> ('<');
1736     $parent-><M::Node.appendChild> ($text);
1737     $vals->{value} .= '<';
1738     }
1739 wakaba 1.11 }
1740    
1741     // ~ (#EOF) { }
1742     } // AttributeValueLiteralE_
1743    
1744     /*
1745 wakaba 1.1 CDATA Section Content Parsing Mode
1746     */
1747     rule _CDATASection_ ($doc, $parent) {
1748     ?lexmode 'CDATASectionContent';
1749    
1750     my $cdata;
1751    
1752 wakaba 1.2 ~? (CData) {
1753 wakaba 1.1 lang:Perl ($data => $token.value) {
1754     $cdata = $data;
1755     }
1756     } else {
1757     lang:Perl {
1758     $cdata = '';
1759     }
1760     }
1761    
1762     lang:Perl {
1763     my $cdsect = $doc-><M::Document.createCDATASection>
1764     ($cdata);
1765     $parent-><M::Node.appendChild> ($cdsect);
1766     }
1767    
1768     // ~ (MSE) { }
1769     } // _CDATASection_
1770    
1771     rule _NumericCharacterReference_ ($doc, $parent) {
1772     ?lexmode 'NumericCharacterReference';
1773    
1774     ~ (NUMBER) {
1775 wakaba 1.3 lang:Perl ($num => $token.value) : has-error {
1776     $num += 0;
1777     unless (
1778     ($self->{xml_version} eq '1.0' and
1779     ((0x0020 <= $num and $num <= 0xD7FF) or
1780     (0xE000 <= $num and $num <= 0xFFFD) or
1781     (0x10000 <= $num and $num <= 0x10FFFF) or
1782     $num == 0x9 or $num == 0xA or $num == 0xD)) or
1783     ($self->{xml_version} eq '1.1' and
1784     ((0x0001 <= $num and $num <= 0xD7FF) or
1785     (0xE000 <= $num and $num <= 0xFFFD) or
1786     (0x10000 <= $num and $num <= 0x10FFFF)))
1787     ) {
1788     my $location;
1789     __CODE{xp|get-location-from-token::
1790     $token => $token,
1791     $result => $location,
1792     }__;
1793     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
1794     DOMCore:location => {$location},
1795     xp|token => {$token},
1796     xp|character-number => {$num},
1797     xp|parent => {$parent},
1798     }__;
1799     unless ($continue) {
1800     __EXCEPTION{DOMLS|PARSE_ERR}__;
1801     }
1802     }
1803     my $ncr = $doc-><M::Document.createTextNode> (chr $num);
1804 wakaba 1.1 $parent-><M::Node.appendChild> ($ncr);
1805     }
1806     }
1807    
1808     // ~ (REFC) { }
1809     } // _NumericCharacterReference_
1810    
1811     rule _NumericCharacterReferenceV_ ($doc, $vals) {
1812     ?lexmode 'NumericCharacterReference';
1813    
1814     ~ (NUMBER) {
1815 wakaba 1.3 lang:Perl ($num => $token.value) : has-error {
1816     $num += 0;
1817     unless (
1818     ($self->{xml_version} eq '1.0' and
1819     ((0x0020 <= $num and $num <= 0xD7FF) or
1820     (0xE000 <= $num and $num <= 0xFFFD) or
1821     (0x10000 <= $num and $num <= 0x10FFFF) or
1822     $num == 0x9 or $num == 0xA or $num == 0xD)) or
1823     ($self->{xml_version} eq '1.1' and
1824     ((0x0001 <= $num and $num <= 0xD7FF) or
1825     (0xE000 <= $num and $num <= 0xFFFD) or
1826     (0x10000 <= $num and $num <= 0x10FFFF)))
1827     ) {
1828     my $location;
1829     __CODE{xp|get-location-from-token::
1830     $token => $token,
1831     $result => $location,
1832     }__;
1833     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
1834     DOMCore:location => {$location},
1835     xp|token => {$token},
1836     xp|character-number => {$num},
1837     }__;
1838     unless ($continue) {
1839     __EXCEPTION{DOMLS|PARSE_ERR}__;
1840     }
1841     }
1842 wakaba 1.1 my $ncr = $doc-><M::Document.createTextNode>
1843 wakaba 1.9 (my $char = chr $num);
1844 wakaba 1.1 push @{$vals->{nodes}}, $ncr;
1845     $vals->{value} .= $char;
1846     }
1847     }
1848    
1849     // ~ (REFC) { }
1850     } // _NumericCharacterReferenceV_
1851    
1852 wakaba 1.11 /*
1853     Numeric character reference in the replacement text
1854     of the entity referenced in an attribute value specification
1855     */
1856     rule _NumericCharacterReferenceAE_ ($parent, $vals)
1857     {
1858     ?lexmode NumericCharacterReference;
1859    
1860     ~ (NUMBER) {
1861     lang:Perl ($num => $token.value) : has-error {
1862     $num += 0;
1863     unless (
1864     ($self->{xml_version} eq '1.0' and
1865     ((0x0020 <= $num and $num <= 0xD7FF) or
1866     (0xE000 <= $num and $num <= 0xFFFD) or
1867     (0x10000 <= $num and $num <= 0x10FFFF) or
1868     $num == 0x9 or $num == 0xA or $num == 0xD)) or
1869     ($self->{xml_version} eq '1.1' and
1870     ((0x0001 <= $num and $num <= 0xD7FF) or
1871     (0xE000 <= $num and $num <= 0xFFFD) or
1872     (0x10000 <= $num and $num <= 0x10FFFF)))
1873     ) {
1874     my $location;
1875     __CODE{xp|get-location-from-token::
1876     $token => $token,
1877     $result => $location,
1878     }__;
1879     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
1880     DOMCore:location => {$location},
1881     xp|token => {$token},
1882     xp|character-number => {$num},
1883     }__;
1884     unless ($continue) {
1885     __EXCEPTION{DOMLS|PARSE_ERR}__;
1886     }
1887     }
1888     my $ncr = $self->{doc}-><M::Document.createTextNode>
1889     (my $char = chr $num);
1890     $parent-><M::Node.appendChild> ($ncr);
1891     $vals->{value} .= $char;
1892     }
1893     }
1894    
1895     // ~ (REFC) { }
1896     } // _NumericCharacterReferenceAE_
1897    
1898     rule _NumericCharacterReferenceEV_ ($vals)
1899     {
1900     ?lexmode 'NumericCharacterReference';
1901    
1902     ~ (NUMBER) {
1903     lang:Perl ($num => $token.value) : has-error {
1904     $num += 0;
1905     unless (
1906     ($self->{xml_version} eq '1.0' and
1907     ((0x0020 <= $num and $num <= 0xD7FF) or
1908     (0xE000 <= $num and $num <= 0xFFFD) or
1909     (0x10000 <= $num and $num <= 0x10FFFF) or
1910     $num == 0x9 or $num == 0xA or $num == 0xD)) or
1911     ($self->{xml_version} eq '1.1' and
1912     ((0x0001 <= $num and $num <= 0xD7FF) or
1913     (0xE000 <= $num and $num <= 0xFFFD) or
1914     (0x10000 <= $num and $num <= 0x10FFFF)))
1915     ) {
1916     my $location;
1917     __CODE{xp|get-location-from-token::
1918     $token => $token,
1919     $result => $location,
1920     }__;
1921     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
1922     DOMCore:location => {$location},
1923     xp|token => {$token},
1924     xp|character-number => {$num},
1925     }__;
1926     unless ($continue) {
1927     __EXCEPTION{DOMLS|PARSE_ERR}__;
1928     }
1929     }
1930     push @{$vals}, chr $num;
1931     }
1932     }
1933    
1934     // ~ (REFC) { }
1935     } // _NumericCharacterReferenceEV_
1936    
1937 wakaba 1.1 rule _HexadecimalCharacterReference_ ($doc, $parent) {
1938     ?lexmode 'HexadecimalCharacterReference';
1939    
1940     ~ (Hex) {
1941 wakaba 1.9 lang:Perl ($v => $token.value) : has-error {
1942     my $num = hex $v;
1943 wakaba 1.3 unless (
1944     ($self->{xml_version} eq '1.0' and
1945     ((0x0020 <= $num and $num <= 0xD7FF) or
1946     (0xE000 <= $num and $num <= 0xFFFD) or
1947     (0x10000 <= $num and $num <= 0x10FFFF) or
1948     $num == 0x9 or $num == 0xA or $num == 0xD)) or
1949     ($self->{xml_version} eq '1.1' and
1950     ((0x0001 <= $num and $num <= 0xD7FF) or
1951     (0xE000 <= $num and $num <= 0xFFFD) or
1952     (0x10000 <= $num and $num <= 0x10FFFF)))
1953     ) {
1954     my $location;
1955     __CODE{xp|get-location-from-token::
1956     $token => $token,
1957     $result => $location,
1958     }__;
1959     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
1960     DOMCore:location => {$location},
1961     xp|token => {$token},
1962     xp|character-number => {$num},
1963     xp|parent => {$parent},
1964     }__;
1965     unless ($continue) {
1966     __EXCEPTION{DOMLS|PARSE_ERR}__;
1967     }
1968     }
1969 wakaba 1.1 my $ncr = $doc-><M::Document.createTextNode>
1970 wakaba 1.9 (chr $num);
1971 wakaba 1.1 $parent-><M::Node.appendChild> ($ncr);
1972     }
1973     }
1974    
1975     // ~ (REFC) { }
1976     } // _HexadecimalCharacterReference_
1977    
1978 wakaba 1.3 rule _HexadecimalCharacterReferenceV_ ($doc, $vals) {
1979 wakaba 1.1 ?lexmode 'HexadecimalCharacterReference';
1980    
1981     ~ (Hex) {
1982 wakaba 1.9 lang:Perl ($v => $token.value) : has-error {
1983     my $num = hex $v;
1984 wakaba 1.3 unless (
1985     ($self->{xml_version} eq '1.0' and
1986     ((0x0020 <= $num and $num <= 0xD7FF) or
1987     (0xE000 <= $num and $num <= 0xFFFD) or
1988     (0x10000 <= $num and $num <= 0x10FFFF) or
1989     $num == 0x9 or $num == 0xA or $num == 0xD)) or
1990     ($self->{xml_version} eq '1.1' and
1991     ((0x0001 <= $num and $num <= 0xD7FF) or
1992     (0xE000 <= $num and $num <= 0xFFFD) or
1993     (0x10000 <= $num and $num <= 0x10FFFF)))
1994     ) {
1995     my $location;
1996     __CODE{xp|get-location-from-token::
1997     $token => $token,
1998     $result => $location,
1999     }__;
2000     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2001     DOMCore:location => {$location},
2002     xp|token => {$token},
2003     xp|character-number => {$num},
2004     }__;
2005     unless ($continue) {
2006     __EXCEPTION{DOMLS|PARSE_ERR}__;
2007     }
2008     }
2009 wakaba 1.1 my $ncr = $doc-><M::Document.createTextNode>
2010 wakaba 1.9 (my $char = chr $num);
2011 wakaba 1.1 push @{$vals->{nodes}}, $ncr;
2012     $vals->{value} .= $char;
2013     }
2014     }
2015    
2016     // ~ (REFC) { }
2017 wakaba 1.11 } // _HexadecimalCharacterReferenceV_
2018    
2019     /*
2020     Hexadecimal character reference in the replacement text
2021     of the entity referenced in an attribute value literal
2022     */
2023     rule _HexadecimalCharacterReferenceAE_ ($parent, $vals)
2024     {
2025     ?lexmode HexadecimalCharacterReference;
2026    
2027     ~ (Hex) {
2028     lang:Perl ($v => $token.value) : has-error {
2029     my $num = hex $v;
2030     unless (
2031     ($self->{xml_version} eq '1.0' and
2032     ((0x0020 <= $num and $num <= 0xD7FF) or
2033     (0xE000 <= $num and $num <= 0xFFFD) or
2034     (0x10000 <= $num and $num <= 0x10FFFF) or
2035     $num == 0x9 or $num == 0xA or $num == 0xD)) or
2036     ($self->{xml_version} eq '1.1' and
2037     ((0x0001 <= $num and $num <= 0xD7FF) or
2038     (0xE000 <= $num and $num <= 0xFFFD) or
2039     (0x10000 <= $num and $num <= 0x10FFFF)))
2040     ) {
2041     my $location;
2042     __CODE{xp|get-location-from-token::
2043     $token => $token,
2044     $result => $location,
2045     }__;
2046     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2047     DOMCore:location => {$location},
2048     xp|token => {$token},
2049     xp|character-number => {$num},
2050     }__;
2051     unless ($continue) {
2052     __EXCEPTION{DOMLS|PARSE_ERR}__;
2053     }
2054     }
2055     my $ncr = $self->{doc}-><M::Document.createTextNode>
2056     (my $char = chr $num);
2057     $parent-><M::Node.appendChild> ($ncr);
2058     $vals->{value} .= $char;
2059     }
2060     }
2061    
2062     // ~ (REFC) { }
2063     } // _HexadecimalCharacterReferenceAE_
2064    
2065     rule _HexadecimalCharacterReferenceEV_ ($vals) {
2066     ?lexmode HexadecimalCharacterReference;
2067    
2068     ~ (Hex) {
2069     lang:Perl ($v => $token.value) : has-error {
2070     my $num = hex $v;
2071     unless (
2072     ($self->{xml_version} eq '1.0' and
2073     ((0x0020 <= $num and $num <= 0xD7FF) or
2074     (0xE000 <= $num and $num <= 0xFFFD) or
2075     (0x10000 <= $num and $num <= 0x10FFFF) or
2076     $num == 0x9 or $num == 0xA or $num == 0xD)) or
2077     ($self->{xml_version} eq '1.1' and
2078     ((0x0001 <= $num and $num <= 0xD7FF) or
2079     (0xE000 <= $num and $num <= 0xFFFD) or
2080     (0x10000 <= $num and $num <= 0x10FFFF)))
2081     ) {
2082     my $location;
2083     __CODE{xp|get-location-from-token::
2084     $token => $token,
2085     $result => $location,
2086     }__;
2087     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2088     DOMCore:location => {$location},
2089     xp|token => {$token},
2090     xp|character-number => {$num},
2091     }__;
2092     unless ($continue) {
2093     __EXCEPTION{DOMLS|PARSE_ERR}__;
2094     }
2095     }
2096     push @{$vals}, chr $num;
2097     }
2098     }
2099    
2100     // ~ (REFC) { }
2101     } // _HexadecimalCharacterReferenceEV_
2102    
2103     /*
2104     General entity reference in element's content
2105     */
2106     rule _GeneralEntityReferenceEC ($doc, $parent, $ns)
2107     : recursive
2108     {
2109     ?lexmode 'EntityReference';
2110    
2111     ~ (Name == 'lt') {
2112     lang:Perl {
2113     $parent-><M::Node.appendChild>
2114     ($self->{doc}-><M::Document.createTextNode> ('<'));
2115     }
2116     } (Name == 'gt') {
2117     lang:Perl {
2118     $parent-><M::Node.appendChild>
2119     ($self->{doc}-><M::Document.createTextNode> ('>'));
2120     }
2121     } (Name == 'amp') {
2122     lang:Perl {
2123     $parent-><M::Node.appendChild>
2124     ($self->{doc}-><M::Document.createTextNode> ('&'));
2125     }
2126     } (Name == 'quot') {
2127     lang:Perl {
2128     $parent-><M::Node.appendChild>
2129     ($self->{doc}-><M::Document.createTextNode> ('"'));
2130     }
2131     } (Name == 'apos') {
2132     lang:Perl {
2133     $parent-><M::Node.appendChild>
2134     ($self->{doc}-><M::Document.createTextNode> ("'"));
2135     }
2136     } (Name) {
2137     my $er;
2138 wakaba 1.19 lang:Perl ($name => $token.value) : has-error {
2139 wakaba 1.11 ## TODO: Namespace well-formedness
2140     $er = $doc-><M::Document.createEntityReference>
2141     ($name);
2142 wakaba 1.20 $er-><AS::Node.textContent> ('');
2143     ## NOTE: When document entity (and entities referenced directly
2144     ## or indirectly from it) is parsed, no general entity
2145     ## node have its replacement tree. During general
2146     ## entity node collection construction, however,
2147     ## some entity node has replacement tree.
2148 wakaba 1.11 $parent-><M::Node.appendChild> ($er);
2149 wakaba 1.19
2150     my $ent = $self->{general_entity}->{$name};
2151     if (not $ent) { # no entity declaration
2152     if ($self->{standalone} or not $self->{has_xref}) { # WFC error
2153     my $location;
2154     __CODE{xp|get-location-from-token::
2155     $token => {$token},
2156     $result => {$location},
2157     }__;
2158     my $continue = __DOMCore:ERROR{xp|wf-entity-declared::
2159     xp|error-token => {$token},
2160     c|location => {$location},
2161     xp|name => {$name},
2162     }__;
2163     unless ($continue) {
2164     __EXCEPTION{DOMLS|PARSE_ERR}__;
2165     }
2166     } # Otherwise VC error
2167     push @{$self->{entity}}, <Code::getEmptyEntityState>;
2168 wakaba 1.20 $er-><AS::x|EntityReference.isExpanded> (false);
2169 wakaba 1.19
2170     } else { # there IS entity declaration
2171     if (($self->{standalone} or not $self->{has_xref}) and
2172     $ent->{is_externally_declared} and
2173     not $self->{entity}->[-1]->{is_externally_declared}) {
2174     my $location;
2175     __CODE{xp|get-location-from-token::
2176     $token => {$token},
2177     $result => {$location},
2178     }__;
2179     my $continue = __DOMCore:ERROR{xp|wf-entity-declared::
2180     xp|error-token => {$token},
2181     c|location => {$location},
2182     xp|name => {$name},
2183     }__;
2184     unless ($continue) {
2185     __EXCEPTION{DOMLS|PARSE_ERR}__;
2186     }
2187     }
2188     $er-><AS::x|EntityReference.isExpanded>
2189     ($ent->{has_replacement_text});
2190     push @{$self->{entity}}, <Code::getCopyOfEntityState::
2191 wakaba 1.11 $entity_type = 'general_entity',
2192     $entity_name = $name>;
2193 wakaba 1.19 }
2194 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
2195 wakaba 1.11 push @{$self->{entity_token}}, $self->{token};
2196     $self->{token} = [];
2197     push @{$self->{entity_char}}, $self->{char};
2198     $self->{char} = [];
2199     }
2200    
2201     ?lexmode ElementContent;
2202     &content ($doc => $doc, $parent => $er, $ns => $ns);
2203     ~ (#EOF) { }
2204     lang:Perl {
2205     $self->{token} = pop @{$self->{entity_token}};
2206     $self->{char} = pop @{$self->{entity_char}};
2207     pop @{$self->{entity}};
2208 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
2209 wakaba 1.11 }
2210    
2211     // TODO: Set read-only flag
2212    
2213     ?lexmode EntityReference;
2214     ?requires-next-token;
2215     }
2216    
2217     ~ (REFC) {
2218     ?lexmode ElementContent;
2219     } else {
2220     ?lexmode ElementContent;
2221     }
2222     } // _GeneralEntityReferenceEC
2223    
2224     /*
2225     General entity reference in an attribute value literal
2226     */
2227     rule _GeneralEntityReferenceV_ ($vals) {
2228     ?lexmode EntityReference;
2229    
2230     ~ (Name == 'lt') {
2231     lang:Perl {
2232     push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode>
2233     ('<');
2234     $vals->{value} .= '<';
2235     }
2236     } (Name == 'gt') {
2237     lang:Perl {
2238     push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode>
2239     ('>');
2240     $vals->{value} .= '>';
2241     }
2242     } (Name == 'amp') {
2243     lang:Perl {
2244     push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode>
2245     ('&');
2246     $vals->{value} .= '&';
2247     }
2248     } (Name == 'quot') {
2249     lang:Perl {
2250     push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode>
2251     ('"');
2252     $vals->{value} .= '"';
2253     }
2254     } (Name == 'apos') {
2255     lang:Perl {
2256     push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode>
2257     ("'");
2258     $vals->{value} .= "'";
2259     }
2260     } (Name) {
2261     my $er;
2262 wakaba 1.18 lang:Perl ($name => $token.value) : has-error {
2263 wakaba 1.11 ## TODO: Namespace well-formedness
2264     ## TODO: Entity declared constraints
2265 wakaba 1.18
2266 wakaba 1.11 $er = $self->{doc}-><M::Document.createEntityReference> ($name);
2267 wakaba 1.20 $er-><AS::Node.textContent> ('');
2268     ## NOTE: When document entity (and entities referenced directly
2269     ## or indirectly from it) is parsed, no general entity
2270     ## node have its replacement tree. During general
2271     ## entity node collection construction, however,
2272     ## some entity node has replacement tree.
2273 wakaba 1.19 my $ent = $self->{general_entity}->{$name};
2274 wakaba 1.20 if (not $ent) { # no entity declaration
2275     if ($self->{standalone} or not $self->{has_xref}) { # WFC error
2276     my $location;
2277     __CODE{xp|get-location-from-token::
2278     $token => {$token},
2279     $result => {$location},
2280     }__;
2281     my $continue = __DOMCore:ERROR{xp|wf-entity-declared::
2282     xp|error-token => {$token},
2283     c|location => {$location},
2284     xp|name => {$name},
2285     }__;
2286     unless ($continue) {
2287     __EXCEPTION{DOMLS|PARSE_ERR}__;
2288     }
2289     } # Otherwise VC error
2290     push @{$self->{entity}}, <Code::getEmptyEntityState>;
2291     $er-><AS::x|EntityReference.isExpanded> (false);
2292    
2293     } else { # there IS entity declaration
2294     if (($self->{standalone} or not $self->{has_xref}) and
2295     $ent->{is_externally_declared} and
2296     not $self->{entity}->[-1]->{is_externally_declared}) {
2297     my $location;
2298     __CODE{xp|get-location-from-token::
2299     $token => {$token},
2300     $result => {$location},
2301     }__;
2302     my $continue = __DOMCore:ERROR{xp|wf-entity-declared::
2303     xp|error-token => {$token},
2304     c|location => {$location},
2305     xp|name => {$name},
2306     }__;
2307     unless ($continue) {
2308     __EXCEPTION{DOMLS|PARSE_ERR}__;
2309     }
2310     }
2311    
2312     if ($ent->{is_external_entity}) {
2313     my $location;
2314     __CODE{xp|get-location-from-token::
2315     $token => {$token},
2316     $result => {$location},
2317     }__;
2318     my $continue = __c|ERROR{xp|wf-no-external-entity-references::
2319     xp|error-token => {$token},
2320     c|location => {$location},
2321     xp|name => {$name},
2322     }__;
2323     unless ($continue) {
2324     __EXCEPTION{DOMLS|PARSE_ERR::
2325     }__;
2326     }
2327     } # if external entity
2328    
2329     $er-><AS::x|EntityReference.isExpanded>
2330 wakaba 1.19 ($ent->{has_replacement_text});
2331 wakaba 1.20 push @{$self->{entity}}, <Code::getCopyOfEntityState::
2332 wakaba 1.11 $entity_type = 'general_entity',
2333     $entity_name = $name>;
2334 wakaba 1.20 }
2335     push @{$vals->{nodes}}, $er;
2336 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
2337 wakaba 1.11 push @{$self->{entity_token}}, $self->{token};
2338     $self->{token} = [];
2339     push @{$self->{entity_char}}, $self->{char};
2340     $self->{char} = [];
2341     }
2342    
2343     ?lexmode AttributeValueLiteralE;
2344     &AttributeValueLiteralE_ ($parent => $er, $vals => $vals);
2345     ~ (#EOF) { }
2346     lang:Perl {
2347     $self->{token} = pop @{$self->{entity_token}};
2348     $self->{char} = pop @{$self->{entity_char}};
2349     pop @{$self->{entity}};
2350 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
2351 wakaba 1.11 }
2352    
2353     // TODO: Set read-only flag
2354    
2355     ?lexmode EntityReference;
2356     ?requires-next-token;
2357     }
2358    
2359     // ~ (REFC) { }
2360     } // _GeneralEntityReferenceV_
2361 wakaba 1.1
2362 wakaba 1.6 /*
2363 wakaba 1.11 General entity reference in the replacement text
2364     of the entity referenced in an attribute value literal
2365 wakaba 1.6 */
2366 wakaba 1.11 rule _GeneralEntityReferenceAE_ ($parent, $vals)
2367 wakaba 1.6 {
2368 wakaba 1.11 ?lexmode EntityReference;
2369 wakaba 1.1
2370 wakaba 1.11 ~ (Name == 'lt') {
2371     lang:Perl {
2372     $parent-><M::Node.appendChild>
2373     ($self->{doc}-><M::Document.createTextNode> ('<'));
2374     $vals->{value} .= '<';
2375     }
2376     } (Name == 'gt') {
2377     lang:Perl {
2378     $parent-><M::Node.appendChild>
2379     ($self->{doc}-><M::Document.createTextNode> ('>'));
2380     $vals->{value} .= '>';
2381     }
2382     } (Name == 'amp') {
2383     lang:Perl {
2384     $parent-><M::Node.appendChild>
2385     ($self->{doc}-><M::Document.createTextNode> ('&'));
2386     $vals->{value} .= '&';
2387     }
2388     } (Name == 'quot') {
2389     lang:Perl {
2390     $parent-><M::Node.appendChild>
2391     ($self->{doc}-><M::Document.createTextNode> ('"'));
2392     $vals->{value} .= '"';
2393     }
2394     } (Name == 'apos') {
2395     lang:Perl {
2396     $parent-><M::Node.appendChild>
2397     ($self->{doc}-><M::Document.createTextNode> ("'"));
2398     $vals->{value} .= "'";
2399     }
2400     } (Name) {
2401 wakaba 1.6 my $er;
2402 wakaba 1.1 lang:Perl ($name => $token.value) {
2403     ## TODO: Namespace well-formedness
2404     ## TODO: Entity declared constraints
2405 wakaba 1.18
2406 wakaba 1.11 $er = $self->{doc}-><M::Document.createEntityReference> ($name);
2407 wakaba 1.20 $er-><AS::Node.textContent> ('');
2408     ## NOTE: When document entity (and entities referenced directly
2409     ## or indirectly from it) is parsed, no general entity
2410     ## node have its replacement tree. During general
2411     ## entity node collection construction, however,
2412     ## some entity node has replacement tree.
2413 wakaba 1.19 my $ent = $self->{general_entity}->{$name};
2414 wakaba 1.1 $parent-><M::Node.appendChild> ($er);
2415 wakaba 1.19 $er-><AS::x|EntityReference.isExpanded>
2416     ($ent->{has_replacement_text});
2417 wakaba 1.6 push @{$self->{entity}}, <Code::getCopyOfEntityState::
2418     $entity_type = 'general_entity',
2419     $entity_name = $name>;
2420 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
2421 wakaba 1.6 push @{$self->{entity_token}}, $self->{token};
2422     $self->{token} = [];
2423     push @{$self->{entity_char}}, $self->{char};
2424     $self->{char} = [];
2425 wakaba 1.18
2426     if ($self->{entity}->[-1]->{is_external_entity}) {
2427     my $location;
2428     __CODE{xp|get-location-from-token::
2429     $token => {$token},
2430     $result => {$location},
2431     }__;
2432     my $continue = __DOMCore:ERROR{xp|wf-no-external-entity-references::
2433     xp|error-token => {$token},
2434     c|location => {$location},
2435     xp|name => {$name},
2436     }__;
2437     unless ($continue) {
2438     __EXCEPTION{DOMLS|PARSE_ERR::
2439     }__;
2440     }
2441     } # if external entity
2442 wakaba 1.6 }
2443    
2444 wakaba 1.11 ?lexmode AttributeValueLiteralE;
2445     &AttributeValueLiteralE_ ($parent => $er, $vals => $vals);
2446 wakaba 1.6 ~ (#EOF) { }
2447     lang:Perl {
2448     $self->{token} = pop @{$self->{entity_token}};
2449     $self->{char} = pop @{$self->{entity_char}};
2450     pop @{$self->{entity}};
2451 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
2452 wakaba 1.6 }
2453    
2454 wakaba 1.11 // TODO: Set read-only flag
2455    
2456 wakaba 1.6 ?lexmode EntityReference;
2457     ?requires-next-token;
2458 wakaba 1.1 }
2459    
2460     // ~ (REFC) { }
2461 wakaba 1.11 } // _GeneralEntityReferenceAE_
2462 wakaba 1.6
2463     /*
2464     General entity reference in literal entity value
2465     */
2466 wakaba 1.11 rule _GeneralEntityReferenceEV_ ($vals) {
2467 wakaba 1.6 ?lexmode 'EntityReference';
2468    
2469     ~ (Name) {
2470     lang:Perl ($name => $token.value) {
2471     ## TODO: Namespace well-formedness
2472     ## TODO: Entity declared constraints
2473     push @$vals, $name;
2474     }
2475     }
2476 wakaba 1.11
2477     // No expansion
2478 wakaba 1.6
2479     // ~ (REFC) { }
2480     } // _GeneralEntityReferenceEV_
2481 wakaba 1.1
2482     /*
2483 wakaba 1.4 Document Type Declaration
2484 wakaba 1.1 */
2485 wakaba 1.4 rule _DocumentTypeDeclaration_ ($doc) {
2486     ?lexmode MarkupDeclaration;
2487    
2488     ~ (Name == 'DOCTYPE') { }
2489    
2490     ~ (S) { }
2491    
2492     // Document type name
2493 wakaba 1.6 my $name;
2494 wakaba 1.4 ~ (Name) {
2495 wakaba 1.6 lang:Perl ($v => $token.value) {
2496     $name = $v;
2497     }
2498     }
2499 wakaba 1.17
2500     my $node;
2501     my $decl;
2502 wakaba 1.6 lang:Perl {
2503 wakaba 1.11 $self->{docx} = $self->{doc}
2504     -><M::Node.getFeature> (<Q::fe:XDoctype>, '3.0');
2505     $node = $self->{docx}-><M::DocumentXDoctype.createDocumentTypeDefinition>
2506     ($name);
2507 wakaba 1.17 $decl = $self->{dtdecl} = $node-><M::Node.getFeature>
2508     (<Q::fe:XDoctypeDeclaration>, '3.0');
2509 wakaba 1.4 }
2510    
2511     ~? (S) {
2512     ~? (Name == 'PUBLIC') {
2513     ~ (S) { }
2514    
2515 wakaba 1.17 &PubidLiteral ($decl => $decl);
2516 wakaba 1.4
2517     ~ (S) { }
2518    
2519 wakaba 1.17 &SystemLiteral ($decl => $decl);
2520 wakaba 1.4
2521     ~? (S) { }
2522 wakaba 1.19
2523     lang:Perl {
2524     $self->{has_xref} = true;
2525     }
2526 wakaba 1.4 } (Name == 'SYSTEM') {
2527     ~ (S) { }
2528    
2529 wakaba 1.17 &SystemLiteral ($decl => $decl);
2530 wakaba 1.4
2531     ~? (S) { }
2532 wakaba 1.19
2533     lang:Perl {
2534     $self->{has_xref} = true;
2535     }
2536 wakaba 1.4 }
2537     }
2538 wakaba 1.17
2539 wakaba 1.11 lang:Perl {
2540     $self->{dtdef} = $node;
2541     $doc-><M::Node.appendChild> ($node);
2542     $doc-><AG::Document.domConfig>
2543     -><M::c|DOMConfiguration.setParameter>
2544     ('schema-type' => <Q::xml-dtd:>);
2545     }
2546    
2547 wakaba 1.4 ~? (DSO) {
2548 wakaba 1.6 &InternalSubset ($doc => $doc, $doctype => $node);
2549 wakaba 1.4
2550     ~ (DSC) {
2551     ?lexmode MarkupDeclaration;
2552     } else {
2553     ?lexmode MarkupDeclaration;
2554     }
2555    
2556     ~? (S) { }
2557     }
2558    
2559     // ~ (MDC) { }
2560     } // _DocumentTypeDeclaration_
2561    
2562 wakaba 1.17 /*
2563     Public Identifier Literal
2564     */
2565     rule PubidLiteral ($decl) {
2566     my $pubid;
2567     my $pubid_token;
2568 wakaba 1.4 ~ (LIT) {
2569     ?lexmode SystemLiteral;
2570    
2571     ~? (STRING) {
2572 wakaba 1.17 lang:Perl ($v => $token.value) {
2573     $pubid = $v;
2574     $pubid_token = $token;
2575     }
2576 wakaba 1.4 }
2577    
2578     ~ (LIT) {
2579     ?lexmode MarkupDeclaration;
2580     } else {
2581     ?lexmode MarkupDeclaration;
2582     }
2583     } (LITA) {
2584     ?lexmode SystemLiteralA;
2585    
2586     ~? (STRING) {
2587 wakaba 1.17 lang:Perl ($v => $token.value) {
2588     $pubid = $v;
2589     $pubid_token = $token;
2590     }
2591 wakaba 1.4 }
2592    
2593     ~ (LITA) {
2594     ?lexmode MarkupDeclaration;
2595     } else {
2596     ?lexmode MarkupDeclaration;
2597     }
2598     }
2599 wakaba 1.17
2600     if-true ($pubid_token) {
2601     lang:Perl : has-error {
2602     if ($pubid =~ m{[^\x20\x0D\x0Aa-zA-Z0-9'()+,./:=?;!*#\@\$_%-]}s) {
2603     my $location;
2604     __CODE{xp|get-location-from-token::
2605     $token => {$pubid_token},
2606     $result => {$location},
2607     }__;
2608     ## Should this be other (new) error type?
2609     my $continue = __DOMCore:ERROR{xp|wf-syntax-error::
2610     xp|error-token => {$token},
2611     c|location => {$location},
2612     }__;
2613     unless ($continue) {
2614     __EXCEPTION{DOMLS|PARSE_ERR::
2615     }__;
2616     }
2617     }
2618    
2619     ## NOTE: U+0009 is syntactically illegal.
2620     $pubid =~ s/[\x09\x0A\x0D\x20]+//gs;
2621     $pubid =~ s/\A\x20//s;
2622     $pubid =~ s/\x20\z//s;
2623     ## NOTE: Bare attribute name is written.
2624     $decl->public_id ($pubid);
2625     }
2626     }
2627 wakaba 1.4 } // PubidLiteral
2628    
2629 wakaba 1.17 /*
2630     System Identifier Literal
2631     */
2632     rule SystemLiteral ($decl) {
2633 wakaba 1.4 ~ (LIT) {
2634     ?lexmode SystemLiteral;
2635 wakaba 1.17 &_SystemLiteral ($decl => $decl);
2636 wakaba 1.4 } (LITA) {
2637     ?lexmode SystemLiteralA;
2638 wakaba 1.17 &_SystemLiteral ($decl => $decl);
2639 wakaba 1.4 }
2640     } // SystemLiteral
2641    
2642 wakaba 1.17 /*
2643     System Identifier Literal Content
2644     */
2645     rule _SystemLiteral ($decl) {
2646     // LIT or LITA
2647    
2648 wakaba 1.4 ~? (STRING) {
2649 wakaba 1.17 lang:Perl ($v => $token.value) {
2650     ## NOTE: Bare attribute name is written.
2651     $decl->system_id ($v);
2652     }
2653 wakaba 1.4 }
2654    
2655     ~ (LIT) {
2656     ?lexmode MarkupDeclaration;
2657     } (LITA) {
2658     ?lexmode MarkupDeclaration;
2659     } else {
2660     ?lexmode MarkupDeclaration;
2661     }
2662     } // _SystemLiteral
2663    
2664     /*
2665     DTD Internal Subset
2666    
2667     intSubset := *(markupdecl / DeclSep) ;; [28b]
2668     */
2669 wakaba 1.6 rule InternalSubset ($doc, $doctype) {
2670 wakaba 1.4 ?lexmode DTD;
2671    
2672     ~* (MDO) {
2673     ?lexmode MarkupDeclaration;
2674    
2675     ~ (Name == 'ELEMENT') {
2676     &_ElementDeclaration ($doc => $doc);
2677     } (Name == 'ATTLIST') {
2678 wakaba 1.8 &_AttlistDeclaration ($doc => $doc, $doctype => $doctype);
2679 wakaba 1.4 } (Name == 'ENTITY') {
2680     &_EntityDeclaration ($doc => $doc);
2681     } (Name == 'NOTATION') {
2682     &_NotationDeclaration ($doc => $doc);
2683     }
2684     } (S) {
2685     //
2686     } (CDO) {
2687     &_CommentDeclarationDTD ($doc => $doc);
2688     } (PIO) {
2689 wakaba 1.6 &_ProcessingInstructionDTD ($doc => $doc, $doctype => $doctype);
2690 wakaba 1.4 } (PERO) {
2691     ?lexmode EntityReference;
2692    
2693 wakaba 1.19 lang:Perl {
2694     $self->{has_xref} = true;
2695     }
2696    
2697 wakaba 1.4 ~ (Name) {
2698    
2699     }
2700    
2701     ~ (REFC) {
2702     ?lexmode DTD;
2703     } else {
2704     ?lexmode DTD;
2705     }
2706     }
2707     } // InternalSubset
2708    
2709     rule _ElementDeclaration ($doc) {
2710     // ~ (MDO) { }
2711     // ?lexmode MarkupDeclaration
2712     // ~ (Name == 'Element') { }
2713    
2714     ~ (S) { }
2715    
2716     ~ (Name) {
2717    
2718     }
2719    
2720     ?lexmode ElementDeclaration;
2721    
2722     ~ (S) { }
2723    
2724     // contentspec
2725     ~ (MGO) {
2726     &_ContentModel ($doc => $doc);
2727     } (Name == 'EMPTY') {
2728    
2729     } (Name == 'ANY') {
2730    
2731     }
2732    
2733     ~? (S) { }
2734    
2735     ~ (MDC) {
2736     ?lexmode DTD;
2737     } else {
2738     ?lexmode DTD;
2739     }
2740     } // _ElementDeclaration
2741    
2742     rule _ContentModel ($doc) {
2743     // ~ (MGO) { }
2744    
2745     ~? (S) { }
2746    
2747     ~ (Name) {
2748     // Element content model
2749     &_ModelGroup ($doc => $doc)
2750     : unshift-current-token;
2751    
2752     ~? (OPT) {
2753    
2754     } (REP) {
2755    
2756     } (PLUS) {
2757    
2758     }
2759    
2760     } (MDO) {
2761     &_ModelGroup ($doc => $doc)
2762     : unshift-current-token;
2763    
2764     ~? (OPT) {
2765    
2766     } (REP) {
2767    
2768     } (PLUS) {
2769    
2770     }
2771    
2772     } (PCDATA) {
2773     // Mixed content declaration
2774     ~? (S) { }
2775    
2776     ~* (OR) {
2777     ~? (S) { }
2778    
2779     ~ (Name) {
2780    
2781     }
2782    
2783     ~? (S) { }
2784     }
2785    
2786     ~ (MGC) { }
2787    
2788     ~? (REP) {
2789    
2790     } else {
2791     // TODO: error if |Name|
2792     }
2793    
2794    
2795     }
2796     } // _ContentModel
2797    
2798     rule _ModelGroup ($doc)
2799     : standalone
2800     : recursive
2801     {
2802     // ~ (MGO) { }
2803     // ~? (S) { }
2804    
2805     &ContentParticle ($doc => $doc);
2806    
2807     ~? (S) { }
2808    
2809     ~? (OR) {
2810     ~? (S) { }
2811    
2812     &ContentParticle ($doc => $doc);
2813    
2814     ~? (S) { }
2815    
2816     ~* (OR) {
2817     ~? (S) { }
2818    
2819     &ContentParticle ($doc => $doc);
2820    
2821     ~? (S) { }
2822     }
2823    
2824     } (SEQ) {
2825     ~? (S) { }
2826    
2827     &ContentParticle ($doc => $doc);
2828    
2829     ~? (S) { }
2830    
2831     ~* (SEQ) {
2832     ~? (S) { }
2833    
2834     &ContentParticle ($doc => $doc);
2835    
2836     ~? (S) { }
2837     }
2838    
2839     }
2840    
2841     ~ (MGC) { }
2842     } // _ModelGroup
2843    
2844     rule ContentParticle ($doc) {
2845     ~ (Name) {
2846    
2847     } (MGO) {
2848     ~? (S) { }
2849    
2850     &_ModelGroup ($doc => $doc);
2851     }
2852    
2853     ~? (OPT) {
2854    
2855     } (REP) {
2856    
2857     } (PLUS) {
2858    
2859     }
2860     } // ContentParticle
2861    
2862 wakaba 1.8 /*
2863     Attribute list declaration
2864     */
2865     rule _AttlistDeclaration ($doc, $doctype) {
2866 wakaba 1.4 // ~ (MDO) { }
2867     // ~ (Name == 'ATTLIST') { }
2868    
2869     ?lexmode AttlistDeclaration;
2870    
2871     ~ (S) { }
2872    
2873 wakaba 1.8 my $name;
2874 wakaba 1.4 ~ (Name) {
2875 wakaba 1.8 lang:Perl ($v => $token.value) {
2876     $name = $v;
2877     }
2878     } else {
2879     lang:Perl { $name = '#ILLEGAL' }
2880     }
2881 wakaba 1.4
2882 wakaba 1.8 my $docxd;
2883     my $et;
2884     lang:Perl {
2885     $et = $doctype-><M::DTDef.getElementTypeDefinitionNode> ($name);
2886     unless ($et) {
2887 wakaba 1.11 $docxd = $doc-><M::Node.getFeature> (<Q::fe:XDoctype>, '3.0');
2888 wakaba 1.8 $et = $docxd-><M::DocumentXDoctype.createElementTypeDefinition>
2889     ($name);
2890     $doctype-><M::DTDef.setElementTypeDefinitionNode> ($et)
2891     unless $name eq '#ILLEGAL';
2892     }
2893 wakaba 1.4 }
2894    
2895     ~? (S) { }
2896    
2897     ~* (Name) {
2898 wakaba 1.8 my $at;
2899     lang:Perl ($v => $token.value) {
2900     $docxd ||= $doc-><M::Node.getFeature>
2901 wakaba 1.11 (<Q::fe:XDoctype>, '3.0');
2902 wakaba 1.8 $at = $docxd-><M::DocumentXDoctype.createAttributeDefinition> ($v);
2903 wakaba 1.9 unless (exists $et-><AG::ETDef.attributeDefinitions>->{$v}) {
2904     $et-><M::ETDef.setAttributeDefinitionNode> ($at);
2905     $self->{attr}->{$name}->{$v} = $at;
2906     }
2907 wakaba 1.8 }
2908 wakaba 1.4
2909     ~ (S) { }
2910    
2911     // AttType
2912     ~ (Name == 'NOTATION') {
2913     ~ (S) { }
2914    
2915 wakaba 1.8 my $kwd;
2916     lang:Perl {
2917     $at-><AS::ATDef.declaredType> (<C::ATDef.NOTATION_ATTR>);
2918     $kwd = $at-><AG::ATDef.allowedTokens>;
2919     }
2920    
2921 wakaba 1.4 ~ (EGO) {
2922     ~? (S) { }
2923    
2924 wakaba 1.8 ~+ (Name) {
2925     lang:Perl ($v => $token.value) {
2926     push @$kwd, $v;
2927     }
2928 wakaba 1.4
2929     ~? (S) { }
2930     } (OR) : separator {
2931     ~? (S) { }
2932     }
2933    
2934     ~ (EGC) { }
2935     }
2936 wakaba 1.8
2937 wakaba 1.4 } (Name) {
2938 wakaba 1.8 my $type;
2939     lang:Perl ($v => $token.value) : has-error {
2940     my $map = {
2941     CDATA => <C::ATDef.CDATA_ATTR>,
2942     ID => <C::ATDef.ID_ATTR>,
2943     IDREF => <C::ATDef.IDREF_ATTR>,
2944     IDREFS => <C::ATDef.IDREFS_ATTR>,
2945     ENTITY => <C::ATDef.ENTITY_ATTR>,
2946     ENTITIES => <C::ATDef.ENTITIES_ATTR>,
2947     NMTOKEN => <C::ATDef.NMTOKEN_ATTR>,
2948     NMTOKENS => <C::ATDef.NMTOKENS_ATTR>,
2949     };
2950     if ($map->{$v}) {
2951     $at-><AS::ATDef.declaredType> ($map->{$v});
2952     } else {
2953     ## TODO: Exception
2954     }
2955     }
2956 wakaba 1.4
2957     } (EGO) {
2958     ?lexmode Enumeration;
2959    
2960     ~? (S) { }
2961    
2962 wakaba 1.8 my $kwd;
2963     lang:Perl {
2964     $at-><AS::ATDef.declaredType> (<C::ATDef.ENUMERATION_ATTR>);
2965     $kwd = $at-><AG::ATDef.allowedTokens>;
2966     }
2967    
2968     ~+ (Nmtoken) {
2969     lang:Perl ($v => $token.value) {
2970     push @$kwd, $v;
2971     }
2972 wakaba 1.4
2973     ~? (S) { }
2974     } (OR) : separator {
2975     ~? (S) { }
2976     }
2977    
2978     ~ (EGC) {
2979     ?lexmode AttlistDeclaration;
2980     } else {
2981     ?lexmode AttlistDeclaration;
2982     }
2983    
2984     }
2985    
2986     ~ (S) { }
2987    
2988     // DefaultDecl
2989     ~ (RNI) {
2990     ~ (Name == 'REQUIRED') {
2991 wakaba 1.8 lang:Perl {
2992     $at-><AS::ATDef.defaultType> (<C::ATDef.REQUIRED_DEFAULT>);
2993     }
2994 wakaba 1.4 } (Name == 'IMPLIED') {
2995 wakaba 1.8 lang:Perl {
2996     $at-><AS::ATDef.defaultType> (<C::ATDef.IMPLIED_DEFAULT>);
2997     }
2998 wakaba 1.4 } (Name == 'FIXED') {
2999     ~ (S) { }
3000 wakaba 1.8
3001     lang:Perl {
3002     $at-><AS::ATDef.defaultType> (<C::ATDef.FIXED_DEFAULT>);
3003     }
3004 wakaba 1.4
3005     ~ (LIT) {
3006     my $vals;
3007     lang:Perl {
3008 wakaba 1.8 $vals = {nodes => [], value => ''};
3009 wakaba 1.4 }
3010    
3011     &_AttributeValueSpecification_ ($doc => $doc, $vals => $vals);
3012    
3013 wakaba 1.8 lang:Perl {
3014     for (@{$vals->{nodes}}) {
3015     $at-><M::Node.appendChild> ($_);
3016     }
3017     }
3018    
3019 wakaba 1.4 ~ (LIT) {
3020     ?lexmode AttlistDeclaration;
3021     } else {
3022     ?lexmode AttlistDeclaration;
3023     }
3024     } (LITA) {
3025     my $vals;
3026     lang:Perl {
3027 wakaba 1.8 $vals = {nodes => [], value => ''};
3028 wakaba 1.4 }
3029    
3030     &_AttributeValueSpecificationA_ ($doc => $doc, $vals => $vals);
3031    
3032 wakaba 1.8 lang:Perl {
3033     for (@{$vals->{nodes}}) {
3034     $at-><M::Node.appendChild> ($_);
3035     }
3036     }
3037    
3038     ~ (LITA) {
3039 wakaba 1.4 ?lexmode AttlistDeclaration;
3040     } else {
3041     ?lexmode AttlistDeclaration;
3042     }
3043     }
3044     }
3045    
3046     } (LIT) {
3047     my $vals;
3048     lang:Perl {
3049 wakaba 1.8 $at-><AS::ATDef.defaultType> (<C::ATDef.EXPLICIT_DEFAULT>);
3050     $vals = {nodes => [], value => ''};
3051 wakaba 1.4 }
3052    
3053     &_AttributeValueSpecification_ ($doc => $doc, $vals => $vals);
3054    
3055 wakaba 1.8 lang:Perl {
3056     for (@{$vals->{nodes}}) {
3057     $at-><M::Node.appendChild> ($_);
3058     }
3059     }
3060    
3061 wakaba 1.4 ~ (LIT) {
3062     ?lexmode AttlistDeclaration;
3063     } else {
3064     ?lexmode AttlistDeclaration;
3065     }
3066     } (LITA) {
3067     my $vals;
3068     lang:Perl {
3069 wakaba 1.8 $at-><AS::ATDef.defaultType> (<C::ATDef.EXPLICIT_DEFAULT>);
3070     $vals = {nodes => [], value => ''};
3071 wakaba 1.4 }
3072    
3073     &_AttributeValueSpecificationA_ ($doc => $doc, $vals => $vals);
3074    
3075 wakaba 1.8 lang:Perl {
3076     for (@{$vals->{nodes}}) {
3077     $at-><M::Node.appendChild> ($_);
3078     }
3079     }
3080    
3081 wakaba 1.4 ~ (LITA) {
3082     ?lexmode AttlistDeclaration;
3083     } else {
3084     ?lexmode AttlistDeclaration;
3085     }
3086     }
3087    
3088     } (S) : separator : terminator? {
3089     //
3090     }
3091    
3092     ~ (MDC) {
3093     ?lexmode DTD;
3094     } else {
3095     ?lexmode DTD;
3096     }
3097     } // _AttlistDeclaration
3098    
3099 wakaba 1.11 /*
3100     Entity declaration
3101     */
3102 wakaba 1.4 rule _EntityDeclaration ($doc) {
3103     // ~ (MDO) { }
3104     // ~ (Name == ENTITY) { }
3105    
3106     ~ (S) { }
3107    
3108 wakaba 1.6 my $decl;
3109 wakaba 1.18 lang:Perl { $decl = { name => '#ILLEGAL', reptxt => \'' }; }
3110 wakaba 1.6
3111 wakaba 1.4 ~? (PERO) {
3112     ~ (S) { }
3113 wakaba 1.6 lang:Perl {
3114     $decl->{is_param_entity} = true;
3115     }
3116 wakaba 1.4 }
3117    
3118 wakaba 1.19 /*
3119     TODO: Set |$decl->{is_externally_declared}| flag
3120     and |Entity.isExternallyDeclared| attribute
3121     for entity declarations in external subset or
3122     in parameter entity.
3123     */
3124    
3125 wakaba 1.4 ~ (Name) {
3126 wakaba 1.6 lang:Perl ($v => $token.value) {
3127     $decl->{name} = $v;
3128     }
3129 wakaba 1.4 }
3130    
3131 wakaba 1.18 my $node;
3132 wakaba 1.11 lang:Perl {
3133 wakaba 1.18 $node =
3134 wakaba 1.11 $decl->{node} = $self->{docx}-><M::DocumentXDoctype.createGeneralEntity>
3135     ($decl->{name});
3136     ## TODO: Parameter entity...
3137     }
3138    
3139 wakaba 1.4 ~ (S) { }
3140    
3141     ~ (LIT) {
3142 wakaba 1.6 &_EntityValue ($doc => $doc, $decl => $decl);
3143 wakaba 1.4 } (LITA) {
3144 wakaba 1.6 &_EntityValueA ($doc => $doc, $decl => $decl);
3145 wakaba 1.4 } (Name == 'PUBLIC') {
3146     ~ (S) { }
3147    
3148 wakaba 1.18 &PubidLiteral ($decl => $node);
3149 wakaba 1.4
3150     ~ (S) { }
3151    
3152 wakaba 1.18 &SystemLiteral ($decl => $node);
3153    
3154     lang:Perl {
3155     $decl->{is_external_entity} = true;
3156     }
3157 wakaba 1.4 } (Name == 'SYSTEM') {
3158     ~ (S) { }
3159    
3160 wakaba 1.18 &SystemLiteral ($decl => $node);
3161    
3162     lang:Perl {
3163     $decl->{is_external_entity} = true;
3164     }
3165 wakaba 1.4 }
3166    
3167     ~? (S) {
3168     ~? (Name == 'NDATA') {
3169     // TODO: error if parameter entity
3170    
3171     ~ (S) { }
3172    
3173     ~ (Name) {
3174 wakaba 1.6 lang:Perl ($v => $token.value) {
3175     $decl->{notation} = $v;
3176 wakaba 1.11 $decl->{node}-><AG::x|Entity.notationName> ($v);
3177 wakaba 1.6 }
3178 wakaba 1.4 }
3179    
3180     ~? (S) { }
3181     }
3182     }
3183    
3184 wakaba 1.6 lang:Perl {
3185     if ($self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'}
3186     ->{$decl->{name}}) {
3187 wakaba 1.11 ## TODO: warning
3188     ## TODO: predefined entity error check
3189 wakaba 1.6 } else {
3190     $self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'}
3191     ->{$decl->{name}} = $decl;
3192 wakaba 1.11 $self->{dtdef}-><M::DTDef.setGeneralEntityNode> ($decl->{node})
3193     unless $decl->{is_param_entity};
3194 wakaba 1.6 }
3195     }
3196    
3197 wakaba 1.4 ~ (MDC) {
3198     ?lexmode DTD;
3199     } else {
3200     ?lexmode DTD;
3201     }
3202     } // _EntityDeclaration
3203    
3204     rule _NotationDeclaration ($doc) {
3205     // ~ (MDO) { }
3206     // ~ (Name == NOTATION) { }
3207    
3208     ~ (S) { }
3209    
3210     ~ (Name) {
3211    
3212     }
3213    
3214     ~ (S) { }
3215    
3216 wakaba 1.17 my $decl;
3217     lang:Perl {
3218     $decl = $self->{docx}-><M::DocumentXDoctype.createGeneralEntity>
3219     ($decl->{name});
3220     ## Temporary: to avoid error.
3221     }
3222    
3223 wakaba 1.4 ~ (Name == 'PUBLIC') {
3224     ~ (S) { }
3225    
3226 wakaba 1.17 &PubidLiteral ($decl => $decl);
3227 wakaba 1.4
3228     ~? (S) {
3229     ~? (LIT) {
3230     ?lexmode SystemLiteral;
3231 wakaba 1.17 &_SystemLiteral ($decl => $decl);
3232 wakaba 1.4
3233     ~? (S) { }
3234     } (LITA) {
3235     ?lexmode SystemLiteralA;
3236 wakaba 1.17 &_SystemLiteral ($decl => $decl);
3237 wakaba 1.4
3238     ~? (S) { }
3239     }
3240     }
3241     } (Name == 'SYSTEM') {
3242     ~ (S) { }
3243    
3244 wakaba 1.17 &SystemLiteral ($decl => $decl);
3245 wakaba 1.4
3246     ~? (S) { }
3247     }
3248    
3249     ~ (MDC) {
3250     ?lexmode DTD;
3251     } else {
3252     ?lexmode DTD;
3253     }
3254     } // _NotationDeclaration
3255    
3256 wakaba 1.11 rule _EntityValue ($decl) {
3257 wakaba 1.4 ?lexmode EntityValue;
3258    
3259     my $vals;
3260 wakaba 1.6 my $reptxt;
3261 wakaba 1.4 lang:Perl {
3262     $vals = [];
3263 wakaba 1.6 $reptxt = '';
3264 wakaba 1.4 }
3265    
3266     ~* (STRING) {
3267 wakaba 1.6 lang:Perl ($v => $token.value) {
3268     $reptxt .= $v;
3269     }
3270 wakaba 1.4 } (PERO) {
3271     ?lexmode EntityDeclaration;
3272 wakaba 1.19
3273     lang:Perl {
3274     $self->{has_xref} = true;
3275     }
3276 wakaba 1.6
3277     // TODO: Expand or wferror if internal subset
3278 wakaba 1.4
3279     ~ (Name) {
3280    
3281     }
3282    
3283     ~ (REFC) {
3284     ?lexmode EntityValue;
3285     } else {
3286     ?lexmode EntityValue;
3287     }
3288     } (HCRO) {
3289 wakaba 1.11 &_HexadecimalCharacterReferenceEV_ ($vals => $vals);
3290 wakaba 1.4
3291 wakaba 1.6 lang:Perl {
3292 wakaba 1.11 $reptxt .= $vals->[-1];
3293 wakaba 1.6 }
3294    
3295 wakaba 1.4 ~ (REFC) {
3296     ?lexmode EntityValue;
3297     } else {
3298     ?lexmode EntityValue;
3299     }
3300     } (CRO) {
3301 wakaba 1.11 &_NumericCharacterReferenceEV_ ($vals => $vals);
3302 wakaba 1.6
3303     lang:Perl {
3304 wakaba 1.11 $reptxt .= $vals->[-1];
3305 wakaba 1.6 }
3306 wakaba 1.4
3307     ~ (REFC) {
3308     ?lexmode EntityValue;
3309     } else {
3310     ?lexmode EntityValue;
3311     }
3312     } (ERO) {
3313 wakaba 1.11 &_GeneralEntityReferenceEV_ ($vals => $vals);
3314 wakaba 1.4
3315 wakaba 1.6 lang:Perl {
3316 wakaba 1.11 $reptxt .= '&' . $vals->[-1] . ';';
3317 wakaba 1.6 }
3318    
3319 wakaba 1.4 ~ (REFC) {
3320     ?lexmode EntityValue;
3321     } else {
3322     ?lexmode EntityValue;
3323     }
3324     }
3325    
3326     ~ (LIT) {
3327     ?lexmode MarkupDeclaration;
3328     } (LITA) {
3329     ?lexmode MarkupDeclaration;
3330     } else {
3331     ?lexmode MarkupDeclaration;
3332     }
3333 wakaba 1.6
3334     lang:Perl {
3335     $decl->{reptxt} = \$reptxt;
3336 wakaba 1.19 $decl->{has_replacement_text} = true;
3337 wakaba 1.6 }
3338 wakaba 1.4 } // _EntityValue
3339    
3340 wakaba 1.11 rule _EntityValueA ($decl) {
3341 wakaba 1.4 ?lexmode EntityValueA;
3342    
3343     my $vals;
3344 wakaba 1.6 my $reptxt;
3345 wakaba 1.4 lang:Perl {
3346     $vals = [];
3347 wakaba 1.6 $reptxt = '';
3348 wakaba 1.4 }
3349    
3350     ~* (STRING) {
3351 wakaba 1.6 lang:Perl ($v => $token.value) {
3352     $reptxt .= $v;
3353     }
3354 wakaba 1.4 } (PERO) {
3355     ?lexmode EntityDeclaration;
3356    
3357 wakaba 1.19 lang:Perl {
3358     $self->{has_xref} = true;
3359     }
3360    
3361 wakaba 1.6 // TODO: implement this
3362 wakaba 1.4 ~ (Name) {
3363    
3364     }
3365    
3366     ~ (REFC) {
3367     ?lexmode EntityValueA;
3368     } else {
3369     ?lexmode EntityValueA;
3370     }
3371     } (HCRO) {
3372 wakaba 1.11 &_HexadecimalCharacterReferenceEV_ ($vals => $vals);
3373 wakaba 1.4
3374 wakaba 1.6 lang:Perl {
3375 wakaba 1.11 $reptxt .= $vals->[-1];
3376 wakaba 1.6 }
3377    
3378    
3379 wakaba 1.4 ~ (REFC) {
3380     ?lexmode EntityValueA;
3381     } else {
3382     ?lexmode EntityValueA;
3383     }
3384     } (CRO) {
3385 wakaba 1.11 &_NumericCharacterReferenceEV_ ($vals => $vals);
3386 wakaba 1.4
3387 wakaba 1.6 lang:Perl {
3388 wakaba 1.11 $reptxt .= $vals->[-1];
3389 wakaba 1.6 }
3390    
3391 wakaba 1.4 ~ (REFC) {
3392     ?lexmode EntityValueA;
3393     } else {
3394     ?lexmode EntityValueA;
3395     }
3396     } (ERO) {
3397 wakaba 1.11 &_GeneralEntityReferenceEV_ ($vals => $vals);
3398 wakaba 1.4
3399 wakaba 1.6 lang:Perl {
3400 wakaba 1.11 $reptxt .= '&' . $vals->[-1] . ';';
3401 wakaba 1.6 }
3402    
3403 wakaba 1.4 ~ (REFC) {
3404     ?lexmode EntityValueA;
3405     } else {
3406     ?lexmode EntityValueA;
3407     }
3408     }
3409    
3410     ~ (LITA) {
3411     ?lexmode MarkupDeclaration;
3412     } else {
3413     ?lexmode MarkupDeclaration;
3414     }
3415 wakaba 1.6
3416     lang:Perl {
3417     $decl->{reptxt} = \$reptxt;
3418 wakaba 1.19 $decl->{has_replacement_text} = true;
3419 wakaba 1.6 }
3420 wakaba 1.4 } // _EntityValueA
3421    
3422    
3423     /*
3424     XML Name
3425     */
3426     lexmode NameChar {
3427     $NameStartChar10 := [
3428     '_' ':'
3429     // Letter
3430     // BaseChar
3431     U+0041..U+005A U+0061..U+007A U+00C0..U+00D6
3432     U+00D8..U+00F6 U+00F8..U+00FF U+0100..U+0131
3433     U+0134..U+013E U+0141..U+0148 U+014A..U+017E
3434     U+0180..U+01C3 U+01CD..U+01F0 U+01F4..U+01F5
3435     U+01FA..U+0217 U+0250..U+02A8 U+02BB..U+02C1
3436     U+0386 U+0388..U+038A U+038C U+038E..U+03A1
3437     U+03A3..U+03CE U+03D0..U+03D6 U+03DA U+03DC
3438     U+03DE U+03E0 U+03E2..U+03F3 U+0401..U+040C
3439     U+040E..U+044F U+0451..U+045C U+045E..U+0481
3440     U+0490..U+04C4 U+04C7..U+04C8 U+04CB..U+04CC
3441     U+04D0..U+04EB U+04EE..U+04F5 U+04F8..U+04F9
3442     U+0531..U+0556 U+0559 U+0561..U+0586
3443     U+05D0..U+05EA U+05F0..U+05F2 U+0621..U+063A
3444     U+0641..U+064A U+0671..U+06B7 U+06BA..U+06BE
3445     U+06C0..U+06CE U+06D0..U+06D3 U+06D5
3446     U+06E5..U+06E6 U+0905..U+0939 U+093D
3447     U+0958..U+0961 U+0985..U+098C U+098F..U+0990
3448     U+0993..U+09A8 U+09AA..U+09B0 U+09B2
3449     U+09B6..U+09B9 U+09DC..U+09DD U+09DF..U+09E1
3450     U+09F0..U+09F1 U+0A05..U+0A0A U+0A0F..U+0A10
3451     U+0A13..U+0A28 U+0A2A..U+0A30 U+0A32..U+0A33
3452     U+0A35..U+0A36 U+0A38..U+0A39 U+0A59..U+0A5C
3453     U+0A5E U+0A72..U+0A74 U+0A85..U+0A8B U+0A8D
3454     U+0A8F..U+0A91 U+0A93..U+0AA8 U+0AAA..U+0AB0
3455     U+0AB2..U+0AB3 U+0AB5..U+0AB9 U+0ABD U+0AE0
3456     U+0B05..U+0B0C U+0B0F..U+0B10 U+0B13..U+0B28
3457     U+0B2A..U+0B30 U+0B32..U+0B33 U+0B36..U+0B39
3458     U+0B3D U+0B5C..U+0B5D U+0B5F..U+0B61
3459     U+0B85..U+0B8A U+0B8E..U+0B90 U+0B92..U+0B95
3460     U+0B99..U+0B9A U+0B9C U+0B9E..U+0B9F
3461     U+0BA3..U+0BA4 U+0BA8..U+0BAA U+0BAE..U+0BB5
3462     U+0BB7..U+0BB9 U+0C05..U+0C0C U+0C0E..U+0C10
3463     U+0C12..U+0C28 U+0C2A..U+0C33 U+0C35..U+0C39
3464     U+0C60..U+0C61 U+0C85..U+0C8C U+0C8E..U+0C90
3465     U+0C92..U+0CA8 U+0CAA..U+0CB3 U+0CB5..U+0CB9
3466     U+0CDE U+0CE0..U+0CE1 U+0D05..U+0D0C
3467     U+0D0E..U+0D10 U+0D12..U+0D28 U+0D2A..U+0D39
3468     U+0D60..U+0D61 U+0E01..U+0E2E U+0E30
3469     U+0E32..U+0E33 U+0E40..U+0E45 U+0E81..U+0E82
3470     U+0E84 U+0E87..U+0E88 U+0E8A U+0E8D
3471     U+0E94..U+0E97 U+0E99..U+0E9F U+0EA1..U+0EA3
3472     U+0EA5 U+0EA7 U+0EAA..U+0EAB U+0EAD..U+0EAE
3473     U+0EB0 U+0EB2..U+0EB3 U+0EBD U+0EC0..U+0EC4
3474     U+0F40..U+0F47 U+0F49..U+0F69 U+10A0..U+10C5
3475     U+10D0..U+10F6 U+1100 U+1102..U+1103
3476     U+1105..U+1107 U+1109 U+110B..U+110C
3477     U+110E..U+1112 U+113C U+113E U+1140 U+114C
3478     U+114E U+1150 U+1154..U+1155 U+1159
3479     U+115F..U+1161 U+1163 U+1165 U+1167 U+1169
3480     U+116D..U+116E U+1172..U+1173 U+1175 U+119E
3481     U+11A8 U+11AB U+11AE..U+11AF U+11B7..U+11B8
3482     U+11BA U+11BC..U+11C2 U+11EB U+11F0 U+11F9
3483     U+1E00..U+1E9B U+1EA0..U+1EF9 U+1F00..U+1F15
3484     U+1F18..U+1F1D U+1F20..U+1F45 U+1F48..U+1F4D
3485     U+1F50..U+1F57 U+1F59 U+1F5B U+1F5D
3486     U+1F5F..U+1F7D U+1F80..U+1FB4 U+1FB6..U+1FBC
3487     U+1FBE U+1FC2..U+1FC4 U+1FC6..U+1FCC
3488     U+1FD0..U+1FD3 U+1FD6..U+1FDB U+1FE0..U+1FEC
3489     U+1FF2..U+1FF4 U+1FF6..U+1FFC U+2126
3490     U+212A..U+212B U+212E U+2180..U+2182
3491     U+3041..U+3094 U+30A1..U+30FA U+3105..U+312C
3492     U+AC00..U+D7A3
3493     // Ideographic
3494     U+4E00..U+9FA5 U+3007 U+3021..U+3029
3495     ];
3496     $NameChar10 := [
3497     '.' '-' '_' ':'
3498     // Letter
3499     // BaseChar
3500     U+0041..U+005A U+0061..U+007A U+00C0..U+00D6
3501     U+00D8..U+00F6 U+00F8..U+00FF U+0100..U+0131
3502     U+0134..U+013E U+0141..U+0148 U+014A..U+017E
3503     U+0180..U+01C3 U+01CD..U+01F0 U+01F4..U+01F5
3504     U+01FA..U+0217 U+0250..U+02A8 U+02BB..U+02C1
3505     U+0386 U+0388..U+038A U+038C U+038E..U+03A1
3506     U+03A3..U+03CE U+03D0..U+03D6 U+03DA U+03DC
3507     U+03DE U+03E0 U+03E2..U+03F3 U+0401..U+040C
3508     U+040E..U+044F U+0451..U+045C U+045E..U+0481
3509     U+0490..U+04C4 U+04C7..U+04C8 U+04CB..U+04CC
3510     U+04D0..U+04EB U+04EE..U+04F5 U+04F8..U+04F9
3511     U+0531..U+0556 U+0559 U+0561..U+0586
3512     U+05D0..U+05EA U+05F0..U+05F2 U+0621..U+063A
3513     U+0641..U+064A U+0671..U+06B7 U+06BA..U+06BE
3514     U+06C0..U+06CE U+06D0..U+06D3 U+06D5
3515     U+06E5..U+06E6 U+0905..U+0939 U+093D
3516     U+0958..U+0961 U+0985..U+098C U+098F..U+0990
3517     U+0993..U+09A8 U+09AA..U+09B0 U+09B2
3518     U+09B6..U+09B9 U+09DC..U+09DD U+09DF..U+09E1
3519     U+09F0..U+09F1 U+0A05..U+0A0A U+0A0F..U+0A10
3520     U+0A13..U+0A28 U+0A2A..U+0A30 U+0A32..U+0A33
3521     U+0A35..U+0A36 U+0A38..U+0A39 U+0A59..U+0A5C
3522     U+0A5E U+0A72..U+0A74 U+0A85..U+0A8B U+0A8D
3523     U+0A8F..U+0A91 U+0A93..U+0AA8 U+0AAA..U+0AB0
3524     U+0AB2..U+0AB3 U+0AB5..U+0AB9 U+0ABD U+0AE0
3525     U+0B05..U+0B0C U+0B0F..U+0B10 U+0B13..U+0B28
3526     U+0B2A..U+0B30 U+0B32..U+0B33 U+0B36..U+0B39
3527     U+0B3D U+0B5C..U+0B5D U+0B5F..U+0B61
3528     U+0B85..U+0B8A U+0B8E..U+0B90 U+0B92..U+0B95
3529     U+0B99..U+0B9A U+0B9C U+0B9E..U+0B9F
3530     U+0BA3..U+0BA4 U+0BA8..U+0BAA U+0BAE..U+0BB5
3531     U+0BB7..U+0BB9 U+0C05..U+0C0C U+0C0E..U+0C10
3532     U+0C12..U+0C28 U+0C2A..U+0C33 U+0C35..U+0C39
3533     U+0C60..U+0C61 U+0C85..U+0C8C U+0C8E..U+0C90
3534     U+0C92..U+0CA8 U+0CAA..U+0CB3 U+0CB5..U+0CB9
3535     U+0CDE U+0CE0..U+0CE1 U+0D05..U+0D0C
3536     U+0D0E..U+0D10 U+0D12..U+0D28 U+0D2A..U+0D39
3537     U+0D60..U+0D61 U+0E01..U+0E2E U+0E30
3538     U+0E32..U+0E33 U+0E40..U+0E45 U+0E81..U+0E82
3539     U+0E84 U+0E87..U+0E88 U+0E8A U+0E8D
3540     U+0E94..U+0E97 U+0E99..U+0E9F U+0EA1..U+0EA3
3541     U+0EA5 U+0EA7 U+0EAA..U+0EAB U+0EAD..U+0EAE
3542     U+0EB0 U+0EB2..U+0EB3 U+0EBD U+0EC0..U+0EC4
3543     U+0F40..U+0F47 U+0F49..U+0F69 U+10A0..U+10C5
3544     U+10D0..U+10F6 U+1100 U+1102..U+1103
3545     U+1105..U+1107 U+1109 U+110B..U+110C
3546     U+110E..U+1112 U+113C U+113E U+1140 U+114C
3547     U+114E U+1150 U+1154..U+1155 U+1159
3548     U+115F..U+1161 U+1163 U+1165 U+1167 U+1169
3549     U+116D..U+116E U+1172..U+1173 U+1175 U+119E
3550     U+11A8 U+11AB U+11AE..U+11AF U+11B7..U+11B8
3551     U+11BA U+11BC..U+11C2 U+11EB U+11F0 U+11F9
3552     U+1E00..U+1E9B U+1EA0..U+1EF9 U+1F00..U+1F15
3553     U+1F18..U+1F1D U+1F20..U+1F45 U+1F48..U+1F4D
3554     U+1F50..U+1F57 U+1F59 U+1F5B U+1F5D
3555     U+1F5F..U+1F7D U+1F80..U+1FB4 U+1FB6..U+1FBC
3556     U+1FBE U+1FC2..U+1FC4 U+1FC6..U+1FCC
3557     U+1FD0..U+1FD3 U+1FD6..U+1FDB U+1FE0..U+1FEC
3558     U+1FF2..U+1FF4 U+1FF6..U+1FFC U+2126
3559     U+212A..U+212B U+212E U+2180..U+2182
3560     U+3041..U+3094 U+30A1..U+30FA U+3105..U+312C
3561     U+AC00..U+D7A3
3562     // Ideographic
3563     U+4E00..U+9FA5 U+3007 U+3021..U+3029
3564     // Digit
3565     U+0030..U+0039 U+0660..U+0669 U+06F0..U+06F9
3566     U+0966..U+096F U+09E6..U+09EF U+0A66..U+0A6F
3567     U+0AE6..U+0AEF U+0B66..U+0B6F U+0BE7..U+0BEF
3568     U+0C66..U+0C6F U+0CE6..U+0CEF U+0D66..U+0D6F
3569     U+0E50..U+0E59 U+0ED0..U+0ED9 U+0F20..U+0F29
3570     // CombiningChar
3571     U+0300..U+0345 U+0360..U+0361 U+0483..U+0486
3572     U+0591..U+05A1 U+05A3..U+05B9 U+05BB..U+05BD
3573     U+05BF U+05C1..U+05C2 U+05C4 U+064B..U+0652
3574     U+0670 U+06D6..U+06DC U+06DD..U+06DF
3575     U+06E0..U+06E4 U+06E7..U+06E8 U+06EA..U+06ED
3576     U+0901..U+0903 U+093C U+093E..U+094C U+094D
3577     U+0951..U+0954 U+0962..U+0963 U+0981..U+0983
3578     U+09BC U+09BE U+09BF U+09C0..U+09C4
3579     U+09C7..U+09C8 U+09CB..U+09CD U+09D7
3580     U+09E2..U+09E3 U+0A02 U+0A3C U+0A3E U+0A3F
3581     U+0A40..U+0A42 U+0A47..U+0A48 U+0A4B..U+0A4D
3582     U+0A70..U+0A71 U+0A81..U+0A83 U+0ABC
3583     U+0ABE..U+0AC5 U+0AC7..U+0AC9 U+0ACB..U+0ACD
3584     U+0B01..U+0B03 U+0B3C U+0B3E..U+0B43
3585     U+0B47..U+0B48 U+0B4B..U+0B4D U+0B56..U+0B57
3586     U+0B82..U+0B83 U+0BBE..U+0BC2 U+0BC6..U+0BC8
3587     U+0BCA..U+0BCD U+0BD7 U+0C01..U+0C03
3588     U+0C3E..U+0C44 U+0C46..U+0C48 U+0C4A..U+0C4D
3589     U+0C55..U+0C56 U+0C82..U+0C83 U+0CBE..U+0CC4
3590     U+0CC6..U+0CC8 U+0CCA..U+0CCD U+0CD5..U+0CD6
3591     U+0D02..U+0D03 U+0D3E..U+0D43 U+0D46..U+0D48
3592     U+0D4A..U+0D4D U+0D57 U+0E31 U+0E34..U+0E3A
3593     U+0E47..U+0E4E U+0EB1 U+0EB4..U+0EB9
3594     U+0EBB..U+0EBC U+0EC8..U+0ECD U+0F18..U+0F19
3595     U+0F35 U+0F37 U+0F39 U+0F3E U+0F3F
3596     U+0F71..U+0F84 U+0F86..U+0F8B U+0F90..U+0F95
3597     U+0F97 U+0F99..U+0FAD U+0FB1..U+0FB7 U+0FB9
3598     U+20D0..U+20DC U+20E1 U+302A..U+302F U+3099
3599     U+309A
3600     // Extender
3601     U+00B7 U+02D0 U+02D1 U+0387 U+0640 U+0E46
3602     U+0EC6 U+3005 U+3031..U+3035 U+309D..U+309E
3603     U+30FC..U+30FE
3604     ];
3605 wakaba 1.1
3606     $NameStartChar11 := [
3607     ':' '_'
3608     'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M'
3609     'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z'
3610     'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm'
3611     'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z'
3612     U+00C0..U+00D6 U+00D8..U+00F6 U+00F8..U+02FF
3613     U+0370..U+037D U+037F..U+1FFF U+200C..U+200D
3614     U+2070..U+218F U+2C00..U+2FEF U+3001..U+D7FF
3615     U+F900..U+FDCF U+FDF0..U+FFFD U+10000..U+EFFFF
3616     ];
3617     $NameChar11 := [
3618     '-' '.' '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'
3619     U+00B7 U+0300..U+036F U+203F..U+2040
3620     // NameStartChar
3621     ':' '_'
3622     'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M'
3623     'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z'
3624     'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm'
3625     'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z'
3626     U+00C0..U+00D6 U+00D8..U+00F6 U+00F8..U+02FF
3627     U+0370..U+037D U+037F..U+1FFF U+200C..U+200D
3628     U+2070..U+218F U+2C00..U+2FEF U+3001..U+D7FF
3629     U+F900..U+FDCF U+FDF0..U+FFFD U+10000..U+EFFFF
3630     ];
3631 wakaba 1.4 } // NameChar
3632    
3633     lexmode Name
3634     : extends => 'NameChar'
3635     {
3636 wakaba 1.1 Name : value := $NameStartChar11 $NameChar11*;
3637     } // Name
3638 wakaba 1.4
3639     lexmode Nmtoken
3640     : extends => 'NameChar'
3641     {
3642     Nmtoken : value := $NameChar11*;
3643     } // Nmtoken
3644 wakaba 1.1
3645     /*
3646 wakaba 1.14 S
3647 wakaba 1.1 */
3648     lexmode S {
3649 wakaba 1.14 $s := [U+0009 U+000A U+000D U+0020];
3650     S := $s+;
3651 wakaba 1.1 } // S
3652    
3653     /*
3654     Document end scanning mode
3655     */
3656     lexmode DocumentEnd
3657     : standalone
3658     : extends => 'S'
3659     {
3660     /*
3661     Processing instruction
3662     */
3663     PIO := ['<'] ['?'];
3664    
3665     /*
3666     Comment declaration
3667     */
3668     CDO := ['<'] ['!'] ['-'] ['-'];
3669     } // DocumentEnd
3670    
3671     /*
3672     Document misc scanning mode
3673    
3674     This mode scans |Misc| constructions as well
3675     as document element's start tag.
3676     */
3677     lexmode DocumentMisc
3678     : standalone
3679     : extends => 'DocumentEnd'
3680     {
3681     /*
3682     Document element start tag
3683     */
3684     STAGO := ['<'];
3685     } // DocumentMisc
3686    
3687     /*
3688     Document prolog scanning mode
3689     */
3690     lexmode DocumentProlog
3691     : standalone
3692     : extends => 'DocumentMisc'
3693     {
3694     /*
3695     |DOCTYPE| declaration
3696     */
3697     MDO := ['<'] ['!'];
3698     } // DocumentProlog
3699 wakaba 1.16
3700 wakaba 1.1 /*
3701 wakaba 1.16 Document Start Scanning Mode
3702 wakaba 1.1 */
3703     lexmode DocumentStart
3704     : standalone
3705     : extends => 'DocumentProlog'
3706     {
3707     /*
3708     XML declaration
3709     */
3710 wakaba 1.16 XDO := ['<'] ['?'] ['x'] ['m'] ['l'];
3711 wakaba 1.1 } // DocumentStart
3712    
3713     /*
3714     Comment declaration scanning mode
3715     */
3716     lexmode CommentDeclaration
3717     : standalone
3718     {
3719     /*
3720     Comment close
3721     */
3722     COM := ['-'] ['-'];
3723    
3724     /*
3725     Comment data
3726     */
3727 wakaba 1.15 ?default-token STRING : value;
3728 wakaba 1.1 } // CommentDeclaration
3729    
3730     /*
3731     Processing instruction name and |S| scanning mode
3732     */
3733     lexmode PIName
3734     : standalone
3735     : extends => 'Name'
3736     : extends => 'S'
3737     {
3738     /*
3739     Processing instruction close
3740     */
3741     PIC := ['?'] ['>'];
3742     } // PIName
3743    
3744     /*
3745 wakaba 1.16 Processing instruction name and |S| scanning mode
3746     */
3747     lexmode PINmtoken
3748     : standalone
3749     : extends => 'Nmtoken'
3750     : extends => 'S'
3751     {
3752     /*
3753     Processing instruction close
3754     */
3755     PIC := ['?'] ['>'];
3756     } // PINmtoken
3757    
3758     /*
3759 wakaba 1.1 Processing instruction data scanning mode
3760     */
3761     lexmode PIData
3762     : standalone
3763     {
3764     /*
3765     Processing instruction close
3766     */
3767     PIC := ['?'] ['>'];
3768    
3769     /*
3770     Processing instruction target data
3771     */
3772 wakaba 1.2 ?default-token DATA : value;
3773 wakaba 1.1 } // PIData
3774    
3775     /*
3776     Content of element scanning mode
3777     */
3778     lexmode ElementContent
3779     : standalone
3780     {
3781     /*
3782     Start tag open
3783     */
3784     STAGO := ['<'];
3785    
3786     /*
3787     End tag open
3788     */
3789     ETAGO := ['<'] ['/'];
3790    
3791     /*
3792     Hexadecimal character reference open
3793     */
3794     HCRO := ['&'] ['#'] ['x'];
3795    
3796     /*
3797     Numeric character reference open
3798     */
3799     CRO := ['&'] ['#'];
3800    
3801     /*
3802     General entity reference open
3803     */
3804     ERO := ['&'];
3805    
3806     /*
3807     Comment declaration open
3808     */
3809     CDO := ['<'] ['!'] ['-'] ['-'];
3810    
3811     /*
3812     CDATA section open
3813     */
3814     CDSO := ['<'] ['!'] ['[']
3815     ['C'] ['D'] ['A'] ['T'] ['A'] ['['];
3816    
3817     /*
3818     Processing instruction open
3819     */
3820     PIO := ['<'] ['?'];
3821 wakaba 1.2
3822     /*
3823     Markup section end
3824     */
3825     MSE := [']'] [']'] ['>'];
3826    
3827     /*
3828     Character data
3829     */
3830     /*
3831     Character data and/or |MSE|
3832     */
3833     ?default-token CharData : value;
3834 wakaba 1.1 } // ElementContent
3835    
3836     /*
3837     CDATA section content scanning mode
3838     */
3839     lexmode CDATASectionContent
3840     : standalone
3841     {
3842     /*
3843     Markup section end
3844     */
3845     MSE := [']'] [']'] ['>'];
3846    
3847     /*
3848     Character data
3849 wakaba 1.2 */
3850     ?default-token CData : value;
3851 wakaba 1.1 } // CDATASectionContent
3852    
3853     lexmode EntityReference
3854     : standalone
3855     : extends => 'Name'
3856     {
3857     /*
3858     Reference close
3859     */
3860     REFC := [';'];
3861     } // EntityReference
3862    
3863     lexmode NumericCharacterReference
3864     : standalone
3865     {
3866     /*
3867     Decimal number
3868     */
3869     $digit := ['0' '1' '2' '3' '4' '5' '6' '7' '8' '9'];
3870     NUMBER : value := $digit+;
3871    
3872     /*
3873     Reference close
3874     */
3875     REFC := [';'];
3876     } // NumericCharacterReference
3877    
3878     lexmode HexadecimalCharacterReference
3879     : standalone
3880     {
3881     /*
3882     Hexadecimal number
3883     */
3884     $hexdigit := ['0' '1' '2' '3' '4' '5' '6' '7' '8' '9'
3885     'A' 'B' 'C' 'D' 'E' 'F'
3886     'a' 'b' 'c' 'd' 'e' 'f'];
3887     Hex : value := $hexdigit+;
3888    
3889     /*
3890     Reference close
3891     */
3892     REFC := [';'];
3893     } // HexadecimalCharacterReference
3894    
3895 wakaba 1.16 /*
3896     The XML Declaration and Text Declaration Scanning Mode
3897     */
3898 wakaba 1.3 lexmode XMLDeclaration
3899     : standalone
3900     : extends => 'Name'
3901     : extends => 'S'
3902     {
3903    
3904     /*
3905     Value indicator
3906     */
3907     VI := ['='];
3908    
3909     /*
3910     Literal open
3911     */
3912     LIT := ['"'];
3913     LITA := [U+0027];
3914    
3915     /*
3916     Processing instruction close
3917 wakaba 1.16
3918     The |PIC|, i.e. |?>|, is split into two tokens |PIC1| and |PIC2|
3919     in this scanning mode to set |no_xml11_eol| flag in the
3920     |_XMLDeclaration_| |rule|.
3921 wakaba 1.3 */
3922 wakaba 1.16 PIC1 := ['?'];
3923     PIC2 := ['>'];
3924 wakaba 1.3 } // XMLDeclaration
3925 wakaba 1.16
3926     /*
3927     The XML Declaration or Processing Instruction Scanning Mode
3928    
3929     '<?xml' S ...
3930     (DocumentStart) (XMLDeclarationOrPI) (XMLDeclaration)
3931     '<?xml' '1' S ...
3932     (DocumentStart) (XMLDeclarationOrPI) (PINmtoken)(PIName) (PITarget)
3933     '<?xml' '-' 'stylesheet' S ...
3934     (DocumentStart) (XMLDeclarationOrPI) (PINmtoken) (PIName) (PITarget)
3935     */
3936     lexmode XMLDeclarationOrPI
3937     : standalone
3938     : extends => 'NameChar'
3939     : extends => 'S'
3940     {
3941     NameChar : value := $NameChar11;
3942     } // XMLDeclarationOrPI
3943 wakaba 1.3
3944 wakaba 1.1 lexmode StartTag
3945     : standalone
3946     : extends => 'Name'
3947     : extends => 'S'
3948     {
3949    
3950     /*
3951     Value indicator
3952     */
3953     VI := ['='];
3954    
3955     /*
3956     Literal open
3957     */
3958     LIT := ['"'];
3959     LITA := [U+0027];
3960    
3961     /*
3962     Tag close
3963     */
3964     TAGC := ['>'];
3965    
3966     /*
3967 wakaba 1.6 Null end-tag enabled start-tag close
3968 wakaba 1.1 */
3969 wakaba 1.6 NESTC := ['/'];
3970 wakaba 1.1 } // StartTag
3971    
3972     lexmode EndTag
3973     : standalone
3974     : extends => 'Name'
3975     : extends => 'S'
3976     {
3977     /*
3978     Tag close
3979     */
3980     TAGC := ['>'];
3981     } // EndTag
3982    
3983     lexmode AttributeValueLiteral_ {
3984     ERO := ['&'];
3985     CRO := ['&'] ['#'];
3986     HCRO := ['&'] ['#'] ['x'];
3987     } // AttributeValueLiteral_
3988    
3989     lexmode AttributeValueLiteral
3990     : standalone
3991     : extends => 'AttributeValueLiteral_'
3992     {
3993     LIT := ['"'];
3994 wakaba 1.3 STRING : value := [^'"' '&' '<']+;
3995 wakaba 1.1 } // AttributeValueLiteral
3996    
3997     lexmode AttributeValueLiteralA
3998     : standalone
3999     : extends => 'AttributeValueLiteral_'
4000     {
4001 wakaba 1.4 LITA := [U+0027];
4002 wakaba 1.3 STRING : value := [^U+0027 '&' '<']+;
4003 wakaba 1.1 } // AttributeValueLiteralA
4004 wakaba 1.11
4005     lexmode AttributeValueLiteralE
4006     : standalone
4007     : extends => 'AttributeValueLiteral_'
4008     {
4009     STRING : value := [^'&' '<']+;
4010     } // AttributeValueLiteralE
4011 wakaba 1.4
4012     lexmode EntityValue_ {
4013     PERO := ['%'];
4014     ERO := ['&'];
4015     CRO := ['&'] ['#'];
4016     HCRO := ['&'] ['#'] ['x'];
4017     } // EntityValue_
4018    
4019     lexmode EntityValue
4020     : standalone
4021     : extends => 'EntityValue_'
4022     {
4023     LIT := ['"'];
4024     STRING : value := [^'"' '&' '%']+;
4025     } // EntityValue
4026    
4027     lexmode EntityValueA
4028     : standalone
4029     : extends => 'EntityValue_'
4030     {
4031     LITA := [U+0027];
4032     STRING : value := [^U+0027 '&' '%']+;
4033     } // EntityValueA
4034    
4035     lexmode SystemLiteral
4036     : standalone
4037     {
4038     LIT := ['"'];
4039     ?default-token STRING : value;
4040     } // SystemLiteral
4041    
4042     lexmode SystemLiteralA
4043     : standalone
4044     {
4045     LITA := [U+0027];
4046     ?default-token STRING : value;
4047     } // SystemLiteralA
4048    
4049     lexmode DTD
4050     : standalone
4051     : extends => 'S'
4052     {
4053     /*
4054     Markup declaration open
4055     */
4056     MDO := ['<'] ['!'];
4057    
4058     /*
4059     Comment declaration open
4060     */
4061     CDO := ['<'] ['!'] ['-'] ['-'];
4062    
4063     /*
4064     Processing instruction open
4065     */
4066     PIO := ['<'] ['?'];
4067    
4068     /*
4069     Parameter entity reference open
4070     */
4071     PERO := ['%'];
4072    
4073     /*
4074     Declaration subset close
4075     */
4076     DSC := [']'];
4077    
4078     /*
4079     Contition section open
4080     */
4081     CSO := ['<'] ['!'] ['['];
4082     } // DTD
4083    
4084     /*
4085     Markup declaration scanning mode
4086    
4087     This mode is used to recognize |MDC| that terminates
4088     a comment declaration as well as the base |lexmode|
4089     for e.g. document type declaration scanning mode.
4090     */
4091     lexmode MarkupDeclaration
4092     : standalone
4093     : extends => 'Name'
4094     : extends => 'S'
4095     {
4096     /*
4097     Markup declaration close
4098     */
4099     MDC := ['>'];
4100    
4101     /*
4102     Literal open
4103     */
4104     LIT := ['"'];
4105    
4106     /*
4107     Alternative literal open
4108     */
4109     LITA := [U+0027];
4110    
4111     /*
4112     Parameter entity reference open
4113     */
4114     PERO := ['%'];
4115    
4116     /*
4117     Declaration subset open
4118     */
4119     DSO := ['['];
4120     } // MarkupDeclaration
4121    
4122     lexmode ElementDeclaration
4123     : standalone
4124     : extends => 'MarkupDeclaration'
4125     {
4126     /*
4127     Model group open
4128     */
4129     MGO := ['('];
4130    
4131     /*
4132     Model group close
4133     */
4134     MGC := [')'];
4135    
4136     /*
4137     Reserved name indicator
4138     */
4139     RNI := ['#'];
4140    
4141     /*
4142     Occurence indicators
4143     */
4144     OPT := ['?'];
4145     REP := ['*'];
4146     PLUS := ['+'];
4147    
4148     /*
4149     Connectors
4150     */
4151     OR := ['|'];
4152     SEQ := [','];
4153     } // ElementDeclaration
4154    
4155     lexmode AttlistDeclaration
4156     : standalone
4157     : extends => 'MarkupDeclaration'
4158     {
4159     /*
4160     Enumeration group open
4161     */
4162     EGO := ['('];
4163    
4164     /*
4165     Enumeration group close
4166     */
4167     EGC := [')'];
4168    
4169     /*
4170     Enumeration choice delimiter
4171     */
4172     OR := ['|'];
4173    
4174     /*
4175     Reserved name indicator
4176     */
4177     RNI := ['#'];
4178     } // AttlistDeclaration
4179    
4180     lexmode Enumeration
4181     : standalone
4182     : extends => 'Nmtoken'
4183     : extends => 'S'
4184     {
4185     /*
4186     Enumeration group close
4187     */
4188     EGC := [')'];
4189    
4190     /*
4191     Enumeration choice delimiter
4192     */
4193     OR := ['|'];
4194     } // Enumeration
4195    
4196 wakaba 1.1
4197     token-error default : default {
4198     lang:Perl {
4199 wakaba 1.3 my $location;
4200     __CODE{xp|get-location-from-token::
4201     $token => {$token},
4202     $result => {$location},
4203     }__;
4204     my $continue = __DOMCore:ERROR{xp|wf-syntax-error::
4205 wakaba 1.1 xp|error-token => {$token},
4206     DOMCore|location => {$location},
4207     }__;
4208     unless ($continue) {
4209     __EXCEPTION{DOMLS|PARSE_ERR::
4210     }__;
4211     }
4212     }
4213     } // default
4214 wakaba 1.5
4215     @XMLTests:
4216     @@XMLTest:
4217 wakaba 1.15 @@@QName: xp.char.xml10.test
4218     @@@DEnt:
4219     @@@@test:value:
4220     <?xml version="1.0"?>
4221     <p>$u0009$u000A$u000D$u0020$uD7FF$uE000$uFFFD$U00010000$U0010FFFF</p>
4222     @@@test:domTree:
4223     document {
4224     xml-version: '1.0';
4225     element {
4226     text-content: U+0009 U+000A U+000A U+0020 U+D7FF
4227     U+E000 U+FFFD U+10000 U+10FFFF;
4228     }
4229     }
4230     @@XMLTest:
4231     @@@QName: xp.char.xml11.test
4232     @@@DEnt:
4233     @@@@test:value:
4234     <?xml version="1.1"?>
4235     <p>$u0009$u000A$u000D$u0020$uD7FF$uE000$uFFFD$U00010000$U0010FFFF</p>
4236     @@@test:domTree:
4237     document {
4238     xml-version: '1.1';
4239     element {
4240     text-content: U+0009 U+000A U+000A U+0020 U+D7FF
4241     U+E000 U+FFFD U+10000 U+10FFFF;
4242     }
4243     }
4244     @@XMLTest:
4245     @@@QName: xp.char.xml10.c0.test
4246     @@@DEnt:
4247     @@@@test:value:
4248     <?xml version="1.0"?>
4249     <p>$u0000$u0001$u0002$u0003$u0004$u0005$u0006$u0007$u0008$u000B$
4250     $u000C$u000E$u000F$u0010$u0011$u0012$u0013$u0014$u0015$u0016$
4251     $u0017$u0018$u0019$u001A$u001B$u001C$u001D$u001E$u001F</p>
4252     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 4); } /* U+0000 */
4253     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 5); } /* U+0001 */
4254     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 6); } /* U+0002 */
4255     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 7); } /* U+0003 */
4256     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 8); } /* U+0004 */
4257     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 9); } /* U+0005 */
4258     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 10); } /* U+0006 */
4259     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 11); } /* U+0007 */
4260     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 12); } /* U+0008 */
4261     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 13); } /* U+000B */
4262     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 14); } /* U+000C */
4263     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 15); } /* U+000E */
4264     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 16); } /* U+000F */
4265     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 17); } /* U+0010 */
4266     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 18); } /* U+0011 */
4267     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 19); } /* U+0012 */
4268     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 20); } /* U+0013 */
4269     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 21); } /* U+0014 */
4270     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 22); } /* U+0015 */
4271     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 23); } /* U+0016 */
4272     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 24); } /* U+0017 */
4273     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 25); } /* U+0018 */
4274     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 26); } /* U+0019 */
4275     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 27); } /* U+001A */
4276     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 28); } /* U+001B */
4277     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 29); } /* U+001C */
4278     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 30); } /* U+001D */
4279     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 31); } /* U+001E */
4280     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 32); } /* U+001F */
4281     @@XMLTest:
4282     @@@QName: xp.char.xml11.c0.test
4283     @@@DEnt:
4284     @@@@test:value:
4285     <?xml version="1.1"?>
4286     <p>$u0000$u0001$u0002$u0003$u0004$u0005$u0006$u0007$u0008$u000B$
4287     $u000C$u000E$u000F$u0010$u0011$u0012$u0013$u0014$u0015$u0016$
4288     $u0017$u0018$u0019$u001A$u001B$u001C$u001D$u001E$u001F</p>
4289     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 4); } /* U+0000 */
4290     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 5); } /* U+0001 */
4291     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 6); } /* U+0002 */
4292     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 7); } /* U+0003 */
4293     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 8); } /* U+0004 */
4294     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 9); } /* U+0005 */
4295     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 10); } /* U+0006 */
4296     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 11); } /* U+0007 */
4297     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 12); } /* U+0008 */
4298     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 13); } /* U+000B */
4299     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 14); } /* U+000C */
4300     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 15); } /* U+000E */
4301     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 16); } /* U+000F */
4302     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 17); } /* U+0010 */
4303     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 18); } /* U+0011 */
4304     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 19); } /* U+0012 */
4305     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 20); } /* U+0013 */
4306     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 21); } /* U+0014 */
4307     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 22); } /* U+0015 */
4308     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 23); } /* U+0016 */
4309     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 24); } /* U+0017 */
4310     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 25); } /* U+0018 */
4311     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 26); } /* U+0019 */
4312     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 27); } /* U+001A */
4313     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 28); } /* U+001B */
4314     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 29); } /* U+001C */
4315     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 30); } /* U+001D */
4316     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 31); } /* U+001E */
4317     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 32); } /* U+001F */
4318     @@XMLTest:
4319     @@@QName: xp.char.xml10.c1.test
4320     @@@DEnt:
4321     @@@@test:value:
4322     <?xml version="1.0"?>
4323     <p>$u007F$u0080$u0081$u0082$u0083$u0084$u0086$u0087$u0088$
4324     $u0089$u008A$u008B$u008C$
4325     $u008D$u008E$u008F$u0090$u0091$u0092$u0093$u0094$u0095$u0096$
4326     $u0097$u0098$u0099$u009A$u009B$u009C$u009D$u009E$u009F$u0085</p>
4327     @@@test:domTree:
4328     document {
4329     xml-version: '1.0';
4330     element {
4331     text-content: U+007F U+0080 U+0081 U+0082 U+0083 U+0084 U+0086
4332     U+0087 U+0088 U+0089 U+008A U+008B U+008C U+008D
4333     U+008E U+008F U+0090 U+0091 U+0092 U+0093 U+0094
4334     U+0095 U+0096 U+0097 U+0098 U+0099 U+009A U+009B
4335     U+009C U+009D U+009E U+009F U+0085;
4336     }
4337     }
4338     @@XMLTest:
4339     @@@QName: xp.char.xml11.c1.test
4340     @@@DEnt:
4341     @@@@test:value:
4342     <?xml version="1.1"?>
4343     <p>$u007F$u0080$u0081$u0082$u0083$u0084$u0086$u0087$u0088$
4344     $u0089$u008A$u008B$u008C$
4345     $u008D$u008E$u008F$u0090$u0091$u0092$u0093$u0094$u0095$u0096$
4346     $u0097$u0098$u0099$u009A$u009B$u009C$u009D$u009E$u009F$u0085</p>
4347     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 4); } /* U+007F */
4348     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 5); } /* U+0080 */
4349     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 6); } /* U+0081 */
4350     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 7); } /* U+0082 */
4351     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 8); } /* U+0083 */
4352     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 9); } /* U+0084 */
4353     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 10); } /* U+0086 */
4354     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 11); } /* U+0087 */
4355     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 12); } /* U+0088 */
4356     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 13); } /* U+0089 */
4357     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 14); } /* U+008A */
4358     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 15); } /* U+008B */
4359     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 16); } /* U+008C */
4360     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 17); } /* U+008D */
4361     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 18); } /* U+008E */
4362     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 19); } /* U+008F */
4363     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 20); } /* U+0090 */
4364     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 21); } /* U+0091 */
4365     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 22); } /* U+0092 */
4366     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 23); } /* U+0093 */
4367     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 24); } /* U+0094 */
4368     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 25); } /* U+0095 */
4369     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 26); } /* U+0096 */
4370     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 27); } /* U+0097 */
4371     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 28); } /* U+0098 */
4372     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 29); } /* U+0099 */
4373     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 30); } /* U+009A */
4374     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 31); } /* U+009B */
4375     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 32); } /* U+009C */
4376     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 33); } /* U+009D */
4377     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 34); } /* U+009E */
4378     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 35); } /* U+009F */
4379    
4380     @@XMLTest:
4381 wakaba 1.12 @@@QName: xp.syntax.empty.test
4382     @@@DEnt:
4383     @@@@test:value: \
4384     @@@c:erred:
4385     <[[xp:wf-syntax-error]]> { (1, 1); }
4386     @@XMLTest:
4387     @@@QName: xp.syntax.space.test
4388     @@@DEnt:
4389 wakaba 1.13 @@@@test:value: \
4390 wakaba 1.12 @@@c:erred:
4391     <[[xp:wf-syntax-error]]> { (1, 4); }
4392     @@XMLTest:
4393     @@@QName: xp.syntax.newlines.test
4394     @@@DEnt:
4395     @@@@test:value:
4396     \
4397     \
4398     \
4399     @@@c:erred:
4400     <[[xp:wf-syntax-error]]> { (3, 1); }
4401    
4402     @@XMLTest:
4403 wakaba 1.6 @@@QName: xp.only.docel.test
4404 wakaba 1.5 @@@DEnt:
4405     @@@@test:value:
4406     <p></p>
4407     @@@test:domTree:
4408     document {
4409     xml-version: '1.0';
4410 wakaba 1.6 xml-encoding: null;
4411     xml-standalone: false;
4412     element {
4413     namespace-uri: null;
4414     prefix: null;
4415     local-name: 'p';
4416     text-content: '';
4417     }
4418     }
4419     @@XMLTest:
4420     @@@QName: xp.only.docel.emptyelemtag.test
4421     @@@DEnt:
4422     @@@@test:value:
4423     <p/>
4424     @@@test:domTree:
4425     document {
4426     xml-version: '1.0';
4427     xml-encoding: null;
4428     xml-standalone: false;
4429 wakaba 1.5 element {
4430     namespace-uri: null;
4431     prefix: null;
4432     local-name: 'p';
4433     text-content: '';
4434     }
4435     }
4436 wakaba 1.15 @@XMLTest:
4437     @@@QName: xp.root.s.1.test
4438     @@@DEnt:
4439     @@@@test:value:
4440     <?xml version="1.0"?>$u0020$u000D$u000A$u0009
4441     <p></p>
4442     @@@test:domTree:
4443     document {
4444     element { }
4445     }
4446    
4447     @@XMLTest:
4448     @@@QName: xp.Name.1.test
4449     @@@DEnt:
4450     @@@@test:value: <name/>
4451     @@@test:domTree:
4452     document {
4453     element {
4454     node-name: 'name';
4455     }
4456     }
4457     @@XMLTest:
4458     @@@QName: xp.Name.2.test
4459     @@@DEnt:
4460     @@@@test:value: <name0/>
4461     @@@test:domTree:
4462     document {
4463     element {
4464     node-name: 'name0';
4465     }
4466     }
4467     @@enImplNote:
4468     @@@ddid: xml11name
4469     @@@@:
4470     {TODO:: XML 1.1 Name tests required
4471     }
4472    
4473     @@XMLTest:
4474     @@@QName: xp.content.mse.1.test
4475     @@@DEnt:
4476     @@@@test:value:
4477     <p>]]></p>
4478     @@@c:erred:
4479     <[[xp|wf-syntax-error]]> { (1, 4)..(1, 6); }
4480     @@XMLTest:
4481     @@@QName: xp.content.mse.2.test
4482     @@@DEnt:
4483     @@@@test:value:
4484     <p>aaa]]>bbb</p>
4485     @@@c:erred:
4486     <[[xp|wf-syntax-error]]> { (1, 7)..(1, 9); }
4487    
4488     @@XMLTest:
4489     @@@QName: xp.root.comment.1.test
4490     @@@DEnt:
4491     @@@@test:value:
4492     <!--comment data-->
4493     <p/>
4494     @@@test:domTree:
4495     document {
4496     comment {
4497     data: 'comment data';
4498     }
4499     element { }
4500     }
4501     @@XMLTest:
4502     @@@QName: xp.root.comment.2.test
4503     @@@DEnt:
4504     @@@@test:value:
4505     <!---->
4506     <p/>
4507     @@@test:domTree:
4508     document {
4509     comment {
4510     data: '';
4511     }
4512     element { }
4513     }
4514     @@XMLTest:
4515     @@@QName: xp.root.after.pi.comment.1.test
4516     @@@DEnt:
4517     @@@@test:value:
4518     <?pi?>
4519     <!--comment data-->
4520     <p/>
4521     @@@test:domTree:
4522     document {
4523     pi { }
4524     comment {
4525     data: 'comment data';
4526     }
4527     element { }
4528     }
4529     @@XMLTest:
4530     @@@QName: xp.root.after.pi.comment.2.test
4531     @@@DEnt:
4532     @@@@test:value:
4533     <?pi?>
4534     <!---->
4535     <p/>
4536     @@@test:domTree:
4537     document {
4538     pi { }
4539     comment {
4540     data: '';
4541     }
4542     element { }
4543     }
4544     @@XMLTest:
4545     @@@QName: xp.root.after.element.comment.1.test
4546     @@@DEnt:
4547     @@@@test:value:
4548     <p/>
4549     <!--comment data-->
4550     @@@test:domTree:
4551     document {
4552     element { }
4553     comment {
4554     data: 'comment data';
4555     }
4556     }
4557     @@XMLTest:
4558     @@@QName: xp.root.after.element.comment.2.test
4559     @@@DEnt:
4560     @@@@test:value:
4561     <p/>
4562     <!---->
4563     @@@test:domTree:
4564     document {
4565     element { }
4566     comment {
4567     data: '';
4568     }
4569     }
4570     @@XMLTest:
4571     @@@QName: xp.doctype.intsubset.comment.1.test
4572     @@@DEnt:
4573     @@@@test:value:
4574     <!DOCTYPE a [
4575     <!--comment data-->
4576     ]>
4577     <p/>
4578     @@@test:domTree:
4579     document {
4580     document-type { }
4581     element { }
4582     }
4583     @@XMLTest:
4584     @@@QName: xp.doctype.intsubset.comment.2.test
4585     @@@DEnt:
4586     @@@@test:value:
4587     <!DOCTYPE a [
4588     <!---->
4589     ]>
4590     <p/>
4591     @@@test:domTree:
4592     document {
4593     document-type { }
4594     element { }
4595     }
4596     @@XMLTest:
4597     @@@QName: xp.doctype.intsubset.comment.3.test
4598     @@@DEnt:
4599     @@@@test:value:
4600     <!DOCTYPE a [
4601     <?pi?>
4602     <!---->
4603     ]>
4604     <p/>
4605     @@@test:domTree:
4606     document {
4607     document-type {
4608     pi { }
4609     }
4610     element { }
4611     }
4612     @@XMLTest:
4613     @@@QName: xp.content.comment.1.test
4614     @@@DEnt:
4615     @@@@test:value:
4616     <p><!--comment data--></p>
4617     @@@test:domTree:
4618     document {
4619     element {
4620     comment {
4621     data: 'comment data';
4622     }
4623     }
4624     }
4625     @@XMLTest:
4626     @@@QName: xp.content.comment.2.test
4627     @@@DEnt:
4628     @@@@test:value:
4629     <p><!----></p>
4630     @@@test:domTree:
4631     document {
4632     element {
4633     comment {
4634     data: '';
4635     }
4636     }
4637     }
4638     @@XMLTest:
4639     @@@QName: xp.content.comment.3.test
4640     @@@DEnt:
4641     @@@@test:value:
4642     <p>aaaaa<!---->bbbbb</p>
4643     @@@test:domTree:
4644     document {
4645     element {
4646     text {
4647     data: 'aaaaa';
4648     }
4649     comment {
4650     data: '';
4651     }
4652     text {
4653     data: 'bbbbb';
4654     }
4655     }
4656     }
4657     @@XMLTest:
4658     @@@QName: xp.content.comment.--.1.test
4659     @@@DEnt:
4660     @@@@test:value:
4661     <p><!--data--data--></p>
4662     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 12)..(1, 17); }
4663     @@XMLTest:
4664     @@@QName: xp.content.comment.---gt.test
4665     @@@DEnt:
4666     @@@@test:value:
4667     <p><!--data---></p>
4668     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 12)..(1, 15); }
4669 wakaba 1.13
4670     @@XMLTest:
4671     @@@QName: xp.xmldecl.version.1.0.test
4672     @@@DEnt:
4673     @@@@test:value:
4674     <?xml version="1.0"?>
4675     <p></p>
4676     @@@test:domTree:
4677     document {
4678     xml-version: '1.0';
4679     xml-encoding: null;
4680     xml-standalone: false;
4681     element { }
4682     }
4683     @@XMLTest:
4684     @@@QName: xp.xmldecl.version.1.0.lita.test
4685     @@@DEnt:
4686     @@@@test:value:
4687     <?xml version='1.0'?>
4688     <p></p>
4689     @@@test:domTree:
4690     document {
4691     xml-version: '1.0';
4692     xml-encoding: null;
4693     xml-standalone: false;
4694     element { }
4695     }
4696     @@XMLTest:
4697     @@@QName: xp.xmldecl.version.1.0.s.test
4698     @@@DEnt:
4699     @@@@test:value:
4700     <?xml version = "1.0" ?>
4701     <p></p>
4702     @@@test:domTree:
4703     document {
4704     xml-version: '1.0';
4705     xml-encoding: null;
4706     xml-standalone: false;
4707     element { }
4708     }
4709     @@XMLTest:
4710     @@@QName: xp.xmldecl.version.1.1.test
4711     @@@DEnt:
4712     @@@@test:value:
4713     <?xml version="1.1"?>
4714     <p></p>
4715     @@@test:domTree:
4716     document {
4717     xml-version: '1.1';
4718     xml-encoding: null;
4719     xml-standalone: false;
4720     element { }
4721     }
4722    
4723     @@XMLTest:
4724     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.test
4725     @@@DEnt:
4726     @@@@test:value:
4727     <?xml version="1.0" encoding="US-ascii"?>
4728     <p></p>
4729     @@@test:domTree:
4730     document {
4731     xml-version: '1.0';
4732     xml-encoding: 'US-ascii';
4733     xml-standalone: false;
4734     element { }
4735     }
4736     @@XMLTest:
4737     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.lita.test
4738     @@@DEnt:
4739     @@@@test:value:
4740     <?xml version="1.0" encoding='US-ascii'?>
4741     <p></p>
4742     @@@test:domTree:
4743     document {
4744     xml-version: '1.0';
4745     xml-encoding: 'US-ascii';
4746     xml-standalone: false;
4747     element { }
4748     }
4749     @@XMLTest:
4750     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.s.test
4751     @@@DEnt:
4752     @@@@test:value:
4753     <?xml version="1.0" encoding = "US-ascii" ?>
4754     <p></p>
4755     @@@test:domTree:
4756     document {
4757     xml-version: '1.0';
4758     xml-encoding: 'US-ascii';
4759     xml-standalone: false;
4760     element { }
4761     }
4762    
4763     @@XMLTest:
4764     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.standalone.yes.test
4765     @@@DEnt:
4766     @@@@test:value:
4767     <?xml version="1.0" encoding="us-ascii" standalone="yes"?>
4768     <p></p>
4769     @@@test:domTree:
4770     document {
4771     xml-version: '1.0';
4772     xml-encoding: 'us-ascii';
4773     xml-standalone: true;
4774     element { }
4775     }
4776     @@XMLTest:
4777     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.standalone.no.test
4778     @@@DEnt:
4779     @@@@test:value:
4780     <?xml version="1.0" encoding="us-ascii" standalone="no"?>
4781     <p></p>
4782     @@@test:domTree:
4783     document {
4784     xml-version: '1.0';
4785     xml-encoding: 'us-ascii';
4786     xml-standalone: false;
4787     element { }
4788     }
4789     @@XMLTest:
4790     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.standalone.yes.lita.test
4791     @@@DEnt:
4792     @@@@test:value:
4793     <?xml version="1.0" encoding="us-ascii" standalone='yes'?>
4794     <p></p>
4795     @@@test:domTree:
4796     document {
4797     xml-version: '1.0';
4798     xml-encoding: 'us-ascii';
4799     xml-standalone: true;
4800     element { }
4801     }
4802     @@XMLTest:
4803     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.standalone.yes.s.test
4804     @@@DEnt:
4805     @@@@test:value:
4806     <?xml version="1.0" encoding="us-ascii" standalone = "yes" ?>
4807     <p></p>
4808     @@@test:domTree:
4809     document {
4810     xml-version: '1.0';
4811     xml-encoding: 'us-ascii';
4812     xml-standalone: true;
4813     element { }
4814     }
4815 wakaba 1.14 @@XMLTest:
4816     @@@QName: xp.xmldecl.no.encoding.but.standalone.attr.test
4817     @@@DEnt:
4818     @@@@test:value:
4819     <?xml version="1.0" standalone="yes"?>
4820     <p></p>
4821     @@@test:domTree:
4822     document {
4823     xml-version: '1.0';
4824     xml-encoding: null;
4825     xml-standalone: true;
4826     element { }
4827     }
4828     @@XMLTest:
4829     @@@QName: xp.xmldecl.encoding.encname.test
4830     @@@DEnt:
4831     @@@@test:value:
4832     <?xml version="1.0" encoding="a-._01-"?>
4833     <p></p>
4834     @@@test:domTree:
4835     document {
4836     xml-version: '1.0';
4837     xml-encoding: 'a-._01-';
4838     xml-standalone: false;
4839     element { }
4840     }
4841    
4842     @@XMLTest:
4843     @@@QName: xp.xmldecl.no.s.no.attr.test
4844     @@@DEnt:
4845     @@@@test:value:
4846     <?xml?>
4847     <p></p>
4848     @@@c:erred:
4849 wakaba 1.16 <[[xp:wf-syntax-error]]> { (1, 1)..(1, 7); }
4850 wakaba 1.14 @@XMLTest:
4851     @@@QName: xp.xmldecl.s.no.attr.test
4852     @@@DEnt:
4853     @@@@test:value:
4854     <?xml ?>
4855     <p></p>
4856     @@@c:erred:
4857     <[[xp:wf-syntax-error]]> { (1, 8)..(1, 9); }
4858     @@XMLTest:
4859     @@@QName: xp.xmldecl.unknown.attr.test
4860     @@@DEnt:
4861     @@@@test:value:
4862     <?xml unknown="value"?>
4863     <p></p>
4864     @@@c:erred:
4865     <[[xp:wf-syntax-error]]> { (1, 8)..(1, 22); }
4866     @@XMLTest:
4867     @@@QName: xp.xmldecl.version.unknown.attr.test
4868     @@@DEnt:
4869     @@@@test:value:
4870     <?xml version="1.0" unknown="value"?>
4871     <p></p>
4872     @@@c:erred:
4873     <[[xp:wf-syntax-error]]> { (1, 21)..(1, 35); }
4874     @@XMLTest:
4875     @@@QName: xp.xmldecl.version.encoding.unknown.attr.test
4876     @@@DEnt:
4877     @@@@test:value:
4878     <?xml version="1.0" encoding="us-ascii" unknown="value"?>
4879     <p></p>
4880     @@@c:erred:
4881     <[[xp:wf-syntax-error]]> { (1, 41)..(1, 55); }
4882     @@XMLTest:
4883     @@@QName: xp.xmldecl.version.encoding.standalone.unknown.attr.test
4884     @@@DEnt:
4885     @@@@test:value:
4886     <?xml version="1.0" encoding="us-ascii" standalone="yes"
4887     unknown="value"?>
4888     <p></p>
4889     @@@c:erred:
4890     <[[xp:wf-syntax-error]]> { (2, 1)..(2, 15); }
4891     @@XMLTest:
4892     @@@QName: xp.xmldecl.no.version.but.encoding.attr.test
4893     @@@DEnt:
4894     @@@@test:value:
4895     <?xml encoding="us-ascii"?>
4896     <p></p>
4897     @@@c:erred:
4898     <[[xp:wf-syntax-error]]> { (1, 7)..(1, 25); }
4899     @@XMLTest:
4900     @@@QName: xp.xmldecl.no.version.but.standalone.attr.test
4901     @@@DEnt:
4902     @@@@test:value:
4903     <?xml standalone="yes"?>
4904     <p></p>
4905     @@@c:erred:
4906     <[[xp:wf-syntax-error]]> { (1, 7)..(1, 24); }
4907     @@XMLTest:
4908     @@@QName: xp.xmldecl.version.unsupported.test
4909     @@@DEnt:
4910     @@@@test:value:
4911     <?xml version="1.2"?>
4912     <p></p>
4913     @@@c:erred:
4914     <[[xp:wf-unsupported-xml-version]]> { (1, 7)..(1, 19); }
4915     @@XMLTest:
4916     @@@QName: xp.xmldecl.version.unsupported.2.test
4917     @@@DEnt:
4918     @@@@test:value:
4919     <?xml version=" 1.0 "?>
4920     <p></p>
4921     @@@c:erred:
4922     <[[xp:wf-unsupported-xml-version]]> { (1, 7)..(1, 21); }
4923     @@XMLTest:
4924     @@@QName: xp.xmldecl.version.unsupported.3.test
4925     @@@DEnt:
4926     @@@@test:value:
4927     <?xml version="01.00"?>
4928     <p></p>
4929     @@@c:erred:
4930     <[[xp:wf-unsupported-xml-version]]> { (1, 7)..(1, 21); }
4931     @@XMLTest:
4932     @@@QName: xp.xmldecl.encoding.malformed.1.test
4933     @@@DEnt:
4934     @@@@test:value:
4935     <?xml version="1.0" encoding="0088"?>
4936     <p></p>
4937     @@@c:erred:
4938     <[[xp:wf-malformed-enc-name]]> { (1, 21)..(1, 35); }
4939     @@XMLTest:
4940     @@@QName: xp.xmldecl.encoding.malformed.2.test
4941     @@@DEnt:
4942     @@@@test:value:
4943     <?xml version="1.0" encoding="D.V.D!"?>
4944     <p></p>
4945     @@@c:erred:
4946     <[[xp:wf-malformed-enc-name]]> { (1, 21)..(1, 38); }
4947     @@XMLTest:
4948     @@@QName: xp.xmldecl.standalone.malformed.1.test
4949     @@@DEnt:
4950     @@@@test:value:
4951     <?xml version="1.0" standalone="true"?>
4952     <p></p>
4953     @@@c:erred:
4954     <[[xp:wf-malformed-xml-standalone]]> { (1, 21)..(1, 38); }
4955     @@XMLTest:
4956     @@@QName: xp.xmldecl.standalone.malformed.2.test
4957     @@@DEnt:
4958     @@@@test:value:
4959     <?xml version="1.0" standalone="YES"?>
4960     <p></p>
4961     @@@c:erred:
4962     <[[xp:wf-malformed-xml-standalone]]> { (1, 21)..(1, 37); }
4963     @@XMLTest:
4964     @@@QName: xp.xmldecl.standalone.malformed.3.test
4965     @@@DEnt:
4966     @@@@test:value:
4967     <?xml version="1.0" standalone="no "?>
4968     <p></p>
4969     @@@c:erred:
4970     <[[xp:wf-malformed-xml-standalone]]> { (1, 21)..(1, 38); }
4971 wakaba 1.6
4972     @@XMLTest:
4973 wakaba 1.14 @@@QName: xp.no-xmldecl.xml...-pi.test
4974     @@@DEnt:
4975     @@@@test:value:
4976     <?xmldeclaration?>
4977     <a></a>
4978     @@@test:domTree:
4979     document {
4980     pi {
4981     node-name: 'xmldeclaration';
4982     node-value: '';
4983     }
4984     element { }
4985     }
4986     @@XMLTest:
4987     @@@QName: xp.no-xmldecl.xml...-pi.after.document.element.test
4988     @@@DEnt:
4989     @@@@test:value:
4990     <a></a>
4991     <?xmldeclaration?>
4992     @@@test:domTree:
4993     document {
4994     element { }
4995     pi {
4996     node-name: 'xmldeclaration';
4997     node-value: '';
4998     }
4999     }
5000     @@XMLTest:
5001     @@@QName: xp.no-xmldecl.xml...-pi.in.document.element.test
5002     @@@DEnt:
5003     @@@@test:value:
5004     <a>
5005     <?xmldeclaration?>
5006     </a>
5007     @@@test:domTree:
5008     document {
5009     element {
5010     text { }
5011     pi {
5012     node-name: 'xmldeclaration';
5013     node-value: '';
5014     }
5015     text { }
5016     }
5017     }
5018     @@XMLTest:
5019     @@@QName: xp.no-xmldecl.xml...-pi.in.doctype.test
5020     @@@DEnt:
5021     @@@@test:value:
5022     <!DOCTYPE a [
5023     <?xmldeclaration?>
5024     ]>
5025     <a></a>
5026     @@@test:domTree:
5027     document {
5028     document-type {
5029     pi {
5030     node-name: 'xmldeclaration';
5031     node-value: '';
5032     }
5033     }
5034     element { }
5035     }
5036    
5037     @@XMLTest:
5038     @@@QName: xp.XMLdecl.test
5039     @@@DEnt:
5040     @@@@test:value:
5041     <?XML version="1.0"?>
5042     <p></p>
5043     @@@c:erred:
5044     <[[xp:wf-pi-target-is-xml]]> { (1, 1)..(1, 5); }
5045     @@XMLTest:
5046     @@@QName: xp.Xmldecl.test
5047     @@@DEnt:
5048     @@@@test:value:
5049     <?Xml version="1.0"?>
5050     <p></p>
5051     @@@c:erred:
5052     <[[xp:wf-pi-target-is-xml]]> { (1, 1)..(1, 5); }
5053     @@XMLTest:
5054     @@@QName: xp.xmldecl.after.document.element.empty.test
5055     @@@DEnt:
5056     @@@@test:value:
5057     <p></p>
5058     <?xml?>
5059     @@@c:erred:
5060     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5061     @@XMLTest:
5062     @@@QName: xp.xmldecl.after.document.element.test
5063     @@@DEnt:
5064     @@@@test:value:
5065     <p></p>
5066     <?xml version="1.0"?>
5067     @@@c:erred:
5068     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5069     @@XMLTest:
5070     @@@QName: xp.xmldecl.in.element.empty.test
5071     @@@DEnt:
5072     @@@@test:value:
5073     <p>
5074     <?xml?>
5075     </p>
5076     @@@c:erred:
5077     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5078     @@XMLTest:
5079     @@@QName: xp.xmldecl.in.element.test
5080     @@@DEnt:
5081     @@@@test:value:
5082     <p>
5083     <?xml version="1.0"?>
5084     </p>
5085     @@@c:erred:
5086     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5087     @@XMLTest:
5088     @@@QName: xp.xmldecl.after.comment.test
5089     @@@DEnt:
5090     @@@@test:value:
5091     <!---->
5092     <?xml version="1.0"?>
5093     <p></p>
5094     @@@c:erred:
5095     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5096     @@XMLTest:
5097     @@@QName: xp.xmldecl.after.comment.empty.test
5098     @@@DEnt:
5099     @@@@test:value:
5100     <!---->
5101     <?xml?>
5102     <p></p>
5103     @@@c:erred:
5104     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5105     @@XMLTest:
5106     @@@QName: xp.xmldecl.after.pi.test
5107     @@@DEnt:
5108     @@@@test:value:
5109     <?xml-declaration?>
5110     <?xml version="1.0"?>
5111     <p></p>
5112     @@@c:erred:
5113     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5114     @@XMLTest:
5115     @@@QName: xp.xmldecl.after.pi.empty.test
5116     @@@DEnt:
5117     @@@@test:value:
5118     <?xml-declaration?>
5119     <?xml?>
5120     <p></p>
5121     @@@c:erred:
5122     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5123     @@XMLTest:
5124 wakaba 1.16 @@@QName: xp.xmldecl.after.pi.2.test
5125     @@@DEnt:
5126     @@@@test:value:
5127     <?declaration?>
5128     <?xml version="1.0"?>
5129     <p></p>
5130     @@@c:erred:
5131     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5132     @@XMLTest:
5133     @@@QName: xp.xmldecl.after.pi.empty.2.test
5134     @@@DEnt:
5135     @@@@test:value:
5136     <?declaration?>
5137     <?xml?>
5138     <p></p>
5139     @@@c:erred:
5140     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5141     @@XMLTest:
5142 wakaba 1.14 @@@QName: xp.xmldecl.after.doctype.test
5143     @@@DEnt:
5144     @@@@test:value:
5145     <!DOCTYPE a>
5146     <?xml version="1.0"?>
5147     <p></p>
5148     @@@c:erred:
5149     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5150     @@XMLTest:
5151     @@@QName: xp.xmldecl.after.doctype.empty.test
5152     @@@DEnt:
5153     @@@@test:value:
5154     <!DOCTYPE a>
5155     <?xml?>
5156     <p></p>
5157     @@@c:erred:
5158     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5159     @@XMLTest:
5160     @@@QName: xp.xmldecl.in.doctype.test
5161     @@@DEnt:
5162     @@@@test:value:
5163     <!DOCTYPE a [
5164     <?xml version="1.0"?>
5165     ]>
5166     <p></p>
5167     @@@c:erred:
5168     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5169     @@XMLTest:
5170     @@@QName: xp.xmldecl.in.doctype.empty.test
5171     @@@DEnt:
5172     @@@@test:value:
5173     <!DOCTYPE a [
5174     <?xml?>
5175     ]>
5176     <p></p>
5177     @@@c:erred:
5178     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
5179    
5180     @@XMLTest:
5181     @@@QName: xp.pi.before.element.empty.test
5182     @@@DEnt:
5183     @@@@test:value:
5184     <?target?>
5185     <a></a>
5186     @@@test:domTree:
5187     document {
5188     pi {
5189     node-name: 'target';
5190     node-value: '';
5191     }
5192     element { }
5193     }
5194     @@XMLTest:
5195     @@@QName: xp.pi.before.element.s.test
5196     @@@DEnt:
5197     @@@@test:value:
5198     <?target ?>
5199     <a></a>
5200     @@@test:domTree:
5201     document {
5202     pi {
5203     node-name: 'target';
5204     node-value: '';
5205     }
5206     element { }
5207     }
5208     @@XMLTest:
5209     @@@QName: xp.pi.before.element.string.test
5210     @@@DEnt:
5211     @@@@test:value:
5212     <?target string?>
5213     <a></a>
5214     @@@test:domTree:
5215     document {
5216     pi {
5217     node-name: 'target';
5218     node-value: 'string';
5219     }
5220     element { }
5221     }
5222     @@XMLTest:
5223     @@@QName: xp.pi.before.element.string.s.test
5224     @@@DEnt:
5225     @@@@test:value:
5226     <?target string ?>
5227     <a></a>
5228     @@@test:domTree:
5229     document {
5230     pi {
5231     node-name: 'target';
5232     node-value: 'string ';
5233     }
5234     element { }
5235     }
5236     @@XMLTest:
5237     @@@QName: xp.pi.before.element.gt.test
5238     @@@DEnt:
5239     @@@@test:value:
5240     <?target string>string?>
5241     <a></a>
5242     @@@test:domTree:
5243     document {
5244     pi {
5245     node-name: 'target';
5246     node-value: 'string>string';
5247     }
5248     element { }
5249     }
5250     @@XMLTest:
5251     @@@QName: xp.pi.doctype.empty.test
5252     @@@DEnt:
5253     @@@@test:value:
5254     <!DOCTYPE a [
5255     <?target?>
5256     ]>
5257     <a></a>
5258     @@@test:domTree:
5259     document {
5260     document-type {
5261     pi {
5262     node-name: 'target';
5263     node-value: '';
5264     }
5265     }
5266     element { }
5267     }
5268    
5269     @@XMLTest:
5270     @@@QName: xp.pi.no.target.test
5271     @@@DEnt:
5272     @@@@test:value:
5273     <??>
5274     <p></p>
5275     @@@c:erred:
5276     <[[xp:wf-syntax-error]]> { (1, 3)..(1, 4); }
5277     @@XMLTest:
5278     @@@QName: xp.pi.no.target.2.test
5279     @@@DEnt:
5280     @@@@test:value:
5281     <? ?>
5282     <p></p>
5283     @@@c:erred:
5284     <[[xp:wf-syntax-error]]> { (1, 3)..(1, 4); }
5285     @@XMLTest:
5286     @@@QName: xp.pi.bad.target.1.test
5287     @@@DEnt:
5288     @@@@test:value:
5289     <?target! ?>
5290     <p></p>
5291     @@@c:erred:
5292     <[[xp:wf-syntax-error]]> { (1, 9)..(1, 9); }
5293     @@XMLTest:
5294     @@@QName: xp.pi.bad.target.2.test
5295     @@@DEnt:
5296     @@@@test:value:
5297     <?0target ?>
5298     <p></p>
5299     @@@c:erred:
5300     <[[xp:wf-syntax-error]]> { (1, 3)..(1, 3); }
5301    
5302     @@XMLTest:
5303 wakaba 1.15 @@@QName: xp.cdatasection.empty.1.test
5304     @@@DEnt:
5305     @@@@test:value:
5306     <p><![CDATA[]]></p>
5307     @@@test:domTree:
5308     document {
5309     element {
5310     cdata-section {
5311     data: '';
5312     }
5313     }
5314     }
5315     @@XMLTest:
5316     @@@QName: xp.cdatasection.empty.2.test
5317     @@@DEnt:
5318     @@@@test:value:
5319     <p>aa<![CDATA[]]>bb</p>
5320     @@@test:domTree:
5321     document {
5322     element {
5323     text { data: 'aa'; }
5324     cdata-section {
5325     data: '';
5326     }
5327     text { data: 'bb'; }
5328     }
5329     }
5330     @@XMLTest:
5331     @@@QName: xp.cdatasection.1.test
5332     @@@DEnt:
5333     @@@@test:value:
5334     <p><![CDATA[abcdefg]]></p>
5335     @@@test:domTree:
5336     document {
5337     element {
5338     cdata-section {
5339     data: 'abcdefg';
5340     }
5341     }
5342     }
5343     @@XMLTest:
5344     @@@QName: xp.cdatasection.2.test
5345     @@@DEnt:
5346     @@@@test:value:
5347     <p>aa<![CDATA[abcdefg]]>bb</p>
5348     @@@test:domTree:
5349     document {
5350     element {
5351     text { data: 'aa'; }
5352     cdata-section {
5353     data: 'abcdefg';
5354     }
5355     text { data: 'bb'; }
5356     }
5357     }
5358     @@XMLTest:
5359     @@@QName: xp.cdatasection.ref.1.test
5360     @@@DEnt:
5361     @@@@test:value:
5362     <p><![CDATA[a&amp;&#x32;&#32;%abc;&def;]]&gt;b]]></p>
5363     @@@test:domTree:
5364     document {
5365     element {
5366     cdata-section {
5367     data: 'a&amp;&#x32;&#32;%abc;&def;]]&gt;b';
5368     }
5369     }
5370     }
5371     @@XMLTest:
5372     @@@QName: xp.cdatasection.in.general.entity.test
5373     @@@DEnt:
5374     @@@@test:value:
5375     <!DOCTYPE p [
5376     <!ENTITY cdata "<![CDATA[text]]>">
5377     ]>
5378     <p>&cdata;</p>
5379     @@@test:domTree:
5380     document {
5381     document-type {
5382     general-entity {
5383     node-name: 'cdata';
5384     cdata-section {
5385     data: 'text';
5386     }
5387     }
5388     }
5389     element {
5390     general-entity-reference {
5391 wakaba 1.19 is-expanded: true;
5392 wakaba 1.15 cdata-section {
5393     data: 'text';
5394     }
5395     }
5396     }
5397     }
5398     @@XMLTest:
5399     @@@QName: xp.cdatasection.no.mse.test
5400     @@@DEnt:
5401     @@@@test:value:
5402     <p><![CDATA[text</p>
5403     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 21); }
5404     @@XMLTest:
5405     @@@QName: xp.cdatasection.nest.test
5406     @@@DEnt:
5407     @@@@test:value:
5408     <p><![CDATA[text01<![CDATA[txt2]]>text3]]></p>
5409     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 40)..(1, 42); }
5410    
5411     @@XMLTest:
5412 wakaba 1.6 @@@QName: xp.doctype.empty.test
5413     @@@DEnt:
5414     @@@@test:value:
5415     <!DOCTYPE a>
5416     <a></a>
5417     @@@test:domTree:
5418     document {
5419     xml-version: '1.0';
5420     xml-encoding: null;
5421     xml-standalone: false;
5422     document-type {
5423     node-name: 'a';
5424 wakaba 1.17 public-id: null;
5425     system-id: null;
5426 wakaba 1.6 }
5427     element {
5428     namespace-uri: null;
5429     prefix: null;
5430     local-name: 'a';
5431     text-content: '';
5432     }
5433     }
5434 wakaba 1.15 @@XMLTest:
5435     @@@QName: xp.doctype.empty.after.document.element.test
5436     @@@DEnt:
5437     @@@@test:value:
5438     <a></a>
5439     <!DOCTYPE a>
5440     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1)..(2, 12); }
5441     @@XMLTest:
5442     @@@QName: xp.doctype.empty.in.element.test
5443     @@@DEnt:
5444     @@@@test:value:
5445     <a>
5446     <!DOCTYPE a>
5447     </a>
5448     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1)..(2, 12); }
5449     @@XMLTest:
5450     @@@QName: xp.doctype.empty.dup.test
5451     @@@DEnt:
5452     @@@@test:value:
5453     <!DOCTYPE a>
5454     <!DOCTYPE a>
5455     <a></a>
5456     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1)..(2, 12); }
5457     @@XMLTest:
5458     @@@QName: xp.doctype.empty.in.intsubset.test
5459     @@@DEnt:
5460     @@@@test:value:
5461     <!DOCTYPE a [
5462     <!DOCTYPE a>
5463     ]>
5464     <a></a>
5465     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1)..(2, 12); }
5466 wakaba 1.16 @@XMLTest:
5467     @@@QName: xp.doctype.no.s.no.name.test
5468     @@@DEnt:
5469     @@@@test:value:
5470     <!DOCTYPE>
5471     <a></a>
5472     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 10); }
5473     @@XMLTest:
5474     @@@QName: xp.doctype.no.name.test
5475     @@@DEnt:
5476     @@@@test:value:
5477     <!DOCTYPE >
5478     <a></a>
5479     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 11); }
5480     @@XMLTest:
5481     @@@QName: xp.doctype.name.s.test
5482     @@@DEnt:
5483     @@@@test:value:
5484     <!DOCTYPE aa >
5485     <aa></aa>
5486     @@@test:domTree:
5487     document {
5488     document-type {
5489     node-name: 'aa';
5490 wakaba 1.17 public-id: null;
5491     system-id: null;
5492 wakaba 1.16 }
5493     element { }
5494     }
5495     @@XMLTest:
5496     @@@QName: xp.doctype.no.mdc.test
5497     @@@DEnt:
5498     @@@@test:value:
5499     <!DOCTYPE aa
5500     <aa></aa>
5501     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1); }
5502 wakaba 1.6
5503     @@XMLTest:
5504 wakaba 1.16 @@@QName: xp.doctype.intsubset.empty.1.test
5505 wakaba 1.6 @@@DEnt:
5506     @@@@test:value:
5507 wakaba 1.16 <!DOCTYPE a []>
5508 wakaba 1.6 <a></a>
5509     @@@test:domTree:
5510     document {
5511     xml-version: '1.0';
5512     xml-encoding: null;
5513     xml-standalone: false;
5514     document-type {
5515     node-name: 'a';
5516 wakaba 1.17 public-id: null;
5517     system-id: null;
5518 wakaba 1.6 }
5519     element {
5520     namespace-uri: null;
5521     prefix: null;
5522     local-name: 'a';
5523     text-content: '';
5524     }
5525     }
5526     @@XMLTest:
5527 wakaba 1.16 @@@QName: xp.doctype.intsubset.empty.2.test
5528 wakaba 1.6 @@@DEnt:
5529     @@@@test:value:
5530     <!DOCTYPE a [
5531 wakaba 1.16
5532 wakaba 1.6 ]>
5533     <a></a>
5534     @@@test:domTree:
5535     document {
5536     xml-version: '1.0';
5537     xml-encoding: null;
5538     xml-standalone: false;
5539     document-type {
5540     node-name: 'a';
5541 wakaba 1.17 public-id: null;
5542     system-id: null;
5543 wakaba 1.6 }
5544     element {
5545     namespace-uri: null;
5546     prefix: null;
5547     local-name: 'a';
5548     text-content: '';
5549     }
5550     }
5551     @@XMLTest:
5552 wakaba 1.16 @@@QName: xp.doctype.intsubset.empty.3.test
5553 wakaba 1.6 @@@DEnt:
5554     @@@@test:value:
5555 wakaba 1.16 <!DOCTYPE a[]>
5556 wakaba 1.6 <a></a>
5557     @@@test:domTree:
5558     document {
5559     document-type {
5560     node-name: 'a';
5561 wakaba 1.17 public-id: null;
5562     system-id: null;
5563 wakaba 1.6 }
5564 wakaba 1.16 element { }
5565     }
5566     @@XMLTest:
5567     @@@QName: xp.doctype.intsubset.empty.4.test
5568     @@@DEnt:
5569     @@@@test:value:
5570     <!DOCTYPE a[] >
5571     <a></a>
5572     @@@test:domTree:
5573     document {
5574     document-type {
5575     node-name: 'a';
5576 wakaba 1.17 public-id: null;
5577     system-id: null;
5578 wakaba 1.6 }
5579 wakaba 1.16 element { }
5580 wakaba 1.6 }
5581     @@XMLTest:
5582 wakaba 1.16 @@@QName: xp.doctype.intsubset.no.dsc.1.test
5583     @@@DEnt:
5584     @@@@test:value:
5585     <!DOCTYPE a [>
5586     <a></a>
5587     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 14); }
5588     @@XMLTest:
5589     @@@QName: xp.doctype.intsubset.no.dsc.2.test
5590 wakaba 1.6 @@@DEnt:
5591     @@@@test:value:
5592     <!DOCTYPE a [
5593     <a></a>
5594 wakaba 1.16 @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1); }
5595     @@XMLTest:
5596     @@@QName: xp.doctype.intsubset.no.dsc.3.test
5597     @@@DEnt:
5598     @@@@test:value:
5599     <!DOCTYPE a [
5600     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 14); }
5601     @@XMLTest:
5602     @@@QName: xp.doctype.intsubset.no.mdc.1.test
5603     @@@DEnt:
5604     @@@@test:value:
5605     <!DOCTYPE a []
5606     <a/>
5607     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1); }
5608     @@XMLTest:
5609     @@@QName: xp.doctype.intsubset.no.mdc.2.test
5610     @@@DEnt:
5611     @@@@test:value:
5612     <!DOCTYPE a []]>
5613     <a/>
5614     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 15); }
5615 wakaba 1.17 @@XMLTest:
5616     @@@QName: xp.doctype.pubid.sysid.1.test
5617     @@@DEnt:
5618     @@@@test:value:
5619     <!DOCTYPE a PUBLIC "pubid" "sysid">
5620     <a/>
5621     @@@test:domTree:
5622     document {
5623     document-type {
5624     node-name: 'a';
5625     public-id: 'pubid';
5626     system-id: 'sysid';
5627     }
5628     element { }
5629     }
5630     @@XMLTest:
5631     @@@QName: xp.doctype.pubid.sysid.2.test
5632     @@@DEnt:
5633     @@@@test:value:
5634     <!DOCTYPE a PUBLIC 'pubid' "sysid">
5635     <a/>
5636     @@@test:domTree:
5637     document {
5638     document-type {
5639     node-name: 'a';
5640     public-id: 'pubid';
5641     system-id: 'sysid';
5642     }
5643     element { }
5644     }
5645     @@XMLTest:
5646     @@@QName: xp.doctype.pubid.sysid.3.test
5647     @@@DEnt:
5648     @@@@test:value:
5649     <!DOCTYPE a PUBLIC "pubid" 'sysid'>
5650     <a/>
5651     @@@test:domTree:
5652     document {
5653     document-type {
5654     node-name: 'a';
5655     public-id: 'pubid';
5656     system-id: 'sysid';
5657     }
5658     element { }
5659     }
5660     @@XMLTest:
5661     @@@QName: xp.doctype.pubid.sysid.4.test
5662     @@@DEnt:
5663     @@@@test:value:
5664     <!DOCTYPE a PUBLIC 'pubid' 'sysid'>
5665     <a/>
5666     @@@test:domTree:
5667     document {
5668     document-type {
5669     node-name: 'a';
5670     public-id: 'pubid';
5671     system-id: 'sysid';
5672     }
5673     element { }
5674     }
5675     @@XMLTest:
5676     @@@QName: xp.doctype.pubid.sysid.5.test
5677     @@@DEnt:
5678     @@@@test:value:
5679     <!DOCTYPE a PUBLIC "pubid" "sysid" >
5680     <a/>
5681     @@@test:domTree:
5682     document {
5683     document-type {
5684     node-name: 'a';
5685     public-id: 'pubid';
5686     system-id: 'sysid';
5687     }
5688     element { }
5689     }
5690     @@XMLTest:
5691     @@@QName: xp.doctype.pubid.sysid.6.test
5692     @@@DEnt:
5693     @@@@test:value:
5694     <!DOCTYPE a PUBLIC 'pubid' 'sysid' >
5695     <a/>
5696     @@@test:domTree:
5697     document {
5698     document-type {
5699     node-name: 'a';
5700     public-id: 'pubid';
5701     system-id: 'sysid';
5702     }
5703     element { }
5704     }
5705     @@XMLTest:
5706     @@@QName: xp.doctype.pubid.sysid.intsubset.1.test
5707     @@@DEnt:
5708     @@@@test:value:
5709     <!DOCTYPE a PUBLIC "pubid" "sysid"[]>
5710     <a/>
5711     @@@test:domTree:
5712     document {
5713     document-type {
5714     node-name: 'a';
5715     public-id: 'pubid';
5716     system-id: 'sysid';
5717     }
5718     element { }
5719     }
5720     @@XMLTest:
5721     @@@QName: xp.doctype.pubid.sysid.intsubset.2.test
5722     @@@DEnt:
5723     @@@@test:value:
5724     <!DOCTYPE a PUBLIC "pubid" "sysid" []>
5725     <a/>
5726     @@@test:domTree:
5727     document {
5728     document-type {
5729     node-name: 'a';
5730     public-id: 'pubid';
5731     system-id: 'sysid';
5732     }
5733     element { }
5734     }
5735     @@XMLTest:
5736     @@@QName: xp.doctype.pubid.sysid.intsubset.3.test
5737     @@@DEnt:
5738     @@@@test:value:
5739     <!DOCTYPE a PUBLIC 'pubid' 'sysid'[]>
5740     <a/>
5741     @@@test:domTree:
5742     document {
5743     document-type {
5744     node-name: 'a';
5745     public-id: 'pubid';
5746     system-id: 'sysid';
5747     }
5748     element { }
5749     }
5750     @@XMLTest:
5751     @@@QName: xp.doctype.pubid.sysid.intsubset.4.test
5752     @@@DEnt:
5753     @@@@test:value:
5754     <!DOCTYPE a PUBLIC 'pubid' 'sysid' []>
5755     <a/>
5756     @@@test:domTree:
5757     document {
5758     document-type {
5759     node-name: 'a';
5760     public-id: 'pubid';
5761     system-id: 'sysid';
5762     }
5763     element { }
5764     }
5765     @@XMLTest:
5766     @@@QName: xp.doctype.sysid.1.test
5767     @@@DEnt:
5768     @@@@test:value:
5769     <!DOCTYPE a SYSTEM "sysid">
5770     <a/>
5771     @@@test:domTree:
5772     document {
5773     document-type {
5774     node-name: 'a';
5775     public-id: null;
5776     system-id: 'sysid';
5777     }
5778     element { }
5779     }
5780     @@XMLTest:
5781     @@@QName: xp.doctype.sysid.2.test
5782     @@@DEnt:
5783     @@@@test:value:
5784     <!DOCTYPE a SYSTEM 'sysid'>
5785     <a/>
5786     @@@test:domTree:
5787     document {
5788     document-type {
5789     node-name: 'a';
5790     public-id: null;
5791     system-id: 'sysid';
5792     }
5793     element { }
5794     }
5795     @@XMLTest:
5796     @@@QName: xp.doctype.sysid.3.test
5797     @@@DEnt:
5798     @@@@test:value:
5799     <!DOCTYPE a SYSTEM "sysid" >
5800     <a/>
5801     @@@test:domTree:
5802     document {
5803     document-type {
5804     node-name: 'a';
5805     public-id: null;
5806     system-id: 'sysid';
5807     }
5808     element { }
5809     }
5810     @@XMLTest:
5811     @@@QName: xp.doctype.sysid.4.test
5812     @@@DEnt:
5813     @@@@test:value:
5814     <!DOCTYPE a SYSTEM 'sysid' >
5815     <a/>
5816     @@@test:domTree:
5817     document {
5818     document-type {
5819     node-name: 'a';
5820     public-id: null;
5821     system-id: 'sysid';
5822     }
5823     element { }
5824     }
5825     @@XMLTest:
5826     @@@QName: xp.doctype.sysid.intsubset.1.test
5827     @@@DEnt:
5828     @@@@test:value:
5829     <!DOCTYPE a SYSTEM "sysid"[]>
5830     <a/>
5831     @@@test:domTree:
5832     document {
5833     document-type {
5834     node-name: 'a';
5835     public-id: null;
5836     system-id: 'sysid';
5837     }
5838     element { }
5839     }
5840     @@XMLTest:
5841     @@@QName: xp.doctype.sysid.intsubset.2.test
5842     @@@DEnt:
5843     @@@@test:value:
5844     <!DOCTYPE a SYSTEM "sysid" []>
5845     <a/>
5846     @@@test:domTree:
5847     document {
5848     document-type {
5849     node-name: 'a';
5850     public-id: null;
5851     system-id: 'sysid';
5852     }
5853     element { }
5854     }
5855     @@XMLTest:
5856     @@@QName: xp.doctype.sysid.intsubset.3.test
5857     @@@DEnt:
5858     @@@@test:value:
5859     <!DOCTYPE a SYSTEM 'sysid'[]>
5860     <a/>
5861     @@@test:domTree:
5862     document {
5863     document-type {
5864     node-name: 'a';
5865     public-id: null;
5866     system-id: 'sysid';
5867     }
5868     element { }
5869     }
5870     @@XMLTest:
5871     @@@QName: xp.doctype.sysid.intsubset.4.test
5872     @@@DEnt:
5873     @@@@test:value:
5874     <!DOCTYPE a SYSTEM 'sysid' []>
5875     <a/>
5876     @@@test:domTree:
5877     document {
5878     document-type {
5879     node-name: 'a';
5880     public-id: null;
5881     system-id: 'sysid';
5882     }
5883     element { }
5884     }
5885     @@XMLTest:
5886     @@@QName: xp.doctype.public.stago.test
5887     @@@DEnt:
5888     @@@@test:value:
5889     <!DOCTYPE a PUBLIC<a/>
5890     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 19); }
5891     @@XMLTest:
5892     @@@QName: xp.doctype.public.mdc.test
5893     @@@DEnt:
5894     @@@@test:value:
5895     <!DOCTYPE a PUBLIC>
5896     <a/>
5897     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 19); }
5898     @@XMLTest:
5899     @@@QName: xp.doctype.public.s.stago.test
5900     @@@DEnt:
5901     @@@@test:value:
5902     <!DOCTYPE a PUBLIC <a/>
5903     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 20); }
5904     @@XMLTest:
5905     @@@QName: xp.doctype.public.s.mdc.test
5906     @@@DEnt:
5907     @@@@test:value:
5908     <!DOCTYPE a PUBLIC >
5909     <a/>
5910     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 20); }
5911     @@XMLTest:
5912     @@@QName: xp.doctype.public.lit.test
5913     @@@DEnt:
5914     @@@@test:value:
5915     <!DOCTYPE a PUBLIC"p" "s">
5916     <a/>
5917     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 19); }
5918     @@XMLTest:
5919     @@@QName: xp.doctype.public.lita.test
5920     @@@DEnt:
5921     @@@@test:value:
5922     <!DOCTYPE a PUBLIC'p' "s">
5923     <a/>
5924     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 19); }
5925     @@XMLTest:
5926     @@@QName: xp.doctype.pubid.lit.lita.unmatched.1.test
5927     @@@DEnt:
5928     @@@@test:value:
5929     <!DOCTYPE a PUBLIC "p' "s">
5930     <a/>
5931     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 25); }
5932     @@XMLTest:
5933     @@@QName: xp.doctype.pubid.lit.lita.unmatched.2.test
5934     @@@DEnt:
5935     @@@@test:value:
5936     <!DOCTYPE a PUBLIC "p' 's'><a/>
5937     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 32); }
5938     @@XMLTest:
5939     @@@QName: xp.doctype.pubid.lita.lit.unmatched.1.test
5940     @@@DEnt:
5941     @@@@test:value:
5942     <!DOCTYPE a PUBLIC 'p" "s"><a/>
5943     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 32); }
5944     @@XMLTest:
5945     @@@QName: xp.doctype.pubid.lita.lit.unmatched.2.test
5946     @@@DEnt:
5947     @@@@test:value:
5948     <!DOCTYPE a PUBLIC 'p" 's'>
5949     <a/>
5950     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 21)..(1, 25); }
5951     @@XMLTest:
5952     @@@QName: xp.doctype.public.s.lit.mdc.test
5953     @@@DEnt:
5954     @@@@test:value:
5955     <!DOCTYPE a PUBLIC "><a/>
5956     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 26); }
5957     @@XMLTest:
5958     @@@QName: xp.doctype.public.s.lita.mdc.test
5959     @@@DEnt:
5960     @@@@test:value:
5961     <!DOCTYPE a PUBLIC '><a/>
5962     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 26); }
5963     @@XMLTest:
5964     @@@QName: xp.doctype.public.lit.pubid.lit.mdc.test
5965     @@@DEnt:
5966     @@@@test:value:
5967     <!DOCTYPE a PUBLIC "p">
5968     <a/>
5969     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 23); }
5970     @@XMLTest:
5971     @@@QName: xp.doctype.public.lita.pubid.lita.mdc.test
5972     @@@DEnt:
5973     @@@@test:value:
5974     <!DOCTYPE a PUBLIC 'p'>
5975     <a/>
5976     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 23); }
5977     @@XMLTest:
5978     @@@QName: xp.doctype.public.lit.pubid.lit.s.mdc.test
5979     @@@DEnt:
5980     @@@@test:value:
5981     <!DOCTYPE a PUBLIC "p" >
5982     <a/>
5983     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 24); }
5984     @@XMLTest:
5985     @@@QName: xp.doctype.public.lita.pubid.lita.s.mdc.test
5986     @@@DEnt:
5987     @@@@test:value:
5988     <!DOCTYPE a PUBLIC 'p' >
5989     <a/>
5990     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 24); }
5991     @@XMLTest:
5992     @@@QName: xp.doctype.public.lit.pubid.lit.s.lit.mdc.test
5993     @@@DEnt:
5994     @@@@test:value:
5995     <!DOCTYPE a PUBLIC "p" "><a/>
5996     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 30); }
5997     @@XMLTest:
5998     @@@QName: xp.doctype.public.lit.pubid.lit.s.lita.mdc.test
5999     @@@DEnt:
6000     @@@@test:value:
6001     <!DOCTYPE a PUBLIC "p" '><a/>
6002     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 30); }
6003     @@XMLTest:
6004     @@@QName: xp.doctype.public.lita.pubid.lita.s.lit.mdc.test
6005     @@@DEnt:
6006     @@@@test:value:
6007     <!DOCTYPE a PUBLIC 'p' "><a/>
6008     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 30); }
6009     @@XMLTest:
6010     @@@QName: xp.doctype.public.lita.pubid.lita.s.lita.mdc.test
6011     @@@DEnt:
6012     @@@@test:value:
6013     <!DOCTYPE a PUBLIC 'p' '><a/>
6014     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 30); }
6015     @@XMLTest:
6016     @@@QName: xp.doctype.public.lit.pubid.lit.lit.lita.unmatched.mdc.test
6017     @@@DEnt:
6018     @@@@test:value:
6019     <!DOCTYPE a PUBLIC "p" "s'><a/>
6020     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 32); }
6021     @@XMLTest:
6022     @@@QName: xp.doctype.public.lita.pubid.lita.lita.lit.unmatched.mdc.test
6023     @@@DEnt:
6024     @@@@test:value:
6025     <!DOCTYPE a PUBLIC 'p' 's"><a/>
6026     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 32); }
6027     @@XMLTest:
6028     @@@QName: xp.doctype.pubid.sysid.stago.1.test
6029     @@@DEnt:
6030     @@@@test:value:
6031     <!DOCTYPE a PUBLIC "p" "s"<a/>
6032     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 27); }
6033     @@XMLTest:
6034     @@@QName: xp.doctype.pubid.sysid.stago.2.test
6035     @@@DEnt:
6036     @@@@test:value:
6037     <!DOCTYPE a PUBLIC "p" 's'<a/>
6038     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 27); }
6039     @@XMLTest:
6040     @@@QName: xp.doctype.pubid.sysid.stago.s.1.test
6041     @@@DEnt:
6042     @@@@test:value:
6043     <!DOCTYPE a PUBLIC "p" "s" <a/>
6044     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 28); }
6045     @@XMLTest:
6046     @@@QName: xp.doctype.pubid.sysid.stago.s.2.test
6047     @@@DEnt:
6048     @@@@test:value:
6049     <!DOCTYPE a PUBLIC "p" 's' <a/>
6050     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 28); }
6051 wakaba 1.16
6052     @@XMLTest:
6053     @@@QName: xp.endofline.1.0.crlf.test
6054     @@@DEnt:
6055     @@@@test:value:
6056     <?xml version="1.0"?>
6057     <p>aaa$u000D$u000Abbb</p>
6058 wakaba 1.6 @@@test:domTree:
6059     document {
6060     xml-version: '1.0';
6061 wakaba 1.16 element {
6062     text-content: 'aaa' U+000A 'bbb';
6063 wakaba 1.6 }
6064 wakaba 1.16 }
6065     @@XMLTest:
6066     @@@QName: xp.endofline.1.1.crlf.test
6067     @@@DEnt:
6068     @@@@test:value:
6069     <?xml version="1.1"?>
6070     <p>aaa$u000D$u000Abbb</p>
6071     @@@test:domTree:
6072     document {
6073     xml-version: '1.1';
6074 wakaba 1.6 element {
6075 wakaba 1.16 text-content: 'aaa' U+000A 'bbb';
6076 wakaba 1.6 }
6077     }
6078     @@XMLTest:
6079 wakaba 1.16 @@@QName: xp.endofline.1.0.crnl.test
6080 wakaba 1.6 @@@DEnt:
6081     @@@@test:value:
6082 wakaba 1.16 <?xml version="1.0"?>
6083     <p>aaa$u000D$u0085bbb</p>
6084 wakaba 1.6 @@@test:domTree:
6085     document {
6086     xml-version: '1.0';
6087 wakaba 1.16 element {
6088     text-content: 'aaa' U+000A U+0085 'bbb';
6089 wakaba 1.6 }
6090 wakaba 1.16 }
6091     @@XMLTest:
6092     @@@QName: xp.endofline.1.1.crnl.test
6093     @@@DEnt:
6094     @@@@test:value:
6095     <?xml version="1.1"?>
6096     <p>aaa$u000D$u0085bbb</p>
6097     @@@test:domTree:
6098     document {
6099     xml-version: '1.1';
6100 wakaba 1.6 element {
6101 wakaba 1.16 text-content: 'aaa' U+000A 'bbb';
6102 wakaba 1.6 }
6103     }
6104     @@XMLTest:
6105 wakaba 1.16 @@@QName: xp.endofline.1.0.nl.test
6106 wakaba 1.6 @@@DEnt:
6107     @@@@test:value:
6108 wakaba 1.16 <?xml version="1.0"?>
6109     <p>aaa$u0085bbb</p>
6110 wakaba 1.6 @@@test:domTree:
6111     document {
6112     xml-version: '1.0';
6113     element {
6114 wakaba 1.16 text-content: 'aaa' U+0085 'bbb';
6115 wakaba 1.6 }
6116     }
6117     @@XMLTest:
6118 wakaba 1.16 @@@QName: xp.endofline.1.1.nl.test
6119 wakaba 1.6 @@@DEnt:
6120     @@@@test:value:
6121 wakaba 1.16 <?xml version="1.1"?>
6122     <p>aaa$u0085bbb</p>
6123     @@@test:domTree:
6124     document {
6125     xml-version: '1.1';
6126     element {
6127     text-content: 'aaa' U+000A 'bbb';
6128     }
6129     }
6130     @@XMLTest:
6131     @@@QName: xp.endofline.1.0.ls.test
6132     @@@DEnt:
6133     @@@@test:value:
6134     <?xml version="1.0"?>
6135     <p>aaa$u2028bbb</p>
6136     @@@test:domTree:
6137     document {
6138     xml-version: '1.0';
6139     element {
6140     text-content: 'aaa' U+2028 'bbb';
6141     }
6142     }
6143     @@XMLTest:
6144     @@@QName: xp.endofline.1.1.ls.test
6145     @@@DEnt:
6146     @@@@test:value:
6147     <?xml version="1.1"?>
6148     <p>aaa$u2028bbb</p>
6149     @@@test:domTree:
6150     document {
6151     xml-version: '1.1';
6152     element {
6153     text-content: 'aaa' U+000A 'bbb';
6154     }
6155     }
6156     @@XMLTest:
6157     @@@QName: xp.endofline.1.0.cr.test
6158     @@@DEnt:
6159     @@@@test:value:
6160     <?xml version="1.0"?>
6161     <p>aaa$u000Dbbb</p>
6162     @@@test:domTree:
6163     document {
6164     xml-version: '1.0';
6165     element {
6166     text-content: 'aaa' U+000A 'bbb';
6167     }
6168     }
6169     @@XMLTest:
6170     @@@QName: xp.endofline.1.1.cr.test
6171     @@@DEnt:
6172     @@@@test:value:
6173     <?xml version="1.1"?>
6174     <p>aaa$u000Dbbb</p>
6175     @@@test:domTree:
6176     document {
6177     xml-version: '1.1';
6178     element {
6179     text-content: 'aaa' U+000A 'bbb';
6180     }
6181     }
6182     @@XMLTest:
6183     @@@QName: xp.endofline.1.0.lf.test
6184     @@@DEnt:
6185     @@@@test:value:
6186     <?xml version="1.0"?>
6187     <p>aaa$u000Abbb</p>
6188     @@@test:domTree:
6189     document {
6190     xml-version: '1.0';
6191     element {
6192     text-content: 'aaa' U+000A 'bbb';
6193     }
6194     }
6195     @@XMLTest:
6196     @@@QName: xp.endofline.1.1.lf.test
6197     @@@DEnt:
6198     @@@@test:value:
6199     <?xml version="1.1"?>
6200     <p>aaa$u000Abbb</p>
6201     @@@test:domTree:
6202     document {
6203     xml-version: '1.1';
6204     element {
6205     text-content: 'aaa' U+000A 'bbb';
6206     }
6207     }
6208     @@XMLTest:
6209     @@@QName: xp.xml10.endofline.nl.in.xmldecl.1.test
6210     @@@DEnt:
6211     @@@@test:value:
6212     <?xml$u0085version="1.0"?>
6213     <p/>
6214     @@@c:erred:
6215     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
6216     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6217     @@XMLTest:
6218     @@@QName: xp.xml11.endofline.nl.in.xmldecl.1.test
6219     @@@DEnt:
6220     @@@@test:value:
6221     <?xml$u0085version="1.1"?>
6222     (err)<p/>
6223     @@@c:erred:
6224     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
6225     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6226     @@XMLTest:
6227     @@@QName: xp.xml10.endofline.crnl.in.xmldecl.1.test
6228     @@@DEnt:
6229     @@@@test:value:
6230     <?xml$u000D$u0085version="1.0"?>
6231     <p/>
6232     @@@c:erred:
6233     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
6234     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6235     @@XMLTest:
6236     @@@QName: xp.xml11.endofline.crnl.in.xmldecl.1.test
6237     @@@DEnt:
6238     @@@@test:value:
6239     <?xml$u000D$u0085version="1.1"?>
6240     (err)<p/>
6241     @@@c:erred:
6242     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
6243     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6244     @@XMLTest:
6245     @@@QName: xp.xml10.endofline.ls.in.xmldecl.1.test
6246     @@@DEnt:
6247     @@@@test:value:
6248     <?xml$u2028version="1.0"?>
6249     <p/>
6250     @@@c:erred:
6251     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
6252     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6253     @@XMLTest:
6254     @@@QName: xp.xml11.endofline.ls.in.xmldecl.1.test
6255     @@@DEnt:
6256     @@@@test:value:
6257     <?xml$u2028version="1.1"?>
6258     (err)<p/>
6259     @@@c:erred:
6260     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
6261     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6262     @@XMLTest:
6263     @@@QName: xp.xml10.endofline.nl.in.xmldecl.2.test
6264     @@@DEnt:
6265     @@@@test:value:
6266     <?xml version="1.0"$u0085?>
6267     <p/>
6268     @@@c:erred:
6269     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
6270     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6271     @@XMLTest:
6272     @@@QName: xp.xml11.endofline.nl.in.xmldecl.2.test
6273     @@@DEnt:
6274     @@@@test:value:
6275     <?xml version="1.1"$u0085?>
6276     (err)<p/>
6277     @@@c:erred:
6278     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
6279     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6280     @@XMLTest:
6281     @@@QName: xp.xml10.endofline.crnl.in.xmldecl.2.test
6282     @@@DEnt:
6283     @@@@test:value:
6284     <?xml version="1.0"$u000D$u0085?>
6285     <p/>
6286     @@@c:erred:
6287     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
6288     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6289     @@XMLTest:
6290     @@@QName: xp.xml11.endofline.crnl.in.xmldecl.2.test
6291     @@@DEnt:
6292     @@@@test:value:
6293     <?xml version="1.1"$u000D$u0085?>
6294     (err)<p/>
6295     @@@c:erred:
6296     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
6297     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6298     @@XMLTest:
6299     @@@QName: xp.xml10.endofline.ls.in.xmldecl.2.test
6300     @@@DEnt:
6301     @@@@test:value:
6302     <?xml version="1.0"$u2028?>
6303     <p/>
6304     @@@c:erred:
6305     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
6306     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6307     @@XMLTest:
6308     @@@QName: xp.xml11.endofline.ls.in.xmldecl.2.test
6309     @@@DEnt:
6310     @@@@test:value:
6311     <?xml version="1.1"$u2028?>
6312     (err)<p/>
6313     @@@c:erred:
6314     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
6315     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6316     @@XMLTest:
6317     @@@QName: xp.xml10.endofline.nl.in.xmldecl.3.test
6318     @@@DEnt:
6319     @@@@test:value:
6320     <?xml $u0085version="1.0"?>
6321     <p/>
6322     @@@c:erred:
6323     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
6324     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6325     @@XMLTest:
6326     @@@QName: xp.xml11.endofline.nl.in.xmldecl.3.test
6327     @@@DEnt:
6328     @@@@test:value:
6329     <?xml $u0085version="1.1"?>
6330     (err)<p/>
6331     @@@c:erred:
6332     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
6333     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6334     @@XMLTest:
6335     @@@QName: xp.xml10.endofline.crnl.in.xmldecl.3.test
6336     @@@DEnt:
6337     @@@@test:value:
6338     <?xml $u000D$u0085version="1.0"?>
6339     <p/>
6340     @@@c:erred:
6341     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
6342     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6343     @@XMLTest:
6344     @@@QName: xp.xml11.endofline.crnl.in.xmldecl.3.test
6345     @@@DEnt:
6346     @@@@test:value:
6347     <?xml $u000D$u0085version="1.1"?>
6348     (err)<p/>
6349     @@@c:erred:
6350     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
6351     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6352     @@XMLTest:
6353     @@@QName: xp.xml10.endofline.ls.in.xmldecl.3.test
6354     @@@DEnt:
6355     @@@@test:value:
6356     <?xml $u2028version="1.0"?>
6357     <p/>
6358     @@@c:erred:
6359     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
6360     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6361     @@XMLTest:
6362     @@@QName: xp.xml11.endofline.ls.in.xmldecl.3.test
6363     @@@DEnt:
6364     @@@@test:value:
6365     <?xml $u2028version="1.1"?>
6366     (err)<p/>
6367     @@@c:erred:
6368     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
6369     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6370     @@XMLTest:
6371     @@@QName: xp.xml10implied.endofline.nl.in.pi.1.test
6372     @@@DEnt:
6373     @@@@test:value:
6374     <?xml-$u0085?>
6375     <p/>
6376     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 7)..(2, 0); }
6377     @@XMLTest:
6378     @@@QName: xp.xml10.endofline.nl.in.pi.1.test
6379     @@@DEnt:
6380     @@@@test:value:
6381     <?xml version="1.0"?>
6382     <?xml-$u0085?>
6383     <p/>
6384     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 7)..(3, 0); }
6385     @@XMLTest:
6386     @@@QName: xp.xml11.endofline.nl.in.pi.1.test
6387     @@@DEnt:
6388     @@@@test:value:
6389     <?xml version="1.1"?>
6390     <?xml-$u0085?>
6391     <p/>
6392     @@@test:domTree:
6393     document {
6394     xml-version: '1.1';
6395     pi {
6396     node-name: 'xml-';
6397     node-value: '';
6398     }
6399     element { }
6400     }
6401     @@XMLTest:
6402     @@@QName: xp.xml10implied.endofline.crnl.in.pi.1.test
6403     @@@DEnt:
6404     @@@@test:value:
6405     <?xml-$u000D$u0085?>
6406     <p/>
6407     @@@test:domTree:
6408     document {
6409     xml-version: '1.0';
6410     pi {
6411     node-name: 'xml-';
6412     node-value: U+0085;
6413     }
6414     element { }
6415     }
6416     @@XMLTest:
6417     @@@QName: xp.xml10.endofline.crnl.in.pi.1.test
6418     @@@DEnt:
6419     @@@@test:value:
6420     <?xml version="1.0"?>
6421     <?xml-$u000D$u0085?>
6422     <p/>
6423     @@@test:domTree:
6424     document {
6425     xml-version: '1.0';
6426     pi {
6427     node-name: 'xml-';
6428     node-value: U+0085;
6429     }
6430     element { }
6431     }
6432     @@XMLTest:
6433     @@@QName: xp.xml11.endofline.crnl.in.pi.1.test
6434     @@@DEnt:
6435     @@@@test:value:
6436     <?xml version="1.1"?>
6437     <?xml-$u000D$u0085?>
6438     <p/>
6439     @@@test:domTree:
6440     document {
6441     xml-version: '1.1';
6442     pi {
6443     node-name: 'xml-';
6444     node-value: '';
6445     }
6446     element { }
6447     }
6448     @@XMLTest:
6449     @@@QName: xp.xml10implied.endofline.ls.in.pi.1.test
6450     @@@DEnt:
6451     @@@@test:value:
6452     <?xml-$u2028?>
6453     <p/>
6454     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 7)..(2, 0); }
6455     @@XMLTest:
6456     @@@QName: xp.xml10.endofline.ls.in.pi.1.test
6457     @@@DEnt:
6458     @@@@test:value:
6459     <?xml version="1.0"?>
6460     <?xml-$u2028?>
6461     <p/>
6462     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 7)..(3, 0); }
6463     @@XMLTest:
6464     @@@QName: xp.xml11.endofline.ls.in.pi.1.test
6465     @@@DEnt:
6466     @@@@test:value:
6467     <?xml version="1.1"?>
6468     <?xml-$u2028?>
6469     <p/>
6470     @@@test:domTree:
6471     document {
6472     xml-version: '1.1';
6473     pi {
6474     node-name: 'xml-';
6475     node-value: '';
6476     }
6477     element { }
6478     }
6479     @@XMLTest:
6480     @@@QName: xp.noxmldecl.pi.pi.test
6481     @@@DEnt:
6482     @@@@test:value:
6483     <?noxml 1?><?noxml 2?><p/>
6484     @@@test:domTree:
6485     document {
6486     xml-version: '1.0';
6487     pi {
6488     node-name: 'noxml';
6489     node-value: '1';
6490     }
6491     pi {
6492     node-name: 'noxml';
6493     node-value: '2';
6494     }
6495     element { }
6496     }
6497     @@XMLTest:
6498     @@@QName: xp.noxmldecl.pi.pi.2.test
6499     @@@DEnt:
6500     @@@@test:value:
6501     <?xmlno 1?><?xmlno 2?><p/>
6502     @@@test:domTree:
6503     document {
6504     xml-version: '1.0';
6505     pi {
6506     node-name: 'xmlno';
6507     node-value: '1';
6508     }
6509     pi {
6510     node-name: 'xmlno';
6511     node-value: '2';
6512     }
6513     element { }
6514     }
6515     @@XMLTest:
6516     @@@QName: xp.noxmldecl.pi.pi.3.test
6517     @@@DEnt:
6518     @@@@test:value:
6519     <?xmln 1?><?xmln 2?><p/>
6520     @@@test:domTree:
6521     document {
6522     xml-version: '1.0';
6523     pi {
6524     node-name: 'xmln';
6525     node-value: '1';
6526     }
6527     pi {
6528     node-name: 'xmln';
6529     node-value: '2';
6530     }
6531     element { }
6532     }
6533     @@XMLTest:
6534     @@@QName: xp.noxml.s.nl.test
6535     @@@DEnt:
6536     @@@@test:value:
6537     $u0085<p/>
6538     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 1)..(2, 0); }
6539     @@XMLTest:
6540     @@@QName: xp.noxml.s.crnl.test
6541     @@@DEnt:
6542     @@@@test:value:
6543     $u000D$u0085<p/>
6544     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 1)..(2, 0); }
6545     @@XMLTest:
6546     @@@QName: xp.noxml.s.ls.test
6547     @@@DEnt:
6548     @@@@test:value:
6549     $u2028<p/>
6550     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 1)..(2, 0); }
6551     @@XMLTest:
6552     @@@QName: xp.xml10.decl.s.nl.test
6553     @@@DEnt:
6554     @@@@test:value:
6555     <?xml version="1.0"?>$u0085<p/>
6556     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 22)..(2, 0); }
6557     @@XMLTest:
6558     @@@QName: xp.xml10.decl.s.crnl.test
6559     @@@DEnt:
6560     @@@@test:value:
6561     <?xml version="1.0"?>$u000D$u0085<p/>
6562     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 0)..(3, 0); }
6563     @@XMLTest:
6564     @@@QName: xp.xml10.decl.s.ls.test
6565     @@@DEnt:
6566     @@@@test:value:
6567     <?xml version="1.0"?>$u2028<p/>
6568     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 22)..(2, 0); }
6569     @@XMLTest:
6570     @@@QName: xp.xml11.decl.s.nl.test
6571     @@@DEnt:
6572     @@@@test:value:
6573     <?xml version="1.1"?>$u0085<p/>
6574     @@@test:domTree:
6575     document {
6576     xml-version: '1.1';
6577     element { }
6578     }
6579     @@XMLTest:
6580     @@@QName: xp.xml11.decl.s.crnl.test
6581     @@@DEnt:
6582     @@@@test:value:
6583     <?xml version="1.1"?>$u000D$u0085<p/>
6584     @@@test:domTree:
6585     document {
6586     xml-version: '1.1';
6587     element { }
6588     }
6589     @@XMLTest:
6590     @@@QName: xp.xml11.decl.s.ls.test
6591     @@@DEnt:
6592     @@@@test:value:
6593     <?xml version="1.1"?>$u2028<p/>
6594     @@@test:domTree:
6595     document {
6596     xml-version: '1.1';
6597     element { }
6598     }
6599    
6600     @@XMLTest:
6601 wakaba 1.18 @@@QName: xp.element.type.match.1.test
6602     @@@DEnt:
6603     @@@@test:value:
6604     <p></pa>(err)
6605     @@@c:erred: <[[xp|wf-element-type-match]]> { (1, 4)..(1, 8); }
6606     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6607     @@XMLTest:
6608     @@@QName: xp.element.type.match.2.test
6609     @@@DEnt:
6610     @@@@test:value:
6611     <p><pa></pa></pa>(err)
6612     @@@c:erred: <[[xp|wf-element-type-match]]> { (1, 13)..(1, 17); }
6613     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6614     @@XMLTest:
6615     @@@QName: xp.element.type.match.3.test
6616     @@@DEnt:
6617     @@@@test:value:
6618     <p><pa></p></p>(err)
6619     @@@c:erred: <[[xp|wf-element-type-match]]> { (1, 8)..(1, 11); }
6620     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6621     @@XMLTest:
6622     @@@QName: xp.element.type.match.4.test
6623     @@@DEnt:
6624     @@@@test:value:
6625     <a:p xmlns:a="about:1"></p>(err)
6626     @@@c:erred: <[[xp|wf-element-type-match]]> { (1, 24)..(1, 27); }
6627     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6628     @@XMLTest:
6629     @@@QName: xp.element.type.match.5.test
6630     @@@DEnt:
6631     @@@@test:value:
6632     <a:p xmlns:a="about:1" xmlns:b="about:1"></b:p>(err)
6633     @@@c:erred: <[[xp|wf-element-type-match]]> { (1, 42)..(1, 47); }
6634     @@@c:erred: <[[xp|wf-syntax-error]]> { }
6635    
6636     @@XMLTest:
6637     @@@QName: xp.stag.stago.name.etago.test
6638     @@@DEnt:
6639     @@@@test:value:
6640     <a</a>
6641     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 3); }
6642     @@XMLTest:
6643     @@@QName: xp.stag.stago.name.s.etago.test
6644     @@@DEnt:
6645     @@@@test:value:
6646     <a </a>
6647     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 4); }
6648     @@XMLTest:
6649     @@@QName: xp.stag.stago.name.s.attr.etago.test
6650     @@@DEnt:
6651     @@@@test:value:
6652     <a a="b"</a>
6653     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9); }
6654     @@XMLTest:
6655     @@@QName: xp.stag.stago.name.s.attr.s.attr.etago.test
6656     @@@DEnt:
6657     @@@@test:value:
6658     <a a="b" c="d"</a>
6659     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 15); }
6660     @@XMLTest:
6661     @@@QName: xp.stag.stago.name.s.attr.s.etago.test
6662     @@@DEnt:
6663     @@@@test:value:
6664     <a a="b" </a>
6665     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 10); }
6666     @@XMLTest:
6667     @@@QName: xp.stag.etag.1.test
6668 wakaba 1.16 @@@DEnt:
6669     @@@@test:value:
6670 wakaba 1.18 <root><a></a></root>
6671 wakaba 1.16 @@@test:domTree:
6672     document {
6673 wakaba 1.18 element {
6674     element {
6675     node-name: 'a';
6676 wakaba 1.16 }
6677     }
6678 wakaba 1.18 }
6679     @@XMLTest:
6680     @@@QName: xp.stag.etag.2.test
6681     @@@DEnt:
6682     @@@@test:value:
6683     <root><ab></ab></root>
6684     @@@test:domTree:
6685     document {
6686 wakaba 1.16 element {
6687 wakaba 1.18 element {
6688     node-name: 'ab';
6689     }
6690 wakaba 1.16 }
6691 wakaba 1.18 }
6692 wakaba 1.16 @@XMLTest:
6693 wakaba 1.18 @@@QName: xp.stag.etag.s.1.test
6694 wakaba 1.16 @@@DEnt:
6695     @@@@test:value:
6696 wakaba 1.18 <root><a ></a ></root>
6697 wakaba 1.16 @@@test:domTree:
6698     document {
6699 wakaba 1.18 element {
6700     element {
6701     node-name: 'a';
6702 wakaba 1.16 }
6703     }
6704 wakaba 1.18 }
6705     @@XMLTest:
6706     @@@QName: xp.etag.1.test
6707     @@@DEnt:
6708     @@@@test:value:
6709     <root><a/></root>
6710     @@@test:domTree:
6711     document {
6712 wakaba 1.16 element {
6713 wakaba 1.18 element {
6714     node-name: 'a';
6715     }
6716 wakaba 1.16 }
6717 wakaba 1.18 }
6718 wakaba 1.16 @@XMLTest:
6719 wakaba 1.18 @@@QName: xp.etag.2.test
6720 wakaba 1.16 @@@DEnt:
6721     @@@@test:value:
6722 wakaba 1.18 <root><a /></root>
6723 wakaba 1.16 @@@test:domTree:
6724     document {
6725     element {
6726 wakaba 1.18 element {
6727     node-name: 'a';
6728     }
6729 wakaba 1.16 }
6730 wakaba 1.18 }
6731 wakaba 1.16 @@XMLTest:
6732 wakaba 1.18 @@@QName: xp.stag.etag.attr.1.test
6733 wakaba 1.16 @@@DEnt:
6734     @@@@test:value:
6735 wakaba 1.18 <root><a at="v"></a></root>
6736 wakaba 1.16 @@@test:domTree:
6737     document {
6738 wakaba 1.18 element {
6739     element {
6740     node-name: 'a';
6741     attribute {
6742     node-name: 'at';
6743     value: 'v';
6744     }
6745 wakaba 1.16 }
6746     }
6747 wakaba 1.18 }
6748     @@XMLTest:
6749     @@@QName: xp.stag.etag.attr.2.test
6750     @@@DEnt:
6751     @@@@test:value:
6752     <root><a at="v" ></a></root>
6753     @@@test:domTree:
6754     document {
6755 wakaba 1.16 element {
6756 wakaba 1.18 element {
6757     node-name: 'a';
6758     attribute {
6759     node-name: 'at';
6760     value: 'v';
6761 wakaba 1.16 }
6762     }
6763     }
6764 wakaba 1.18 }
6765 wakaba 1.16 @@XMLTest:
6766 wakaba 1.18 @@@QName: xp.stag.etag.attr.3.test
6767 wakaba 1.16 @@@DEnt:
6768     @@@@test:value:
6769 wakaba 1.18 <root><a at ="v"></a></root>
6770 wakaba 1.16 @@@test:domTree:
6771     document {
6772 wakaba 1.18 element {
6773     element {
6774     node-name: 'a';
6775     attribute {
6776     node-name: 'at';
6777     value: 'v';
6778     }
6779 wakaba 1.16 }
6780     }
6781 wakaba 1.18 }
6782     @@XMLTest:
6783     @@@QName: xp.stag.etag.attr.4.test
6784     @@@DEnt:
6785     @@@@test:value:
6786     <root><a at= "v"></a></root>
6787     @@@test:domTree:
6788     document {
6789 wakaba 1.16 element {
6790 wakaba 1.18 element {
6791     node-name: 'a';
6792     attribute {
6793     node-name: 'at';
6794     value: 'v';
6795 wakaba 1.16 }
6796     }
6797 wakaba 1.18 }
6798     }
6799     @@XMLTest:
6800     @@@QName: xp.stag.etag.attr.5.test
6801     @@@DEnt:
6802     @@@@test:value:
6803     <root><a at='v'></a></root>
6804     @@@test:domTree:
6805     document {
6806     element {
6807     element {
6808     node-name: 'a';
6809     attribute {
6810     node-name: 'at';
6811     value: 'v';
6812 wakaba 1.16 }
6813     }
6814     }
6815 wakaba 1.18 }
6816 wakaba 1.16 @@XMLTest:
6817 wakaba 1.18 @@@QName: xp.stag.etag.attr.6.test
6818 wakaba 1.16 @@@DEnt:
6819     @@@@test:value:
6820 wakaba 1.18 <root><a at= 'v' ></a></root>
6821 wakaba 1.6 @@@test:domTree:
6822     document {
6823 wakaba 1.18 element {
6824     element {
6825     node-name: 'a';
6826     attribute {
6827     node-name: 'at';
6828     value: 'v';
6829     }
6830 wakaba 1.11 }
6831 wakaba 1.6 }
6832 wakaba 1.18 }
6833     @@XMLTest:
6834     @@@QName: xp.stag.etag.attr.attr.1.test
6835     @@@DEnt:
6836     @@@@test:value:
6837     <root><a at="v" tr="w"></a></root>
6838     @@@test:domTree:
6839     document {
6840 wakaba 1.6 element {
6841 wakaba 1.18 element {
6842     node-name: 'a';
6843     attribute {
6844     node-name: 'at';
6845     value: 'v';
6846 wakaba 1.6 }
6847 wakaba 1.18 attribute {
6848     node-name: 'tr';
6849     value: 'w';
6850 wakaba 1.6 }
6851     }
6852     }
6853 wakaba 1.18 }
6854 wakaba 1.6 @@XMLTest:
6855 wakaba 1.18 @@@QName: xp.stag.etag.attr.attr.2.test
6856 wakaba 1.6 @@@DEnt:
6857     @@@@test:value:
6858 wakaba 1.18 <root><a tr="w" at="v"></a></root>
6859 wakaba 1.6 @@@test:domTree:
6860     document {
6861 wakaba 1.18 element {
6862     element {
6863     node-name: 'a';
6864     attribute {
6865     node-name: 'at';
6866     value: 'v';
6867     }
6868     attribute {
6869     node-name: 'tr';
6870     value: 'w';
6871 wakaba 1.11 }
6872     }
6873 wakaba 1.6 }
6874 wakaba 1.18 }
6875     @@XMLTest:
6876     @@@QName: xp.stag.etag.attr.no.s.attr.test
6877     @@@DEnt:
6878     @@@@test:value:
6879     <root><a at="v"tr="w"></a></root>
6880     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 16)..(1, 17); }
6881     @@XMLTest:
6882     @@@QName: xp.etag.attr.1.test
6883     @@@DEnt:
6884     @@@@test:value:
6885     <root><a at="v" tr="w"></a b="c"></root>
6886     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 28); }
6887     @@XMLTest:
6888     @@@QName: xp.etag.no.etagc.1.test
6889     @@@DEnt:
6890     @@@@test:value:
6891     <root><a at="v" tr="w"></a</root>
6892     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 27)..(1, 28); }
6893     @@XMLTest:
6894     @@@QName: xp.etag.no.etagc.2.test
6895     @@@DEnt:
6896     @@@@test:value:
6897     <root><a at="v" tr="w"></a </root>
6898     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 29)..(1, 30); }
6899     @@XMLTest:
6900     @@@QName: xp.mtag.attr.1.test
6901     @@@DEnt:
6902     @@@@test:value:
6903     <root><a b="c"/></root>
6904     @@@test:domTree:
6905     document {
6906 wakaba 1.6 element {
6907 wakaba 1.18 element {
6908     node-name: 'a';
6909     attribute {
6910     node-name: 'b';
6911     value: 'c';
6912 wakaba 1.6 }
6913     }
6914 wakaba 1.8 }
6915 wakaba 1.18 }
6916 wakaba 1.11 @@XMLTest:
6917 wakaba 1.18 @@@QName: xp.mtag.attr.2.test
6918 wakaba 1.11 @@@DEnt:
6919     @@@@test:value:
6920 wakaba 1.18 <root><a b="c" /></root>
6921 wakaba 1.11 @@@test:domTree:
6922     document {
6923 wakaba 1.18 element {
6924     element {
6925     node-name: 'a';
6926     attribute {
6927     node-name: 'b';
6928     value: 'c';
6929     }
6930 wakaba 1.11 }
6931     }
6932 wakaba 1.18 }
6933 wakaba 1.11 @@XMLTest:
6934 wakaba 1.18 @@@QName: xp.mtag.attr.3.test
6935 wakaba 1.11 @@@DEnt:
6936     @@@@test:value:
6937 wakaba 1.18 <root><a b='c'/></root>
6938 wakaba 1.11 @@@test:domTree:
6939     document {
6940     element {
6941 wakaba 1.18 element {
6942     node-name: 'a';
6943     attribute {
6944     node-name: 'b';
6945     value: 'c';
6946     }
6947     }
6948 wakaba 1.11 }
6949 wakaba 1.18 }
6950 wakaba 1.11 @@XMLTest:
6951 wakaba 1.18 @@@QName: xp.mtag.attr.4.test
6952 wakaba 1.11 @@@DEnt:
6953     @@@@test:value:
6954 wakaba 1.18 <root><a b="c" d="e"/></root>
6955 wakaba 1.11 @@@test:domTree:
6956     document {
6957     element {
6958 wakaba 1.18 element {
6959     node-name: 'a';
6960     attribute {
6961     node-name: 'b';
6962     value: 'c';
6963     }
6964     attribute {
6965     node-name: 'd';
6966     value: 'e';
6967     }
6968 wakaba 1.11 }
6969     }
6970 wakaba 1.18 }
6971    
6972     @@XMLTest:
6973     @@@QName: xp.attvalue.lt.1.test
6974     @@@DEnt:
6975     @@@@test:value:
6976     <a b="aa<dd"/>
6977     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9); }
6978     @@XMLTest:
6979     @@@QName: xp.attvalue.lt.2.test
6980     @@@DEnt:
6981     @@@@test:value:
6982     <a b='aa<dd'/>
6983     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9); }
6984     @@XMLTest:
6985     @@@QName: xp.attvalue.amp.1.test
6986     @@@DEnt:
6987     @@@@test:value:
6988     <a b="aa& dd"/>
6989     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9)..(1, 12); }
6990     @@XMLTest:
6991     @@@QName: xp.attvalue.amp.2.test
6992     @@@DEnt:
6993     @@@@test:value:
6994     <a b='aa& dd'/>
6995     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9)..(1, 12); }
6996     @@XMLTest:
6997     @@@QName: xp.attvalue.amp.3.test
6998     @@@DEnt:
6999     @@@@test:value:
7000     <a b="aa&# dd"/>
7001     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9)..(1, 13); }
7002     @@XMLTest:
7003     @@@QName: xp.attvalue.amp.4.test
7004     @@@DEnt:
7005     @@@@test:value:
7006     <a b="aa&#x dd"/>
7007     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9)..(1, 14); }
7008    
7009     @@XMLTest:
7010     @@@QName: xp.unique.att.spec.1.test
7011     @@@DEnt:
7012     @@@@test:value:
7013     <a b="c" b="d"/>
7014     @@@c:erred: <[[xp|wf-unique-att-spec]]> { (1, 4)..(1, 14); }
7015     @@XMLTest:
7016     @@@QName: xp.unique.att.spec.2.test
7017     @@@DEnt:
7018     @@@@test:value:
7019     <a d:b="c" d:b="d" xmlns:d="about:2"/>
7020     @@@c:erred: <[[xp|wf-unique-att-spec]]> { (1, 4)..(1, 18); }
7021    
7022     @@XMLTest:
7023     @@@QName: xp.no.external.entity.references.1.test
7024     @@@DEnt:
7025     @@@@test:value:
7026     <!DOCTYPE a [
7027     <!ENTITY ent SYSTEM "something">
7028     ]>
7029     <a b="c&ent;"/>
7030     @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (4, 8)..(4, 12); }
7031     @@XMLTest:
7032     @@@QName: xp.no.external.entity.references.2.test
7033     @@@DEnt:
7034     @@@@test:value:
7035     <!DOCTYPE a [
7036     <!NOTATION n SYSTEM "notation">
7037     <!ENTITY ent SYSTEM "something" NDATA n>
7038     ]>
7039     <a b="c&ent;"/>
7040     @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (5, 8)..(5, 12); }
7041     @@XMLTest:
7042     @@@QName: xp.no.external.entity.references.3.test
7043     @@@DEnt:
7044     @@@@test:value:
7045     <!DOCTYPE a [
7046     <!ENTITY ent SYSTEM "something">
7047     <!ENTITY ent2 "ddd&ent;">
7048     ]>
7049     <a b="c&ent2;"/>
7050     @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (1, 4)..(1, 8); }
7051     @@XMLTest:
7052     @@@QName: xp.no.external.entity.references.4.test
7053     @@@DEnt:
7054     @@@@test:value:
7055     <!DOCTYPE a [
7056     <!NOTATION n SYSTEM "notation">
7057     <!ENTITY ent SYSTEM "something" NDATA n>
7058     <!ENTITY ent2 "ddd&ent;">
7059     ]>
7060     <a b="c&ent2;"/>
7061     @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (1, 4)..(1, 8); }
7062     @@XMLTest:
7063     @@@QName: xp.no.lt.in.attr.value.1.test
7064     @@@DEnt:
7065     @@@@test:value:
7066     <!DOCTYPE a [
7067     <!ENTITY ent "aa<bb">
7068     ]>
7069     <a b="c&ent;"/>
7070     @@@c:erred: <[[xp|wf-no-lt-in-attribute-values]]> { (1, 3); }
7071 wakaba 1.20 @@@c:erred:
7072     @@@@@: <[[xp|wf-syntax-error]]> { (1, 3)..(1, 6); }
7073     @@@@enImplNote: When entity node is created.
7074 wakaba 1.18 @@XMLTest:
7075     @@@QName: xp.no.lt.in.attr.value.2.test
7076     @@@DEnt:
7077     @@@@test:value:
7078     <!DOCTYPE a [
7079     <!ENTITY ent "aa<bb">
7080     <!ENTITY ent2 "ccc&ent;">
7081     ]>
7082     <a b="c&ent2;"/>
7083     @@@c:erred: <[[xp|wf-no-lt-in-attribute-values]]> { (1, 3); }
7084 wakaba 1.20 @@@c:erred:
7085     @@@@@: <[[xp|wf-syntax-error]]> { (1, 3)..(1, 6); }
7086     @@@@enImplNote: When entity node is created.
7087 wakaba 1.18 @@XMLTest:
7088     @@@QName: xp.no.lt.in.attr.value.3.test
7089     @@@DEnt:
7090     @@@@test:value:
7091     <!DOCTYPE a [
7092     <!ENTITY ent "aa&#x3C;bb">
7093     ]>
7094     <a b="c&ent;"/>
7095     @@@c:erred: <[[xp|wf-no-lt-in-attribute-values]]> { (1, 3); }
7096 wakaba 1.20 @@@c:erred:
7097     @@@@@: <[[xp|wf-syntax-error]]> { (1, 3)..(1, 6); }
7098     @@@@enImplNote: When entity node is created.
7099 wakaba 1.18 @@XMLTest:
7100     @@@QName: xp.no.lt.in.attr.value.4.test
7101     @@@DEnt:
7102     @@@@test:value:
7103     <!DOCTYPE a [
7104     <!ENTITY ent "aa&#x3C;bb">
7105     <!ENTITY ent2 "ccc&ent;">
7106     ]>
7107     <a b="c&ent2;"/>
7108     @@@c:erred: <[[xp|wf-no-lt-in-attribute-values]]> { (1, 3); }
7109 wakaba 1.20 @@@c:erred:
7110     @@@@@: <[[xp|wf-syntax-error]]> { (1, 3)..(1, 6); }
7111     @@@@enImplNote: When entity node is created.
7112 wakaba 1.11 @@XMLTest:
7113 wakaba 1.18 @@@QName: xp.ger.lt.in.attr.value.1.test
7114 wakaba 1.11 @@@DEnt:
7115     @@@@test:value:
7116     <!DOCTYPE a [
7117 wakaba 1.18 <!ENTITY ent "aa&lt;bb">
7118 wakaba 1.11 ]>
7119 wakaba 1.18 <a b="c&ent;"/>
7120 wakaba 1.11 @@@test:domTree:
7121     document {
7122     document-type {
7123     general-entity {
7124     node-name: 'ent';
7125 wakaba 1.18 text-content: 'aa<bb';
7126 wakaba 1.11 }
7127     }
7128     element {
7129 wakaba 1.18 attribute {
7130     node-name: 'b';
7131     text { data: 'c'; }
7132     general-entity-reference {
7133 wakaba 1.19 is-expanded: true;
7134 wakaba 1.18 node-name: 'ent';
7135     text-content: 'aa<bb';
7136     }
7137     }
7138 wakaba 1.11 }
7139     }
7140     @@XMLTest:
7141 wakaba 1.18 @@@QName: xp.ger.lt.in.attr.value.2.test
7142 wakaba 1.11 @@@DEnt:
7143     @@@@test:value:
7144     <!DOCTYPE a [
7145 wakaba 1.18 <!ENTITY ent "aa&lt;bb">
7146     <!ENTITY ent2 "ccc&ent;">
7147 wakaba 1.11 ]>
7148 wakaba 1.18 <a b="c&ent2;"/>
7149 wakaba 1.11 @@@test:domTree:
7150     document {
7151     document-type {
7152     general-entity {
7153 wakaba 1.18 node-name: 'ent';
7154     text-content: 'aa<bb';
7155     }
7156     general-entity {
7157     node-name: 'ent2';
7158     text { data: 'ccc'; }
7159     general-entity-reference {
7160     node-name: 'ent';
7161     text-content: 'aa<bb';
7162 wakaba 1.19 is-expanded: true;
7163 wakaba 1.18 }
7164 wakaba 1.11 }
7165     }
7166     element {
7167 wakaba 1.18 attribute {
7168     node-name: 'b';
7169     text { data: 'c'; }
7170     general-entity-reference {
7171     node-name: 'ent2';
7172     text { data: 'ccc'; }
7173     general-entity-reference {
7174     node-name: 'ent';
7175     text-content: 'aa<bb';
7176 wakaba 1.19 is-expanded: true;
7177 wakaba 1.18 }
7178 wakaba 1.19 is-expanded: true;
7179 wakaba 1.18 }
7180     }
7181 wakaba 1.11 }
7182     }
7183    
7184 wakaba 1.8 @@XMLTest:
7185 wakaba 1.18 @@@QName: xp.doctype.intsubset.pi.test
7186 wakaba 1.8 @@@DEnt:
7187     @@@@test:value:
7188     <!DOCTYPE a [
7189 wakaba 1.18 <?pi data ?>
7190 wakaba 1.8 ]>
7191     <a></a>
7192     @@@test:domTree:
7193     document {
7194     xml-version: '1.0';
7195     xml-encoding: null;
7196     xml-standalone: false;
7197     document-type {
7198     node-name: 'a';
7199 wakaba 1.18 pi {
7200     target: 'pi';
7201     data: 'data ';
7202 wakaba 1.8 }
7203     }
7204     element {
7205     namespace-uri: null;
7206 wakaba 1.18 prefix: null;
7207 wakaba 1.8 local-name: 'a';
7208 wakaba 1.18 text-content: '';
7209 wakaba 1.8 }
7210     }
7211 wakaba 1.18 @@@enImplNote:
7212     A DOM PI node in doctype node is a manakai extension.
7213    
7214    
7215 wakaba 1.8 @@XMLTest:
7216 wakaba 1.18 @@@QName: xp.doctype.intsubset.entity.general.internal.test
7217 wakaba 1.8 @@@DEnt:
7218     @@@@test:value:
7219     <!DOCTYPE a [
7220 wakaba 1.18 <!ENTITY entity "entity value">
7221 wakaba 1.8 ]>
7222     <a></a>
7223     @@@test:domTree:
7224     document {
7225     xml-version: '1.0';
7226     xml-encoding: null;
7227     xml-standalone: false;
7228     document-type {
7229     node-name: 'a';
7230 wakaba 1.18 general-entity {
7231     node-name: 'entity';
7232     text-content: 'entity value';
7233     has-replacement-tree: true;
7234 wakaba 1.8 }
7235     }
7236     element {
7237     namespace-uri: null;
7238 wakaba 1.18 prefix: null;
7239 wakaba 1.8 local-name: 'a';
7240 wakaba 1.18 text-content: '';
7241 wakaba 1.8 }
7242     }
7243     @@XMLTest:
7244 wakaba 1.18 @@@QName: xp.doctype.intsubset.entity.parameter.internal.test
7245 wakaba 1.8 @@@DEnt:
7246     @@@@test:value:
7247     <!DOCTYPE a [
7248 wakaba 1.18 <!ENTITY % entity "entity value">
7249 wakaba 1.8 ]>
7250     <a></a>
7251     @@@test:domTree:
7252     document {
7253     xml-version: '1.0';
7254     xml-encoding: null;
7255     xml-standalone: false;
7256     document-type {
7257     node-name: 'a';
7258     }
7259     element {
7260     namespace-uri: null;
7261 wakaba 1.18 prefix: null;
7262 wakaba 1.8 local-name: 'a';
7263 wakaba 1.18 text-content: '';
7264 wakaba 1.8 }
7265     }
7266 wakaba 1.18
7267 wakaba 1.8 @@XMLTest:
7268 wakaba 1.18 @@@QName: xp.doctype.internal.entity.root.element.text.only.test
7269 wakaba 1.8 @@@DEnt:
7270     @@@@test:value:
7271     <!DOCTYPE a [
7272 wakaba 1.18 <!ENTITY entity "entity value">
7273 wakaba 1.8 ]>
7274 wakaba 1.18 <a>&entity;</a>
7275 wakaba 1.8 @@@test:domTree:
7276     document {
7277     xml-version: '1.0';
7278     xml-encoding: null;
7279     xml-standalone: false;
7280     document-type {
7281     node-name: 'a';
7282 wakaba 1.18 general-entity {
7283     node-name: 'entity';
7284     text-content: 'entity value';
7285     has-replacement-tree: true;
7286 wakaba 1.8 }
7287     }
7288     element {
7289     namespace-uri: null;
7290 wakaba 1.18 prefix: null;
7291 wakaba 1.8 local-name: 'a';
7292 wakaba 1.18 general-entity-reference {
7293     node-name: 'entity';
7294     text {
7295     data: 'entity value';
7296     }
7297 wakaba 1.19 is-expanded: true;
7298 wakaba 1.10 }
7299 wakaba 1.9 }
7300     }
7301     @@XMLTest:
7302 wakaba 1.18 @@@QName: xp.doctype.internal.entity.root.element.text.mult.test
7303 wakaba 1.9 @@@DEnt:
7304     @@@@test:value:
7305     <!DOCTYPE a [
7306 wakaba 1.18 <!ENTITY entity "entity value">
7307 wakaba 1.9 ]>
7308 wakaba 1.18 <a>&entity; and &entity;</a>
7309 wakaba 1.9 @@@test:domTree:
7310     document {
7311     xml-version: '1.0';
7312     xml-encoding: null;
7313     xml-standalone: false;
7314     document-type {
7315     node-name: 'a';
7316 wakaba 1.18 general-entity {
7317     node-name: 'entity';
7318     text-content: 'entity value';
7319     has-replacement-tree: true;
7320 wakaba 1.9 }
7321     }
7322     element {
7323     namespace-uri: null;
7324 wakaba 1.18 prefix: null;
7325 wakaba 1.9 local-name: 'a';
7326 wakaba 1.18 general-entity-reference {
7327     node-name: 'entity';
7328     text {
7329     data: 'entity value';
7330     }
7331 wakaba 1.19 is-expanded: true;
7332 wakaba 1.18 }
7333     text { data: ' and '; }
7334     general-entity-reference {
7335     node-name: 'entity';
7336     text {
7337     data: 'entity value';
7338     }
7339 wakaba 1.19 is-expanded: true;
7340 wakaba 1.10 }
7341 wakaba 1.9 }
7342     }
7343     @@XMLTest:
7344 wakaba 1.18 @@@QName: xp.doctype.internal.entity.root.element.text.element.test
7345 wakaba 1.9 @@@DEnt:
7346     @@@@test:value:
7347     <!DOCTYPE a [
7348 wakaba 1.18 <!ENTITY entity "entity <p>value</p> with <e>element</e> ">
7349 wakaba 1.9 ]>
7350 wakaba 1.18 <a>&entity;</a>
7351     @@@test:domTree:
7352     document {
7353     xml-version: '1.0';
7354     xml-encoding: null;
7355     xml-standalone: false;
7356     document-type {
7357     node-name: 'a';
7358     general-entity {
7359     node-name: 'entity';
7360     has-replacement-tree: true;
7361     text { data: 'entity '; }
7362     element {
7363     node-name: 'p';
7364     text-content: 'value';
7365     }
7366     text { data: ' with '; }
7367     element {
7368     node-name: 'e';
7369     text-content: 'element';
7370     }
7371 wakaba 1.20 text { data: ' '; }
7372 wakaba 1.18 }
7373     }
7374     element {
7375     namespace-uri: null;
7376     prefix: null;
7377     local-name: 'a';
7378     general-entity-reference {
7379     node-name: 'entity';
7380 wakaba 1.19 is-expanded: true;
7381 wakaba 1.18 text {
7382     data: 'entity ';
7383     }
7384     element {
7385     namespace-uri: null;
7386     prefix: null;
7387     local-name: 'p';
7388     text {
7389     data: 'value';
7390     }
7391     }
7392     text {
7393     data: ' with ';
7394     }
7395     element {
7396     namespace-uri: null;
7397     prefix: null;
7398     local-name: 'e';
7399     text {
7400     data: 'element';
7401     }
7402     }
7403     text {
7404     data: ' ';
7405     }
7406     }
7407     }
7408     }
7409     @@XMLTest:
7410     @@@QName: xp.doctype.internal.entity.root.element.text.in.ent.test
7411     @@@DEnt:
7412     @@@@test:value:
7413     <!DOCTYPE a [
7414     <!ENTITY entity1 "entity value">
7415     <!ENTITY entity2 "e&entity1;n">
7416     ]>
7417     <a>&entity2;</a>
7418     @@@test:domTree:
7419     document {
7420     xml-version: '1.0';
7421     xml-encoding: null;
7422     xml-standalone: false;
7423     document-type {
7424     node-name: 'a';
7425     general-entity {
7426     node-name: 'entity1';
7427     text-content: 'entity value';
7428     }
7429     general-entity {
7430     node-name: 'entity2';
7431     text { data: 'e'; }
7432     general-entity-reference {
7433     node-name: 'entity1';
7434     text-content: 'entity value';
7435     is-expanded: true;
7436     }
7437     text { data: 'n'; }
7438     }
7439     }
7440     element {
7441     namespace-uri: null;
7442     prefix: null;
7443     local-name: 'a';
7444     general-entity-reference {
7445     node-name: 'entity2';
7446     text { data: 'e'; }
7447 wakaba 1.19 is-expanded: true;
7448 wakaba 1.18 general-entity-reference {
7449     node-name: 'entity1';
7450     text {
7451     data: 'entity value';
7452     }
7453 wakaba 1.19 is-expanded: true;
7454 wakaba 1.18 }
7455     text { data: 'n'; }
7456     }
7457     }
7458     }
7459    
7460     @@XMLTest:
7461     @@@QName: xp.doctype.entity.value.charref.test
7462     @@@DEnt:
7463     @@@@test:value:
7464     <!DOCTYPE a [
7465     <!ENTITY entity1 "entity &#x21;value&#35;">
7466     <!ENTITY entity2 '&#x21;value&#35;'>
7467     ]>
7468     <a></a>
7469     @@@test:domTree:
7470     document {
7471     document-type {
7472     general-entity {
7473     node-name: 'entity1';
7474     text-content: 'entity !value#';
7475     has-replacement-tree: true;
7476     }
7477     general-entity {
7478     node-name: 'entity2';
7479     text-content: '!value#';
7480     has-replacement-tree: true;
7481     }
7482     }
7483     element { }
7484     }
7485    
7486     @@XMLTest:
7487     @@@QName: xp.predefined.in.content.test
7488     @@@DEnt:
7489     @@@@test:value:
7490     <a>_&lt;_&gt;_&quot;_&apos;_&amp;_</a>
7491     @@@test:domTree:
7492     document {
7493     element {
7494     text-content: '_<_>_"_' U+0027 '_&_';
7495     }
7496     }
7497     @@XMLTest:
7498     @@@QName: xp.predefined.in.attr.test
7499     @@@DEnt:
7500     @@@@test:value:
7501     <a at="_&lt;_&gt;_&quot;_&apos;_&amp;_"></a>
7502     @@@test:domTree:
7503     document {
7504     element {
7505     attribute {
7506     node-name: 'at';
7507     text-content: '_<_>_"_' U+0027 '_&_';
7508     }
7509     }
7510     }
7511     @@XMLTest:
7512     @@@QName: xp.predefined.in.content.in.entity.test
7513     @@@DEnt:
7514     @@@@test:value:
7515     <!DOCTYPE a [
7516     <!ENTITY ent "_&lt;_&gt;_&quot;_&apos;_&amp;_">
7517     ]>
7518     <a>&ent;</a>
7519     @@@test:domTree:
7520     document {
7521     document-type {
7522     general-entity {
7523     node-name: 'ent';
7524     text-content: '_<_>_"_' U+0027 '_&_';
7525     }
7526     }
7527     element {
7528     text-content: '_<_>_"_' U+0027 '_&_';
7529     }
7530     }
7531     @@XMLTest:
7532     @@@QName: xp.predefined.decl.ignore.test
7533     @@@DEnt:
7534     @@@@test:value:
7535     <!DOCTYPE a [
7536     <!ENTITY lt "&#x26;#x3C;">
7537     <!ENTITY gt "&#x3E;">
7538     <!ENTITY amp "&#x26;#x26;">
7539     <!ENTITY quot "&#x22;">
7540     <!ENTITY apos "&#x27;">
7541     <!ENTITY other "other">
7542     ]>
7543     <a>_&lt;_&gt;_&quot;_&apos;_&amp;_&other;_</a>
7544     @@@test:domTree:
7545     document {
7546     document-type {
7547     general-entity {
7548     node-name: 'other';
7549     text-content: 'other';
7550     }
7551     }
7552     element {
7553     text-content: '_<_>_"_' U+0027 '_&_other_';
7554     }
7555     }
7556    
7557     @@XMLTest:
7558     @@@QName: xp.doctype.internal.attr.empty.test
7559     @@@DEnt:
7560     @@@@test:value:
7561     <!DOCTYPE a [
7562     <!ATTLIST a>
7563     ]>
7564     <a></a>
7565     @@@test:domTree:
7566     document {
7567     xml-version: '1.0';
7568     xml-encoding: null;
7569     xml-standalone: false;
7570     document-type {
7571     node-name: 'a';
7572     element-type-definition {
7573     node-name: 'a';
7574     }
7575     }
7576     element {
7577     namespace-uri: null;
7578     local-name: 'a';
7579     }
7580     }
7581     @@XMLTest:
7582     @@@QName: xp.doctype.internal.attr.cdata.implied.test
7583     @@@DEnt:
7584     @@@@test:value:
7585     <!DOCTYPE a [
7586     <!ATTLIST a
7587     at CDATA #IMPLIED
7588     >
7589     ]>
7590     <a></a>
7591 wakaba 1.9 @@@test:domTree:
7592     document {
7593     xml-version: '1.0';
7594     xml-encoding: null;
7595     xml-standalone: false;
7596     document-type {
7597     node-name: 'a';
7598     element-type-definition {
7599     node-name: 'a';
7600     attribute-definition {
7601     node-name: 'at';
7602 wakaba 1.18 declared-type: const (CDATA_ATTR);
7603 wakaba 1.9 allowed-tokens: DOMStringList ();
7604 wakaba 1.18 default-type: const (IMPLIED_DEFAULT);
7605     text-content: '';
7606 wakaba 1.9 }
7607     }
7608     }
7609     element {
7610     namespace-uri: null;
7611     local-name: 'a';
7612 wakaba 1.18 }
7613     }
7614     @@XMLTest:
7615     @@@QName: xp.doctype.internal.attr.types.implied.test
7616     @@@DEnt:
7617     @@@@test:value:
7618     <!DOCTYPE a [
7619     <!ATTLIST a
7620     at1 ID #IMPLIED
7621     at2 IDREF #IMPLIED
7622     at3 IDREFS #IMPLIED
7623     at4 ENTITY #IMPLIED
7624     at5 ENTITIES #IMPLIED
7625     at6 NMTOKEN #IMPLIED
7626     at7 NMTOKENS #IMPLIED
7627     at8 NOTATION (n1 | n2|n3) #IMPLIED
7628     at9 (e1| e2| e3 ) #IMPLIED
7629     >
7630     ]>
7631     <a></a>
7632     @@@test:domTree:
7633     document {
7634     xml-version: '1.0';
7635     xml-encoding: null;
7636     xml-standalone: false;
7637     document-type {
7638     node-name: 'a';
7639     element-type-definition {
7640     node-name: 'a';
7641     attribute-definition {
7642     node-name: 'at1';
7643     declared-type: const (ID_ATTR);
7644     allowed-tokens: DOMStringList ();
7645     default-type: const (IMPLIED_DEFAULT);
7646     text-content: '';
7647     }
7648     attribute-definition {
7649     node-name: 'at2';
7650     declared-type: const (IDREF_ATTR);
7651     allowed-tokens: DOMStringList ();
7652     default-type: const (IMPLIED_DEFAULT);
7653     text-content: '';
7654     }
7655     attribute-definition {
7656     node-name: 'at3';
7657     declared-type: const (IDREFS_ATTR);
7658     allowed-tokens: DOMStringList ();
7659     default-type: const (IMPLIED_DEFAULT);
7660     text-content: '';
7661     }
7662     attribute-definition {
7663     node-name: 'at4';
7664     declared-type: const (ENTITY_ATTR);
7665     allowed-tokens: DOMStringList ();
7666     default-type: const (IMPLIED_DEFAULT);
7667     text-content: '';
7668     }
7669     attribute-definition {
7670     node-name: 'at5';
7671     declared-type: const (ENTITIES_ATTR);
7672     allowed-tokens: DOMStringList ();
7673     default-type: const (IMPLIED_DEFAULT);
7674     text-content: '';
7675     }
7676     attribute-definition {
7677     node-name: 'at6';
7678     declared-type: const (NMTOKEN_ATTR);
7679     allowed-tokens: DOMStringList ();
7680     default-type: const (IMPLIED_DEFAULT);
7681     text-content: '';
7682     }
7683     attribute-definition {
7684     node-name: 'at7';
7685     declared-type: const (NMTOKENS_ATTR);
7686     allowed-tokens: DOMStringList ();
7687     default-type: const (IMPLIED_DEFAULT);
7688     text-content: '';
7689     }
7690     attribute-definition {
7691     node-name: 'at8';
7692     declared-type: const (NOTATION_ATTR);
7693     allowed-tokens: DOMStringList ('n1', 'n2', 'n3');
7694     default-type: const (IMPLIED_DEFAULT);
7695     text-content: '';
7696     }
7697     attribute-definition {
7698     node-name: 'at9';
7699     declared-type: const (ENUMERATION_ATTR);
7700     allowed-tokens: DOMStringList ('e1', 'e2', 'e3');
7701     default-type: const (IMPLIED_DEFAULT);
7702     text-content: '';
7703     }
7704     }
7705     }
7706     element {
7707     namespace-uri: null;
7708     local-name: 'a';
7709     }
7710     }
7711     @@XMLTest:
7712     @@@QName: xp.doctype.internal.attr.cdata.defaults.test
7713     @@@DEnt:
7714     @@@@test:value:
7715     <!DOCTYPE a [
7716     <!ATTLIST a
7717     at1 CDATA #IMPLIED
7718     at2 CDATA #REQUIRED
7719     at3 CDATA #FIXED "value3"
7720     at4 CDATA "value4"
7721     at5 CDATA #FIXED 'value5'
7722     at6 CDATA 'value6'
7723     >
7724     ]>
7725     <a></a>
7726     @@@test:domTree:
7727     document {
7728     xml-version: '1.0';
7729     xml-encoding: null;
7730     xml-standalone: false;
7731     document-type {
7732     node-name: 'a';
7733     element-type-definition {
7734     node-name: 'a';
7735     attribute-definition {
7736     node-name: 'at1';
7737     declared-type: const (CDATA_ATTR);
7738     allowed-tokens: DOMStringList ();
7739     default-type: const (IMPLIED_DEFAULT);
7740     text-content: '';
7741     }
7742     attribute-definition {
7743     node-name: 'at2';
7744     declared-type: const (CDATA_ATTR);
7745     allowed-tokens: DOMStringList ();
7746     default-type: const (REQUIRED_DEFAULT);
7747     text-content: '';
7748     }
7749     attribute-definition {
7750     node-name: 'at3';
7751     declared-type: const (CDATA_ATTR);
7752     allowed-tokens: DOMStringList ();
7753     default-type: const (FIXED_DEFAULT);
7754     text-content: 'value3';
7755     }
7756     attribute-definition {
7757     node-name: 'at4';
7758     declared-type: const (CDATA_ATTR);
7759     allowed-tokens: DOMStringList ();
7760     default-type: const (EXPLICIT_DEFAULT);
7761     text-content: 'value4';
7762     }
7763     attribute-definition {
7764     node-name: 'at5';
7765     declared-type: const (CDATA_ATTR);
7766     allowed-tokens: DOMStringList ();
7767     default-type: const (FIXED_DEFAULT);
7768     text-content: 'value5';
7769     }
7770     attribute-definition {
7771     node-name: 'at6';
7772     declared-type: const (CDATA_ATTR);
7773     allowed-tokens: DOMStringList ();
7774     default-type: const (EXPLICIT_DEFAULT);
7775     text-content: 'value6';
7776     }
7777     }
7778     }
7779     element {
7780     namespace-uri: null;
7781     local-name: 'a';
7782     attribute {
7783     node-name: 'at3';
7784     text-content: 'value3';
7785     specified: false;
7786     }
7787     attribute {
7788     node-name: 'at4';
7789     text-content: 'value4';
7790     specified: false;
7791     }
7792     attribute {
7793     node-name: 'at5';
7794     text-content: 'value5';
7795     specified: false;
7796     }
7797     attribute {
7798     node-name: 'at6';
7799     text-content: 'value6';
7800     specified: false;
7801     }
7802     }
7803     }
7804    
7805     @@XMLTest:
7806     @@@QName: xp.doctype.internal.attr.cdata.default.normalize.test
7807     @@@DEnt:
7808     @@@@test:value:
7809     <!DOCTYPE a [
7810     <!ATTLIST a
7811     at CDATA " default &#x0A;value "
7812     >
7813     ]>
7814     <a></a>
7815     @@@test:domTree:
7816     document {
7817     xml-version: '1.0';
7818     xml-encoding: null;
7819     xml-standalone: false;
7820     document-type {
7821     node-name: 'a';
7822     element-type-definition {
7823     node-name: 'a';
7824     attribute-definition {
7825     node-name: 'at';
7826     declared-type: const (CDATA_ATTR);
7827     allowed-tokens: DOMStringList ();
7828     default-type: const (EXPLICIT_DEFAULT);
7829     text-content: ' default ' U+000A 'value ';
7830     }
7831     }
7832     }
7833     element {
7834     namespace-uri: null;
7835     local-name: 'a';
7836     attribute {
7837     node-name: 'at';
7838     text-content: ' default ' U+000A 'value ';
7839     specified: false;
7840     }
7841     }
7842     }
7843     @@XMLTest:
7844     @@@QName: xp.doctype.internal.attr.nmtoken.default.normalize.test
7845     @@@DEnt:
7846     @@@@test:value:
7847     <!DOCTYPE a [
7848     <!ATTLIST a
7849     at NMTOKEN " default &#x0A;value "
7850     >
7851     ]>
7852     <a></a>
7853     @@@test:domTree:
7854     document {
7855     xml-version: '1.0';
7856     xml-encoding: null;
7857     xml-standalone: false;
7858     document-type {
7859     node-name: 'a';
7860     element-type-definition {
7861     node-name: 'a';
7862     attribute-definition {
7863     node-name: 'at';
7864     declared-type: const (NMTOKEN_ATTR);
7865     allowed-tokens: DOMStringList ();
7866     default-type: const (EXPLICIT_DEFAULT);
7867     text-content: ' default ' U+000A 'value ';
7868     }
7869     }
7870     }
7871     element {
7872     namespace-uri: null;
7873     local-name: 'a';
7874     attribute {
7875     node-name: 'at';
7876     text-content: ' default ' U+000A 'value ';
7877     specified: false;
7878     }
7879     }
7880     }
7881    
7882     @@XMLTest:
7883     @@@QName: xp.doctype.attrtype.no-value.test
7884     @@@DEnt:
7885     @@@@test:value:
7886     <!DOCTYPE a>
7887     <a at=" at value "></a>
7888     @@@test:domTree:
7889     document {
7890     xml-version: '1.0';
7891     xml-encoding: null;
7892     xml-standalone: false;
7893     document-type { }
7894     element {
7895     namespace-uri: null;
7896     local-name: 'a';
7897     attribute {
7898     namespace-uri: null;
7899     local-name: 'at';
7900     value: ' at value ';
7901     text {
7902     data: ' at value ';
7903     }
7904     schema-type-info: TypeInfo (null, null);
7905     specified: true;
7906     }
7907     }
7908     }
7909     @@XMLTest:
7910     @@@QName: xp.doctype.attrtype.cdata.test
7911     @@@DEnt:
7912     @@@@test:value:
7913     <!DOCTYPE a [
7914     <!ATTLIST a
7915     at CDATA #IMPLIED
7916     >
7917     ]>
7918     <a at=" at value "></a>
7919     @@@test:domTree:
7920     document {
7921     xml-version: '1.0';
7922     xml-encoding: null;
7923     xml-standalone: false;
7924     document-type { }
7925     element {
7926     namespace-uri: null;
7927     local-name: 'a';
7928     attribute {
7929     namespace-uri: null;
7930     local-name: 'at';
7931     value: ' at value ';
7932     text {
7933     data: ' at value ';
7934     }
7935     schema-type-info:
7936     TypeInfo ('http://www.w3.org/TR/REC-xml', 'CDATA');
7937     specified: true;
7938     }
7939     }
7940     }
7941     @@XMLTest:
7942     @@@QName: xp.doctype.attrtype.nmtoken.test
7943     @@@DEnt:
7944     @@@@test:value:
7945     <!DOCTYPE a [
7946     <!ATTLIST a
7947     at NMTOKEN #IMPLIED
7948     >
7949     ]>
7950     <a at=" at value "></a>
7951     @@@test:domTree:
7952     document {
7953     xml-version: '1.0';
7954     xml-encoding: null;
7955     xml-standalone: false;
7956     document-type { }
7957     element {
7958     namespace-uri: null;
7959     local-name: 'a';
7960     attribute {
7961     namespace-uri: null;
7962     local-name: 'at';
7963     value: 'at value';
7964     text {
7965     data: ' at value ';
7966     }
7967     schema-type-info:
7968     TypeInfo ('http://www.w3.org/TR/REC-xml', 'NMTOKEN');
7969     specified: true;
7970     }
7971     }
7972     }
7973    
7974     @@XMLTest:
7975     @@@QName: xp.doctype.attr.normalization.1.test
7976     @@@DEnt:
7977     @@@@test:value:
7978     <a at=" at &#xA;value "></a>
7979     @@@test:domTree:
7980     document {
7981     element {
7982     attribute {
7983     node-name: 'at';
7984     value: ' at ' U+000A 'value ';
7985     schema-type-info: TypeInfo (null, null);
7986     specified: true;
7987     }
7988     }
7989     }
7990     @@XMLTest:
7991     @@@QName: xp.doctype.attr.normalization.2.test
7992     @@@DEnt:
7993     @@@@test:value:
7994     <a at=" at &#xD;value "></a>
7995     @@@test:domTree:
7996     document {
7997     element {
7998     attribute {
7999     value: ' at ' U+000D 'value ';
8000     schema-type-info: TypeInfo (null, null);
8001     specified: true;
8002     }
8003     }
8004     }
8005     @@XMLTest:
8006     @@@QName: xp.doctype.attr.normalization.3.test
8007     @@@DEnt:
8008     @@@@test:value:
8009     <a at=" at &#x9;value "></a>
8010     @@@test:domTree:
8011     document {
8012     element {
8013     attribute {
8014     node-name: 'at';
8015     value: ' at ' U+0009 'value ';
8016     schema-type-info: TypeInfo (null, null);
8017     specified: true;
8018     }
8019     }
8020     }
8021    
8022     @@XMLTest:
8023     @@@QName: xp.doctype.attr.specified.1.test
8024     @@@DEnt:
8025     @@@@test:value:
8026     <!DOCTYPE a [
8027     <!ATTLIST a
8028     at CDATA "default"
8029     >
8030     ]>
8031     <a></a>
8032     @@@test:domTree:
8033     document {
8034     document-type { }
8035     element {
8036     attribute {
8037     node-name: 'at';
8038     value: 'default';
8039     specified: false;
8040     }
8041     }
8042     }
8043     @@XMLTest:
8044     @@@QName: xp.doctype.attr.specified.2.test
8045     @@@DEnt:
8046     @@@@test:value:
8047     <!DOCTYPE a [
8048     <!ATTLIST a
8049     at CDATA "default"
8050     >
8051     ]>
8052     <a at2="specified"></a>
8053     @@@test:domTree:
8054     document {
8055     document-type { }
8056     element {
8057     attribute {
8058     node-name: 'at';
8059     value: 'default';
8060     specified: false;
8061     }
8062     attribute {
8063     node-name: 'at2';
8064     value: 'specified';
8065     specified: true;
8066     }
8067     }
8068     }
8069     @@XMLTest:
8070     @@@QName: xp.doctype.attr.specified.3.test
8071     @@@DEnt:
8072     @@@@test:value:
8073     <!DOCTYPE a [
8074     <!ATTLIST a
8075     at CDATA "default"
8076     >
8077     ]>
8078     <a at="specified"></a>
8079     @@@test:domTree:
8080     document {
8081     document-type { }
8082     element {
8083     attribute {
8084     node-name: 'at';
8085     value: 'specified';
8086     specified: true;
8087     }
8088     }
8089     }
8090    
8091     @@XMLTest:
8092     @@@QName: xp.attr.literal.charref.test
8093     @@@DEnt:
8094     @@@@test:value:
8095     <a at1 = "value&#33;_&#x25;value"
8096     at2 = 'value&#x25;_&#33;value'></a>
8097     @@@test:domTree:
8098     document {
8099     element {
8100     attribute {
8101     node-name: 'at1';
8102     text-content: 'value!_%value';
8103     }
8104     attribute {
8105     node-name: 'at2';
8106     text-content: 'value%_!value';
8107     }
8108     }
8109     }
8110     @@XMLTest:
8111     @@@QName: xp.attr.literal.entref.test
8112     @@@DEnt:
8113     @@@@test:value:
8114     <!DOCTYPE a [
8115     <!ENTITY ent "entity&#x26;#33;_&#x26;#x29;value">
8116     ]>
8117     <a at1 = "value&ent;value"
8118     at2 = 'value&ent;value'></a>
8119     @@@test:domTree:
8120     document {
8121     document-type {
8122     general-entity {
8123     node-name: 'ent';
8124     text-content: 'entity!_)value';
8125     }
8126     }
8127     element {
8128     attribute {
8129     node-name: 'at1';
8130     text-content: 'valueentity!_)valuevalue';
8131     }
8132     attribute {
8133     node-name: 'at2';
8134     text-content: 'valueentity!_)valuevalue';
8135     }
8136     }
8137     }
8138     @@XMLTest:
8139     @@@QName: xp.attr.literal.entref.nest.test
8140     @@@DEnt:
8141     @@@@test:value:
8142     <!DOCTYPE a [
8143     <!ENTITY ent1 "entity&#x26;#33;_&#x26;#x29;value">
8144     <!ENTITY ent2 "@&ent1;@">
8145     ]>
8146     <a at1 = "value&ent2;value"
8147     at2 = 'value&ent2;value'></a>
8148     @@@test:domTree:
8149     document {
8150     document-type {
8151     general-entity {
8152     node-name: 'ent1';
8153     text-content: 'entity!_)value';
8154     }
8155     general-entity {
8156     node-name: 'ent2';
8157     text-content: '@entity!_)value@';
8158     }
8159     }
8160     element {
8161     attribute {
8162     node-name: 'at1';
8163     text-content: 'value@entity!_)value@value';
8164     }
8165     attribute {
8166     node-name: 'at2';
8167     text-content: 'value@entity!_)value@value';
8168     }
8169     }
8170     }
8171    
8172     @@XMLTest:
8173     @@@QName: xp.element.content.ncr.1.test
8174     @@@DEnt:
8175     @@@@test:value:
8176     <e>&#33;</e>
8177     @@@test:domTree:
8178     document {
8179     element {
8180     text-content: '!';
8181     }
8182     }
8183     @@XMLTest:
8184     @@@QName: xp.element.content.ncr.2.test
8185     @@@DEnt:
8186     @@@@test:value:
8187     <e>aaaa&#33;bbbb</e>
8188     @@@test:domTree:
8189     document {
8190     element {
8191     text-content: 'aaaa!bbbb';
8192     }
8193     }
8194     @@XMLTest:
8195     @@@QName: xp.attrval.ncr.1.test
8196     @@@DEnt:
8197     @@@@test:value:
8198     <e a="&#33;"/>
8199     @@@test:domTree:
8200     document {
8201     element {
8202     attribute {
8203     node-name: 'a';
8204     text-content: '!';
8205     }
8206     }
8207     }
8208     @@XMLTest:
8209     @@@QName: xp.attrval.ncr.2.test
8210     @@@DEnt:
8211     @@@@test:value:
8212     <e a="aaaaa&#33;bbbbb"/>
8213     @@@test:domTree:
8214     document {
8215     element {
8216     attribute {
8217     node-name: 'a';
8218     text-content: 'aaaaa!bbbbb';
8219     }
8220     }
8221     }
8222     @@XMLTest:
8223     @@@QName: xp.attrval.ncr.3.test
8224     @@@DEnt:
8225     @@@@test:value:
8226     <e a='&#33;'/>
8227     @@@test:domTree:
8228     document {
8229     element {
8230     attribute {
8231     node-name: 'a';
8232     text-content: '!';
8233     }
8234     }
8235     }
8236     @@XMLTest:
8237     @@@QName: xp.attrval.ncr.4.test
8238     @@@DEnt:
8239     @@@@test:value:
8240     <e a='aaaaa&#33;bbbbb'/>
8241     @@@test:domTree:
8242     document {
8243     element {
8244     attribute {
8245     node-name: 'a';
8246     text-content: 'aaaaa!bbbbb';
8247     }
8248     }
8249     }
8250     @@XMLTest:
8251     @@@QName: xp.entval.ncr.1.test
8252     @@@DEnt:
8253     @@@@test:value:
8254     <!DOCTYPE e [
8255     <!ENTITY ent "&#33;">
8256     ]>
8257     <e/>
8258     @@@test:domTree:
8259     document {
8260     document-type {
8261     general-entity {
8262     node-name: 'ent';
8263     text-content: '!';
8264     }
8265     }
8266     element { }
8267     }
8268     @@XMLTest:
8269     @@@QName: xp.entval.ncr.2.test
8270     @@@DEnt:
8271     @@@@test:value:
8272     <!DOCTYPE e [
8273     <!ENTITY ent "aaaaa&#33;bbbbb">
8274     ]>
8275     <e/>
8276     @@@test:domTree:
8277     document {
8278     document-type {
8279     general-entity {
8280     node-name: 'ent';
8281     text-content: 'aaaaa!bbbbb';
8282     }
8283     }
8284     element { }
8285     }
8286     @@XMLTest:
8287     @@@QName: xp.element.content.reptxt.ncr.1.test
8288     @@@DEnt:
8289     @@@@test:value:
8290     <!DOCTYPE e [
8291     <!ENTITY ent "&#38;#33;">
8292     ]>
8293     <e>&ent;</e>
8294     @@@test:domTree:
8295     document {
8296     document-type { }
8297     element {
8298     general-entity-reference {
8299     node-name: 'ent';
8300     text-content: '!';
8301 wakaba 1.19 is-expanded: true;
8302 wakaba 1.18 }
8303     }
8304     }
8305     @@XMLTest:
8306     @@@QName: xp.element.content.reptxt.ncr.2.test
8307     @@@DEnt:
8308     @@@@test:value:
8309     <!DOCTYPE e [
8310     <!ENTITY ent "aaaaa&#38;#33;bbbbb">
8311     ]>
8312     <e>&ent;</e>
8313     @@@test:domTree:
8314     document {
8315     document-type { }
8316     element {
8317     general-entity-reference {
8318     node-name: 'ent';
8319     text-content: 'aaaaa!bbbbb';
8320 wakaba 1.19 is-expanded: true;
8321 wakaba 1.18 }
8322     }
8323     }
8324     @@XMLTest:
8325     @@@QName: xp.element.content.reptxt.reptxt.ncr.1.test
8326     @@@DEnt:
8327     @@@@test:value:
8328     <!DOCTYPE e [
8329     <!ENTITY ent "&#38;#33;">
8330     <!ENTITY ent2 "&ent;">
8331     ]>
8332     <e>&ent2;</e>
8333     @@@test:domTree:
8334     document {
8335     document-type { }
8336     element {
8337     general-entity-reference {
8338     node-name: 'ent2';
8339     general-entity-reference {
8340     node-name: 'ent';
8341     text-content: '!';
8342 wakaba 1.19 is-expanded: true;
8343 wakaba 1.18 }
8344 wakaba 1.19 is-expanded: true;
8345 wakaba 1.18 }
8346     }
8347     }
8348     @@XMLTest:
8349     @@@QName: xp.element.content.reptxt.reptxt.ncr.2.test
8350     @@@DEnt:
8351     @@@@test:value:
8352     <!DOCTYPE e [
8353     <!ENTITY ent "aa&#38;#33;bb">
8354     <!ENTITY ent2 "&ent;">
8355     ]>
8356     <e>&ent2;</e>
8357     @@@test:domTree:
8358     document {
8359     document-type { }
8360     element {
8361     general-entity-reference {
8362     node-name: 'ent2';
8363     general-entity-reference {
8364     node-name: 'ent';
8365     text-content: 'aa!bb';
8366 wakaba 1.19 is-expanded: true;
8367 wakaba 1.18 }
8368 wakaba 1.19 is-expanded: true;
8369 wakaba 1.18 }
8370     }
8371     }
8372     @@XMLTest:
8373     @@@QName: xp.attval.reptxt.ncr.1.test
8374     @@@DEnt:
8375     @@@@test:value:
8376     <!DOCTYPE e [
8377     <!ENTITY ent "&#38;#33;">
8378     ]>
8379     <e a="&ent;"/>
8380     @@@test:domTree:
8381     document {
8382     document-type { }
8383     element {
8384     attribute {
8385     node-name: 'a';
8386     general-entity-reference {
8387     node-name: 'ent';
8388     text-content: '!';
8389 wakaba 1.19 is-expanded: true;
8390 wakaba 1.18 }
8391     }
8392     }
8393     }
8394     @@XMLTest:
8395     @@@QName: xp.attval.reptxt.ncr.2.test
8396     @@@DEnt:
8397     @@@@test:value:
8398     <!DOCTYPE e [
8399     <!ENTITY ent "aaaaa&#38;#33;bbbbb">
8400     ]>
8401     <e a="&ent;"/>
8402     @@@test:domTree:
8403     document {
8404     document-type { }
8405     element {
8406     attribute {
8407     node-name: 'a';
8408     general-entity-reference {
8409     node-name: 'ent';
8410     text-content: 'aaaaa!bbbbb';
8411 wakaba 1.19 is-expanded: true;
8412 wakaba 1.18 }
8413     }
8414     }
8415     }
8416     @@XMLTest:
8417     @@@QName: xp.attval.reptxt.reptxt.ncr.1.test
8418     @@@DEnt:
8419     @@@@test:value:
8420     <!DOCTYPE e [
8421     <!ENTITY ent "&#38;#33;">
8422     <!ENTITY ent2 "&ent;">
8423     ]>
8424     <e a="&ent2;"/>
8425     @@@test:domTree:
8426     document {
8427     document-type { }
8428     element {
8429     attribute {
8430     node-name: 'a';
8431     general-entity-reference {
8432     node-name: 'ent2';
8433 wakaba 1.19 is-expanded: true;
8434 wakaba 1.18 general-entity-reference {
8435     node-name: 'ent';
8436     text-content: '!';
8437 wakaba 1.19 is-expanded: true;
8438 wakaba 1.18 }
8439     }
8440     }
8441     }
8442     }
8443     @@XMLTest:
8444     @@@QName: xp.attval.reptxt.reptxt.ncr.2.test
8445     @@@DEnt:
8446     @@@@test:value:
8447     <!DOCTYPE e [
8448     <!ENTITY ent "aa&#38;#33;bb">
8449     <!ENTITY ent2 "&ent;">
8450     ]>
8451     <e a="&ent2;"/>
8452     @@@test:domTree:
8453     document {
8454     document-type { }
8455     element {
8456     attribute {
8457     node-name: 'a';
8458     general-entity-reference {
8459     node-name: 'ent2';
8460 wakaba 1.19 is-expanded: true;
8461 wakaba 1.18 general-entity-reference {
8462     node-name: 'ent';
8463     text-content: 'aa!bb';
8464 wakaba 1.19 is-expanded: true;
8465 wakaba 1.18 }
8466     }
8467     }
8468     }
8469     }
8470    
8471     @@XMLTest:
8472     @@@QName: xp.element.content.hcr.1.test
8473     @@@DEnt:
8474     @@@@test:value:
8475     <e>&#x21;</e>
8476     @@@test:domTree:
8477     document {
8478     element {
8479     text-content: '!';
8480     }
8481     }
8482     @@XMLTest:
8483     @@@QName: xp.element.content.hcr.2.test
8484     @@@DEnt:
8485     @@@@test:value:
8486     <e>aaaa&#x21;bbbb</e>
8487     @@@test:domTree:
8488     document {
8489     element {
8490     text-content: 'aaaa!bbbb';
8491     }
8492     }
8493     @@XMLTest:
8494     @@@QName: xp.attrval.hcr.1.test
8495     @@@DEnt:
8496     @@@@test:value:
8497     <e a="&#x21;"/>
8498     @@@test:domTree:
8499     document {
8500     element {
8501     attribute {
8502     node-name: 'a';
8503     text-content: '!';
8504     }
8505     }
8506     }
8507     @@XMLTest:
8508     @@@QName: xp.attrval.hcr.2.test
8509     @@@DEnt:
8510     @@@@test:value:
8511     <e a="aaaaa&#x21;bbbbb"/>
8512     @@@test:domTree:
8513     document {
8514     element {
8515     attribute {
8516     node-name: 'a';
8517     text-content: 'aaaaa!bbbbb';
8518     }
8519     }
8520     }
8521     @@XMLTest:
8522     @@@QName: xp.attrval.hcr.3.test
8523     @@@DEnt:
8524     @@@@test:value:
8525     <e a='&#x21;'/>
8526     @@@test:domTree:
8527     document {
8528     element {
8529     attribute {
8530     node-name: 'a';
8531     text-content: '!';
8532     }
8533     }
8534     }
8535     @@XMLTest:
8536     @@@QName: xp.attrval.hcr.4.test
8537     @@@DEnt:
8538     @@@@test:value:
8539     <e a='aaaaa&#x21;bbbbb'/>
8540     @@@test:domTree:
8541     document {
8542     element {
8543     attribute {
8544     node-name: 'a';
8545     text-content: 'aaaaa!bbbbb';
8546     }
8547     }
8548     }
8549     @@XMLTest:
8550     @@@QName: xp.entval.hcr.1.test
8551     @@@DEnt:
8552     @@@@test:value:
8553     <!DOCTYPE e [
8554     <!ENTITY ent "&#x21;">
8555     ]>
8556     <e/>
8557     @@@test:domTree:
8558     document {
8559     document-type {
8560     general-entity {
8561     node-name: 'ent';
8562     text-content: '!';
8563 wakaba 1.10 }
8564 wakaba 1.9 }
8565 wakaba 1.18 element { }
8566 wakaba 1.9 }
8567     @@XMLTest:
8568 wakaba 1.18 @@@QName: xp.entval.hcr.2.test
8569 wakaba 1.9 @@@DEnt:
8570     @@@@test:value:
8571 wakaba 1.18 <!DOCTYPE e [
8572     <!ENTITY ent "aaaaa&#x21;bbbbb">
8573     ]>
8574     <e/>
8575 wakaba 1.9 @@@test:domTree:
8576     document {
8577 wakaba 1.18 document-type {
8578     general-entity {
8579     node-name: 'ent';
8580     text-content: 'aaaaa!bbbbb';
8581 wakaba 1.9 }
8582     }
8583 wakaba 1.18 element { }
8584 wakaba 1.9 }
8585     @@XMLTest:
8586 wakaba 1.18 @@@QName: xp.element.content.reptxt.hcr.1.test
8587 wakaba 1.9 @@@DEnt:
8588     @@@@test:value:
8589 wakaba 1.18 <!DOCTYPE e [
8590     <!ENTITY ent "&#38;#x21;">
8591 wakaba 1.9 ]>
8592 wakaba 1.18 <e>&ent;</e>
8593 wakaba 1.9 @@@test:domTree:
8594     document {
8595     document-type { }
8596     element {
8597 wakaba 1.18 general-entity-reference {
8598     node-name: 'ent';
8599     text-content: '!';
8600 wakaba 1.19 is-expanded: true;
8601 wakaba 1.9 }
8602     }
8603     }
8604     @@XMLTest:
8605 wakaba 1.18 @@@QName: xp.element.content.reptxt.hcr.2.test
8606 wakaba 1.9 @@@DEnt:
8607     @@@@test:value:
8608 wakaba 1.18 <!DOCTYPE e [
8609     <!ENTITY ent "aaaaa&#38;#x21;bbbbb">
8610 wakaba 1.9 ]>
8611 wakaba 1.18 <e>&ent;</e>
8612 wakaba 1.9 @@@test:domTree:
8613     document {
8614     document-type { }
8615     element {
8616 wakaba 1.18 general-entity-reference {
8617     node-name: 'ent';
8618     text-content: 'aaaaa!bbbbb';
8619 wakaba 1.19 is-expanded: true;
8620 wakaba 1.9 }
8621     }
8622     }
8623     @@XMLTest:
8624 wakaba 1.18 @@@QName: xp.element.content.reptxt.reptxt.hcr.1.test
8625 wakaba 1.9 @@@DEnt:
8626     @@@@test:value:
8627 wakaba 1.18 <!DOCTYPE e [
8628     <!ENTITY ent "&#38;#x21;">
8629     <!ENTITY ent2 "&ent;">
8630     ]>
8631     <e>&ent2;</e>
8632 wakaba 1.9 @@@test:domTree:
8633     document {
8634 wakaba 1.18 document-type { }
8635 wakaba 1.9 element {
8636 wakaba 1.18 general-entity-reference {
8637     node-name: 'ent2';
8638 wakaba 1.19 is-expanded: true;
8639 wakaba 1.18 general-entity-reference {
8640     node-name: 'ent';
8641     text-content: '!';
8642 wakaba 1.19 is-expanded: true;
8643 wakaba 1.18 }
8644 wakaba 1.9 }
8645     }
8646     }
8647     @@XMLTest:
8648 wakaba 1.18 @@@QName: xp.element.content.reptxt.reptxt.hcr.2.test
8649 wakaba 1.9 @@@DEnt:
8650     @@@@test:value:
8651 wakaba 1.18 <!DOCTYPE e [
8652     <!ENTITY ent "aa&#38;#x21;bb">
8653     <!ENTITY ent2 "&ent;">
8654     ]>
8655     <e>&ent2;</e>
8656 wakaba 1.9 @@@test:domTree:
8657     document {
8658 wakaba 1.18 document-type { }
8659 wakaba 1.9 element {
8660 wakaba 1.18 general-entity-reference {
8661     node-name: 'ent2';
8662 wakaba 1.19 is-expanded: true;
8663 wakaba 1.18 general-entity-reference {
8664     node-name: 'ent';
8665 wakaba 1.19 is-expanded: true;
8666 wakaba 1.18 text-content: 'aa!bb';
8667     }
8668 wakaba 1.9 }
8669     }
8670     }
8671     @@XMLTest:
8672 wakaba 1.18 @@@QName: xp.attval.reptxt.hcr.1.test
8673 wakaba 1.9 @@@DEnt:
8674     @@@@test:value:
8675 wakaba 1.18 <!DOCTYPE e [
8676     <!ENTITY ent "&#38;#x21;">
8677     ]>
8678     <e a="&ent;"/>
8679 wakaba 1.9 @@@test:domTree:
8680     document {
8681 wakaba 1.18 document-type { }
8682 wakaba 1.9 element {
8683     attribute {
8684 wakaba 1.18 node-name: 'a';
8685     general-entity-reference {
8686     node-name: 'ent';
8687 wakaba 1.19 is-expanded: true;
8688 wakaba 1.18 text-content: '!';
8689     }
8690 wakaba 1.10 }
8691     }
8692     }
8693     @@XMLTest:
8694 wakaba 1.18 @@@QName: xp.attval.reptxt.hcr.2.test
8695 wakaba 1.10 @@@DEnt:
8696     @@@@test:value:
8697 wakaba 1.18 <!DOCTYPE e [
8698     <!ENTITY ent "aaaaa&#38;#x21;bbbbb">
8699 wakaba 1.10 ]>
8700 wakaba 1.18 <e a="&ent;"/>
8701 wakaba 1.10 @@@test:domTree:
8702     document {
8703     document-type { }
8704     element {
8705     attribute {
8706 wakaba 1.18 node-name: 'a';
8707     general-entity-reference {
8708     node-name: 'ent';
8709 wakaba 1.19 is-expanded: true;
8710 wakaba 1.18 text-content: 'aaaaa!bbbbb';
8711     }
8712 wakaba 1.10 }
8713     }
8714     }
8715     @@XMLTest:
8716 wakaba 1.18 @@@QName: xp.attval.reptxt.reptxt.hcr.1.test
8717 wakaba 1.10 @@@DEnt:
8718     @@@@test:value:
8719 wakaba 1.18 <!DOCTYPE e [
8720     <!ENTITY ent "&#38;#x21;">
8721     <!ENTITY ent2 "&ent;">
8722 wakaba 1.10 ]>
8723 wakaba 1.18 <e a="&ent2;"/>
8724 wakaba 1.10 @@@test:domTree:
8725     document {
8726     document-type { }
8727     element {
8728     attribute {
8729 wakaba 1.18 node-name: 'a';
8730     general-entity-reference {
8731     node-name: 'ent2';
8732 wakaba 1.19 is-expanded: true;
8733 wakaba 1.18 general-entity-reference {
8734     node-name: 'ent';
8735 wakaba 1.19 is-expanded: true;
8736 wakaba 1.18 text-content: '!';
8737     }
8738     }
8739 wakaba 1.10 }
8740     }
8741     }
8742     @@XMLTest:
8743 wakaba 1.18 @@@QName: xp.attval.reptxt.reptxt.hcr.2.test
8744 wakaba 1.10 @@@DEnt:
8745     @@@@test:value:
8746 wakaba 1.18 <!DOCTYPE e [
8747     <!ENTITY ent "aa&#38;#x21;bb">
8748     <!ENTITY ent2 "&ent;">
8749 wakaba 1.10 ]>
8750 wakaba 1.18 <e a="&ent2;"/>
8751 wakaba 1.10 @@@test:domTree:
8752     document {
8753     document-type { }
8754     element {
8755     attribute {
8756 wakaba 1.18 node-name: 'a';
8757     general-entity-reference {
8758     node-name: 'ent2';
8759 wakaba 1.19 is-expanded: true;
8760 wakaba 1.18 general-entity-reference {
8761     node-name: 'ent';
8762 wakaba 1.19 is-expanded: true;
8763 wakaba 1.18 text-content: 'aa!bb';
8764     }
8765     }
8766 wakaba 1.11 }
8767     }
8768     }
8769    
8770     @@XMLTest:
8771 wakaba 1.18 @@@QName: xp.element.content.ncr.legal.char.1.0.1.test
8772     @@@DEnt:
8773     @@@@test:value:
8774     <?xml version="1.0"?>
8775     <e>&#0;</e>
8776     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 7); }
8777     @@XMLTest:
8778     @@@QName: xp.element.content.ncr.legal.char.1.1.1.test
8779     @@@DEnt:
8780     @@@@test:value:
8781     <?xml version="1.1"?>
8782     <e>&#0;</e>
8783     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 7); }
8784     @@XMLTest:
8785     @@@QName: xp.element.content.ncr.legal.char.1.0.2.test
8786     @@@DEnt:
8787     @@@@test:value:
8788     <?xml version="1.0"?>
8789     <e>&#1;</e>
8790     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 7); }
8791     @@XMLTest:
8792     @@@QName: xp.element.content.ncr.legal.char.1.1.2.test
8793 wakaba 1.11 @@@DEnt:
8794     @@@@test:value:
8795 wakaba 1.18 <?xml version="1.1"?>
8796     <e>&#1;</e>
8797 wakaba 1.11 @@@test:domTree:
8798     document {
8799 wakaba 1.18 xml-version: '1.1';
8800 wakaba 1.11 element {
8801 wakaba 1.18 text-content: U+0001;
8802 wakaba 1.11 }
8803     }
8804     @@XMLTest:
8805 wakaba 1.18 @@@QName: xp.element.content.hcr.legal.char.1.0.1.test
8806     @@@DEnt:
8807     @@@@test:value:
8808     <?xml version="1.0"?>
8809     <e>&#x0;</e>
8810     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 8); }
8811     @@XMLTest:
8812     @@@QName: xp.element.content.hcr.legal.char.1.1.1.test
8813     @@@DEnt:
8814     @@@@test:value:
8815     <?xml version="1.1"?>
8816     <e>&#x0;</e>
8817     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 8); }
8818     @@XMLTest:
8819     @@@QName: xp.element.content.hcr.legal.char.1.0.2.test
8820 wakaba 1.11 @@@DEnt:
8821     @@@@test:value:
8822 wakaba 1.18 <?xml version="1.0"?>
8823     <e>&#x1;</e>
8824     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 8); }
8825 wakaba 1.11 @@XMLTest:
8826 wakaba 1.18 @@@QName: xp.element.content.hcr.legal.char.1.1.2.test
8827 wakaba 1.11 @@@DEnt:
8828     @@@@test:value:
8829 wakaba 1.18 <?xml version="1.1"?>
8830     <e>&#x1;</e>
8831 wakaba 1.11 @@@test:domTree:
8832     document {
8833 wakaba 1.18 xml-version: '1.1';
8834 wakaba 1.11 element {
8835 wakaba 1.18 text-content: U+0001;
8836 wakaba 1.6 }
8837     }
8838    
8839 wakaba 1.19 @@XMLTest:
8840     @@@QName: xp.element.content.ger.entity.declared.nodtd.1.test
8841     @@@DEnt:
8842     @@@@test:value:
8843     <p>&entity;</p>
8844     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 4)..(1, 11); }
8845     @@XMLTest:
8846     @@@QName: xp.element.content.ger.entity.declared.nodtd.2.test
8847     @@@DEnt:
8848     @@@@test:value:
8849     <?xml version="1.0" standalone="yes"?>
8850     <p>&entity;</p>
8851     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 4)..(2, 11); }
8852     @@XMLTest:
8853     @@@QName: xp.element.content.ger.entity.declared.nodtd.3.test
8854     @@@DEnt:
8855     @@@@test:value:
8856     <?xml version="1.0" standalone="no"?>
8857     <p>&entity;</p>
8858     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 4)..(2, 11); }
8859     @@XMLTest:
8860     @@@QName: xp.element.content.ger.entity.declared.nodtd.-1.test
8861     @@@DEnt:
8862     @@@@test:value:
8863     <p>&lt;&gt;&amp;&quot;&apos;</p>
8864     @@@test:domTree:
8865     document {
8866     element {
8867     text-content: '<>&"' U+0027;
8868     }
8869     }
8870     @@XMLTest:
8871     @@@QName: xp.element.content.ger.entity.declared.nopref.1.test
8872     @@@DEnt:
8873     @@@@test:value:
8874     <!DOCTYPE p []>
8875     <p>&entity;</p>
8876     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 4)..(2, 11); }
8877     @@XMLTest:
8878     @@@QName: xp.element.content.ger.entity.declared.nopref.2.test
8879     @@@DEnt:
8880     @@@@test:value:
8881     <!DOCTYPE p [
8882     <!ENTITY other "aa">
8883     <!ENTITY % another "aa">
8884     ]>
8885     <p>&entity;</p>
8886     @@@c:erred: <[[xp|wf-entity-declared]]> { (5, 4)..(5, 11); }
8887     @@XMLTest:
8888     @@@QName: xp.element.content.ger.entity.declared.nopref.3.test
8889     @@@DEnt:
8890     @@@@test:value:
8891     <?xml version="1.0" standalone="yes"?>
8892     <!DOCTYPE p []>
8893     <p>&entity;</p>
8894     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 4)..(3, 11); }
8895     @@XMLTest:
8896     @@@QName: xp.element.content.ger.entity.declared.nopref.4.test
8897     @@@DEnt:
8898     @@@@test:value:
8899     <?xml version="1.0" standalone="no"?>
8900     <!DOCTYPE p []>
8901     <p>&entity;</p>
8902     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 4)..(3, 11); }
8903     @@XMLTest:
8904     @@@QName: xp.element.content.ger.entity.declared.nopref.5.test
8905     @@@DEnt:
8906     @@@@test:value:
8907     <?xml version="1.0" standalone="yes"?>
8908     <!DOCTYPE p [
8909     <!ENTITY other "aa">
8910     <!ENTITY % another "aa">
8911     ]>
8912     <p>&entity;</p>
8913     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 4)..(6, 11); }
8914     @@XMLTest:
8915     @@@QName: xp.element.content.ger.entity.declared.nopref.6.test
8916     @@@DEnt:
8917     @@@@test:value:
8918     <?xml version="1.0" standalone="no"?>
8919     <!DOCTYPE p [
8920     <!ENTITY other "aa">
8921     <!ENTITY % another "aa">
8922     ]>
8923     <p>&entity;</p>
8924     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 4)..(6, 11); }
8925     @@XMLTest:
8926     @@@QName: xp.element.content.ger.entity.declared.nopref.-1.test
8927     @@@DEnt:
8928     @@@@test:value:
8929     <!DOCTYPE p [
8930     <!ENTITY entity "value">
8931     ]>
8932     <p>&entity;</p>
8933     @@@test:domTree:
8934     document {
8935     document-type {
8936     general-entity {
8937     node-name: 'entity';
8938     text-content: 'value';
8939     }
8940     }
8941     element {
8942 wakaba 1.20 general-entity-reference {
8943 wakaba 1.19 node-name: 'entity';
8944 wakaba 1.20 is-expanded: true;
8945 wakaba 1.19 text-content: 'value';
8946     }
8947     }
8948     }
8949     @@XMLTest:
8950     @@@QName: xp.element.content.ger.entity.declared.nopref.-2.test
8951     @@@DEnt:
8952     @@@@test:value:
8953     <!DOCTYPE p [
8954     <!ENTITY entity "value">
8955     <!ENTITY another SYSTEM "another">
8956     ]>
8957     <p>&entity;</p>
8958     @@@test:domTree:
8959     document {
8960     document-type {
8961     general-entity {
8962     node-name: 'entity';
8963     text-content: 'value';
8964     }
8965 wakaba 1.20 general-entity {
8966     node-name: 'another';
8967     public-id: null;
8968     system-id: 'another';
8969     }
8970 wakaba 1.19 }
8971     element {
8972 wakaba 1.20 general-entity-reference {
8973 wakaba 1.19 node-name: 'entity';
8974 wakaba 1.20 is-expanded: true;
8975 wakaba 1.19 text-content: 'value';
8976     }
8977     }
8978     }
8979     @@XMLTest:
8980     @@@QName: xp.element.content.ger.entity.declared.standalone.1.test
8981     @@@DEnt:
8982     @@@@test:value:
8983     <?xml version="1.0" standalone="yes"?>
8984     <p>&entity;</p>
8985     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 4)..(2, 11); }
8986     @@XMLTest:
8987     @@@QName: xp.element.content.ger.entity.declared.standalone.2.test
8988     @@@DEnt:
8989     @@@@test:value:
8990     <?xml version="1.0" standalone="yes"?>
8991     <!DOCTYPE p []>
8992     <p>&entity;</p>
8993     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 4)..(3, 11); }
8994     @@XMLTest:
8995     @@@QName: xp.element.content.ger.entity.declared.standalone.3.test
8996     @@@DEnt:
8997     @@@@test:value:
8998     <?xml version="1.0" standalone="yes"?>
8999     <!DOCTYPE p [
9000     <!ENTITY % para "<!-- -->">
9001     %para;
9002     ]>
9003     <p>&entity;</p>
9004     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 4)..(6, 11); }
9005     @@XMLTest:
9006     @@@QName: xp.element.content.ger.entity.declared.standalone.-1.test
9007     @@@DEnt:
9008     @@@@test:value:
9009     <?xml version="1.0" standalone="no"?>
9010     <!DOCTYPE p [
9011     <!ENTITY % para "<!-- -->">
9012     %para;
9013     ]>
9014     <p>&entity;</p>
9015     @@@test:domTree:
9016     document {
9017     document-type { }
9018     element {
9019     general-entity-reference {
9020     is-expanded: false;
9021     }
9022     }
9023     }
9024     @@XMLTest:
9025     @@@QName: xp.element.content.ger.entity.declared.standalone.-2.test
9026     @@@DEnt:
9027     @@@@test:value:
9028     <!DOCTYPE p [
9029     <!ENTITY % para "<!-- -->">
9030     %para;
9031     ]>
9032     <p>&entity;</p>
9033     @@@test:domTree:
9034     document {
9035     document-type { }
9036     element {
9037     general-entity-reference {
9038     is-expanded: false;
9039     }
9040     }
9041     }
9042     @@XMLTest:
9043     @@@QName: xp.element.content.ger.entity.declared.standalone.4.test
9044     @@@DEnt:
9045     @@@@test:value:
9046     <?xml version="1.0" standalone="yes"?>
9047     <!DOCTYPE p [
9048     <!ENTITY % para SYSTEM "para">
9049     %para;
9050     ]>
9051     <p>&entity;</p>
9052     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 4)..(6, 11); }
9053     @@XMLTest:
9054     @@@QName: xp.element.content.ger.entity.declared.standalone.-3.test
9055     @@@DEnt:
9056     @@@@test:value:
9057     <?xml version="1.0" standalone="no"?>
9058     <!DOCTYPE p [
9059     <!ENTITY % para SYSTEM "para">
9060     %para;
9061     ]>
9062     <p>&entity;</p>
9063     @@@test:domTree:
9064     document {
9065     document-type { }
9066     element {
9067     general-entity-reference {
9068     is-expanded: false;
9069     }
9070     }
9071     }
9072     @@XMLTest:
9073     @@@QName: xp.element.content.ger.entity.declared.standalone.-4.test
9074     @@@DEnt:
9075     @@@@test:value:
9076     <!DOCTYPE p [
9077     <!ENTITY % para SYSTEM "para">
9078     %para;
9079     ]>
9080     <p>&entity;</p>
9081     @@@test:domTree:
9082     document {
9083     document-type { }
9084     element {
9085     general-entity-reference {
9086     is-expanded: false;
9087     }
9088     }
9089     }
9090     @@XMLTest:
9091     @@@QName: xp.element.content.ger.entity.declared.standalone.5.test
9092     @@@DEnt:
9093     @@@@test:value:
9094     <?xml version="1.0" standalone="yes"?>
9095     <!DOCTYPE p SYSTEM "dtd">
9096     <p>&entity;</p>
9097     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 4)..(3, 11); }
9098     @@XMLTest:
9099     @@@QName: xp.element.content.ger.entity.declared.standalone.-5.test
9100     @@@DEnt:
9101     @@@@test:value:
9102     <?xml version="1.0" standalone="no"?>
9103     <!DOCTYPE p SYSTEM "dtd">
9104     <p>&entity;</p>
9105     @@@test:domTree:
9106     document {
9107     document-type { }
9108     element {
9109     general-entity-reference {
9110     is-expanded: false;
9111     }
9112     }
9113     }
9114     @@XMLTest:
9115     @@@QName: xp.element.content.ger.entity.declared.standalone.-6.test
9116     @@@DEnt:
9117     @@@@test:value:
9118     <!DOCTYPE p SYSTEM "dtd">
9119     <p>&entity;</p>
9120     @@@test:domTree:
9121     document {
9122     document-type { }
9123     element {
9124     general-entity-reference {
9125     is-expanded: false;
9126     }
9127     }
9128     }
9129    
9130 wakaba 1.20 @@XMLTest:
9131     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.1.test
9132     @@@DEnt:
9133     @@@@test:value:
9134     <!DOCTYPE p [
9135     <!ENTITY c "&entity;">
9136     ]>
9137     <p>&c;</p>
9138     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
9139     @@XMLTest:
9140     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.2.test
9141     @@@DEnt:
9142     @@@@test:value:
9143     <!DOCTYPE p [
9144     <!ENTITY other "aa">
9145     <!ENTITY % another "aa">
9146     <!ENTITY c "&entity;">
9147     ]>
9148     <p>&c;</p>
9149     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
9150     @@XMLTest:
9151     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.3.test
9152     @@@DEnt:
9153     @@@@test:value:
9154     <?xml version="1.0" standalone="yes"?>
9155     <!DOCTYPE p [
9156     <!ENTITY c "&entity;">
9157     ]>
9158     <p>&c;</p>
9159     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
9160     @@XMLTest:
9161     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.4.test
9162     @@@DEnt:
9163     @@@@test:value:
9164     <?xml version="1.0" standalone="no"?>
9165     <!DOCTYPE p [
9166     <!ENTITY c "&entity;">
9167     ]>
9168     <p>&c;</p>
9169     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
9170     @@XMLTest:
9171     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.5.test
9172     @@@DEnt:
9173     @@@@test:value:
9174     <?xml version="1.0" standalone="yes"?>
9175     <!DOCTYPE p [
9176     <!ENTITY other "aa">
9177     <!ENTITY % another "aa">
9178     <!ENTITY c "&entity;">
9179     ]>
9180     <p>&c;</p>
9181     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
9182     @@XMLTest:
9183     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.6.test
9184     @@@DEnt:
9185     @@@@test:value:
9186     <?xml version="1.0" standalone="no"?>
9187     <!DOCTYPE p [
9188     <!ENTITY other "aa">
9189     <!ENTITY % another "aa">
9190     <!ENTITY c "&entity;">
9191     ]>
9192     <p>&c;</p>
9193     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
9194     @@XMLTest:
9195     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.-1.test
9196     @@@DEnt:
9197     @@@@test:value:
9198     <!DOCTYPE p [
9199     <!ENTITY entity "value">
9200     <!ENTITY c "&entity;">
9201     ]>
9202     <p>&c;</p>
9203     @@@test:domTree:
9204     document {
9205     document-type {
9206     general-entity {
9207     node-name: 'entity';
9208     text-content: 'value';
9209     }
9210     general-entity {
9211     node-name: 'c';
9212     general-entity-reference {
9213     node-name: 'entity';
9214     text-content: 'value';
9215     }
9216     }
9217     }
9218     element {
9219     general-entity-reference {
9220     node-name: 'c';
9221     general-entity-reference {
9222     node-name: 'entity';
9223     text-content: 'value';
9224     }
9225     }
9226     }
9227     }
9228     @@XMLTest:
9229     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.-2.test
9230     @@@DEnt:
9231     @@@@test:value:
9232     <!DOCTYPE p [
9233     <!ENTITY entity "value">
9234     <!ENTITY another SYSTEM "another">
9235     <!ENTITY c "&entity;">
9236     ]>
9237     <p>&c;</p>
9238     @@@test:domTree:
9239     document {
9240     document-type {
9241     general-entity {
9242     node-name: 'entity';
9243     text-content: 'value';
9244     }
9245     general-entity {
9246     node-name: 'c';
9247     general-entity-reference {
9248     node-name: 'entity';
9249     text-content: 'value';
9250     }
9251     }
9252     general-entity {
9253     node-name: 'another';
9254     public-id: null;
9255     system-id: 'another';
9256     has-replacement-tree: false;
9257     }
9258     }
9259     element {
9260     general-entity-reference {
9261     node-name: 'c';
9262     general-entity-reference {
9263     node-name: 'entity';
9264     text-content: 'value';
9265     }
9266     }
9267     }
9268     }
9269     @@XMLTest:
9270     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.2.test
9271     @@@DEnt:
9272     @@@@test:value:
9273     <?xml version="1.0" standalone="yes"?>
9274     <!DOCTYPE p [
9275     <!ENTITY c "&entity;">
9276     ]>
9277     <p>&c;</p>
9278     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
9279     @@XMLTest:
9280     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.3.test
9281     @@@DEnt:
9282     @@@@test:value:
9283     <?xml version="1.0" standalone="yes"?>
9284     <!DOCTYPE p [
9285     <!ENTITY % para "<!-- -->">
9286     %para;
9287     <!ENTITY c "&entity;">
9288     ]>
9289     <p>&c;</p>
9290     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
9291     @@XMLTest:
9292     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-1.test
9293     @@@DEnt:
9294     @@@@test:value:
9295     <?xml version="1.0" standalone="no"?>
9296     <!DOCTYPE p [
9297     <!ENTITY c "&entity;">
9298     <!ENTITY % para "<!-- -->">
9299     %para;
9300     ]>
9301     <p>&c;</p>
9302     @@@test:domTree:
9303     document {
9304     document-type {
9305     general-entity {
9306     node-name: 'c';
9307     general-entity-reference {
9308     node-name: 'entity';
9309     is-expanded: false;
9310     }
9311     }
9312     }
9313     element {
9314     general-entity-reference {
9315     node-name: 'c';
9316     general-entity-reference {
9317     node-name: 'entity';
9318     is-expanded: false;
9319     }
9320     }
9321     }
9322     }
9323     @@XMLTest:
9324     @@@QName:
9325     xp.reptxt.element.content.ger.entity.declared.standalone.-1.2.test
9326     @@@DEnt:
9327     @@@@test:value:
9328     <?xml version="1.0" standalone="no"?>
9329     <!DOCTYPE p [
9330     <!ENTITY % para "<!-- -->">
9331     %para;
9332     <!ENTITY c "&entity;">
9333     ]>
9334     <p>&c;</p>
9335     @@@test:domTree:
9336     document {
9337     document-type { }
9338     element {
9339     general-entity-reference {
9340     node-name: 'c';
9341     is-expanded: false;
9342     }
9343     }
9344     }
9345     @@XMLTest:
9346     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-2.test
9347     @@@DEnt:
9348     @@@@test:value:
9349     <!DOCTYPE p [
9350     <!ENTITY c "&entity;">
9351     <!ENTITY % para "<!-- -->">
9352     %para;
9353     ]>
9354     <p>&c;</p>
9355     @@@test:domTree:
9356     document {
9357     document-type { }
9358     element {
9359     general-entity-reference {
9360     node-name: 'c';
9361     is-expanded: true;
9362     general-entity-reference {
9363     node-name: 'entity';
9364     is-expanded: false;
9365     }
9366     }
9367     }
9368     }
9369     @@XMLTest:
9370     @@@QName:
9371     xp.reptxt.element.content.ger.entity.declared.standalone.-2.2.test
9372     @@@DEnt:
9373     @@@@test:value:
9374     <!DOCTYPE p [
9375     <!ENTITY % para "<!-- -->">
9376     %para;
9377     <!ENTITY c "&entity;">
9378     ]>
9379     <p>&c;</p>
9380     @@@test:domTree:
9381     document {
9382     document-type { }
9383     element {
9384     general-entity-reference {
9385     node-name: 'c';
9386     is-expanded: false;
9387     }
9388     }
9389     }
9390     @@XMLTest:
9391     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.4.test
9392     @@@DEnt:
9393     @@@@test:value:
9394     <?xml version="1.0" standalone="yes"?>
9395     <!DOCTYPE p [
9396     <!ENTITY % para SYSTEM "para">
9397     %para;
9398     <!ENTITY c "&entity;">
9399     ]>
9400     <p>&c;</p>
9401     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
9402     @@XMLTest:
9403     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-3.test
9404     @@@DEnt:
9405     @@@@test:value:
9406     <?xml version="1.0" standalone="no"?>
9407     <!DOCTYPE p [
9408     <!ENTITY c "&entity;">
9409     <!ENTITY % para SYSTEM "para">
9410     %para;
9411     ]>
9412     <p>&c;</p>
9413     @@@test:domTree:
9414     document {
9415     document-type { }
9416     element {
9417     general-entity-reference {
9418     node-name: 'c';
9419     is-expanded: true;
9420     general-entity-reference {
9421     node-name: 'entity';
9422     is-expanded: false;
9423     }
9424     }
9425     }
9426     }
9427     @@XMLTest:
9428     @@@QName:
9429     xp.reptxt.element.content.ger.entity.declared.standalone.-3.2.test
9430     @@@DEnt:
9431     @@@@test:value:
9432     <?xml version="1.0" standalone="no"?>
9433     <!DOCTYPE p [
9434     <!ENTITY % para SYSTEM "para">
9435     %para;
9436     <!ENTITY c "&entity;">
9437     ]>
9438     <p>&c;</p>
9439     @@@test:domTree:
9440     document {
9441     document-type { }
9442     element {
9443     general-entity-reference {
9444     node-name: 'c';
9445     is-expanded: false;
9446     }
9447     }
9448     }
9449     @@XMLTest:
9450     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-4.test
9451     @@@DEnt:
9452     @@@@test:value:
9453     <!DOCTYPE p [
9454     <!ENTITY c "&entity;">
9455     <!ENTITY % para SYSTEM "para">
9456     %para;
9457     ]>
9458     <p>&c;</p>
9459     @@@test:domTree:
9460     document {
9461     document-type { }
9462     element {
9463     general-entity-reference {
9464     node-name: 'c';
9465     is-expanded: true;
9466     general-entity-reference {
9467     node-name: 'entity';
9468     is-expanded: false;
9469     }
9470     }
9471     }
9472     }
9473     @@XMLTest:
9474     @@@QName:
9475     xp.reptxt.element.content.ger.entity.declared.standalone.-4.2.test
9476     @@@DEnt:
9477     @@@@test:value:
9478     <!DOCTYPE p [
9479     <!ENTITY % para SYSTEM "para">
9480     %para;
9481     <!ENTITY c "&entity;">
9482     ]>
9483     <p>&c;</p>
9484     @@@test:domTree:
9485     document {
9486     document-type { }
9487     element {
9488     general-entity-reference {
9489     node-name: 'c';
9490     is-expanded: false;
9491     }
9492     }
9493     }
9494     @@XMLTest:
9495     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.5.test
9496     @@@DEnt:
9497     @@@@test:value:
9498     <?xml version="1.0" standalone="yes"?>
9499     <!DOCTYPE p SYSTEM "dtd" [
9500     <!ENTITY c "&entity;">
9501     ]>
9502     <p>&c;</p>
9503     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
9504     @@XMLTest:
9505     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-5.test
9506     @@@DEnt:
9507     @@@@test:value:
9508     <?xml version="1.0" standalone="no"?>
9509     <!DOCTYPE p SYSTEM "dtd" [
9510     <!ENTITY c "&entity;">
9511     ]>
9512     <p>&c;</p>
9513     @@@test:domTree:
9514     document {
9515     document-type { }
9516     element {
9517     general-entity-reference {
9518     node-name: 'c';
9519     is-expanded: true;
9520     general-entity-reference {
9521     node-name: 'entity';
9522     is-expanded: false;
9523     }
9524     }
9525     }
9526     }
9527     @@XMLTest:
9528     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-6.test
9529     @@@DEnt:
9530     @@@@test:value:
9531     <!DOCTYPE p SYSTEM "dtd" [<!ENTITY c "&entity;">]>
9532     <p>&c;</p>
9533     @@@test:domTree:
9534     document {
9535     document-type { }
9536     element {
9537     general-entity-reference {
9538     node-name: 'c';
9539     is-expanded: true;
9540     general-entity-reference {
9541     node-name: 'entity';
9542     is-expanded: false;
9543     }
9544     }
9545     }
9546     }
9547    
9548     @@XMLTest:
9549     @@@QName: xp.attval.ger.entity.declared.nodtd.1.test
9550     @@@DEnt:
9551     @@@@test:value:
9552     <p a="&entity;"/>
9553     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 7)..(1, 14); }
9554     @@XMLTest:
9555     @@@QName: xp.attval.ger.entity.declared.nodtd.2.test
9556     @@@DEnt:
9557     @@@@test:value:
9558     <?xml version="1.0" standalone="yes"?>
9559     <p a="&entity;"/>
9560     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 7)..(2, 14); }
9561     @@XMLTest:
9562     @@@QName: xp.attval.ger.entity.declared.nodtd.3.test
9563     @@@DEnt:
9564     @@@@test:value:
9565     <?xml version="1.0" standalone="no"?>
9566     <p a="&entity;"/>
9567     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 7)..(2, 14); }
9568     @@XMLTest:
9569     @@@QName: xp.attval.ger.entity.declared.nodtd.-1.test
9570     @@@DEnt:
9571     @@@@test:value:
9572     <p a="&lt;&gt;&amp;&quot;&apos;"/>
9573     @@@test:domTree:
9574     document {
9575     element {
9576     attribute {
9577     node-name: 'a';
9578     text-content: '<>&"' U+0027;
9579     }
9580     }
9581     }
9582     @@XMLTest:
9583     @@@QName: xp.attval.ger.entity.declared.nopref.1.test
9584     @@@DEnt:
9585     @@@@test:value:
9586     <!DOCTYPE p []>
9587     <p a="&entity;"/>
9588     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 7)..(2, 14); }
9589     @@XMLTest:
9590     @@@QName: xp.attval.ger.entity.declared.nopref.2.test
9591     @@@DEnt:
9592     @@@@test:value:
9593     <!DOCTYPE p [
9594     <!ENTITY other "aa">
9595     <!ENTITY % another "aa">
9596     ]>
9597     <p a="&entity;"/>
9598     @@@c:erred: <[[xp|wf-entity-declared]]> { (5, 7)..(5, 14); }
9599     @@XMLTest:
9600     @@@QName: xp.attval.ger.entity.declared.nopref.3.test
9601     @@@DEnt:
9602     @@@@test:value:
9603     <?xml version="1.0" standalone="yes"?>
9604     <!DOCTYPE p []>
9605     <p a="&entity;"/>
9606     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 7)..(3, 14); }
9607     @@XMLTest:
9608     @@@QName: xp.attval.ger.entity.declared.nopref.4.test
9609     @@@DEnt:
9610     @@@@test:value:
9611     <?xml version="1.0" standalone="no"?>
9612     <!DOCTYPE p []>
9613     <p a="&entity;"/>
9614     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 7)..(3, 14); }
9615     @@XMLTest:
9616     @@@QName: xp.attval.ger.entity.declared.nopref.5.test
9617     @@@DEnt:
9618     @@@@test:value:
9619     <?xml version="1.0" standalone="yes"?>
9620     <!DOCTYPE p [
9621     <!ENTITY other "aa">
9622     <!ENTITY % another "aa">
9623     ]>
9624     <p a="&entity;"/>
9625     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 7)..(6, 14); }
9626     @@XMLTest:
9627     @@@QName: xp.attval.ger.entity.declared.nopref.6.test
9628     @@@DEnt:
9629     @@@@test:value:
9630     <?xml version="1.0" standalone="no"?>
9631     <!DOCTYPE p [
9632     <!ENTITY other "aa">
9633     <!ENTITY % another "aa">
9634     ]>
9635     <p a="&entity;"/>
9636     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 7)..(6, 14); }
9637     @@XMLTest:
9638     @@@QName: xp.attval.ger.entity.declared.nopref.-1.test
9639     @@@DEnt:
9640     @@@@test:value:
9641     <!DOCTYPE p [
9642     <!ENTITY entity "value">
9643     ]>
9644     <p a="&entity;"/>
9645     @@@test:domTree:
9646     document {
9647     document-type {
9648     general-entity {
9649     node-name: 'entity';
9650     text-content: 'value';
9651     }
9652     }
9653     element {
9654     attribute {
9655     node-name: 'a';
9656     general-entity-reference {
9657     node-name: 'entity';
9658     is-expanded: true;
9659     text-content: 'value';
9660     }
9661     }
9662     }
9663     }
9664     @@XMLTest:
9665     @@@QName: xp.attval.ger.entity.declared.nopref.-2.test
9666     @@@DEnt:
9667     @@@@test:value:
9668     <!DOCTYPE p [
9669     <!ENTITY entity "value">
9670     <!ENTITY another SYSTEM "another">
9671     ]>
9672     <p a="&entity;"/>
9673     @@@test:domTree:
9674     document {
9675     document-type {
9676     general-entity {
9677     node-name: 'entity';
9678     text-content: 'value';
9679     has-replacement-tree: true;
9680     }
9681     general-entity {
9682     node-name: 'another';
9683     public-id: null;
9684     system-id: 'another';
9685     has-replacement-tree: false;
9686     }
9687     }
9688     element {
9689     attribute {
9690     node-name: 'a';
9691     general-entity-reference {
9692     node-name: 'entity';
9693     is-expanded: true;
9694     text-content: 'value';
9695     }
9696     }
9697     }
9698     }
9699     @@XMLTest:
9700     @@@QName: xp.attval.ger.entity.declared.standalone.1.test
9701     @@@DEnt:
9702     @@@@test:value:
9703     <?xml version="1.0" standalone="yes"?>
9704     <p a="&entity;"/>
9705     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 7)..(2, 14); }
9706     @@XMLTest:
9707     @@@QName: xp.attval.ger.entity.declared.standalone.2.test
9708     @@@DEnt:
9709     @@@@test:value:
9710     <?xml version="1.0" standalone="yes"?>
9711     <!DOCTYPE p []>
9712     <p a="&entity;"/>
9713     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 7)..(3, 14); }
9714     @@XMLTest:
9715     @@@QName: xp.attval.ger.entity.declared.standalone.3.test
9716     @@@DEnt:
9717     @@@@test:value:
9718     <?xml version="1.0" standalone="yes"?>
9719     <!DOCTYPE p [
9720     <!ENTITY % para "<!-- -->">
9721     %para;
9722     ]>
9723     <p a="&entity;"/>
9724     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 7)..(6, 14); }
9725     @@XMLTest:
9726     @@@QName: xp.attval.ger.entity.declared.standalone.-1.test
9727     @@@DEnt:
9728     @@@@test:value:
9729     <?xml version="1.0" standalone="no"?>
9730     <!DOCTYPE p [
9731     <!ENTITY % para "<!-- -->">
9732     %para;
9733     ]>
9734     <p a="&entity;"/>
9735     @@@test:domTree:
9736     document {
9737     document-type { }
9738     element {
9739     attribute {
9740     node-name: 'a';
9741     general-entity-reference {
9742     is-expanded: false;
9743     }
9744     }
9745     }
9746     }
9747     @@XMLTest:
9748     @@@QName: xp.attval.ger.entity.declared.standalone.-2.test
9749     @@@DEnt:
9750     @@@@test:value:
9751     <!DOCTYPE p [
9752     <!ENTITY % para "<!-- -->">
9753     %para;
9754     ]>
9755     <p a="&entity;"/>
9756     @@@test:domTree:
9757     document {
9758     document-type { }
9759     element {
9760     attribute {
9761     node-name: 'a';
9762     general-entity-reference {
9763     is-expanded: false;
9764     }
9765     }
9766     }
9767     }
9768     @@XMLTest:
9769     @@@QName: xp.attval.ger.entity.declared.standalone.4.test
9770     @@@DEnt:
9771     @@@@test:value:
9772     <?xml version="1.0" standalone="yes"?>
9773     <!DOCTYPE p [
9774     <!ENTITY % para SYSTEM "para">
9775     %para;
9776     ]>
9777     <p a="&entity;"/>
9778     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 7)..(6, 14); }
9779     @@XMLTest:
9780     @@@QName: xp.attval.ger.entity.declared.standalone.-3.test
9781     @@@DEnt:
9782     @@@@test:value:
9783     <?xml version="1.0" standalone="no"?>
9784     <!DOCTYPE p [
9785     <!ENTITY % para SYSTEM "para">
9786     %para;
9787     ]>
9788     <p a="&entity;"/>
9789     @@@test:domTree:
9790     document {
9791     document-type { }
9792     element {
9793     attribute {
9794     node-name: 'a';
9795     general-entity-reference {
9796     is-expanded: false;
9797     }
9798     }
9799     }
9800     }
9801     @@XMLTest:
9802     @@@QName: xp.attval.ger.entity.declared.standalone.-4.test
9803     @@@DEnt:
9804     @@@@test:value:
9805     <!DOCTYPE p [
9806     <!ENTITY % para SYSTEM "para">
9807     %para;
9808     ]>
9809     <p a="&entity;"/>
9810     @@@test:domTree:
9811     document {
9812     document-type { }
9813     element {
9814     attribute {
9815     node-name: 'a';
9816     general-entity-reference {
9817     is-expanded: false;
9818     }
9819     }
9820     }
9821     }
9822     @@XMLTest:
9823     @@@QName: xp.attval.ger.entity.declared.standalone.5.test
9824     @@@DEnt:
9825     @@@@test:value:
9826     <?xml version="1.0" standalone="yes"?>
9827     <!DOCTYPE p SYSTEM "dtd">
9828     <p a="&entity;"/>
9829     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 7)..(3, 14); }
9830     @@XMLTest:
9831     @@@QName: xp.attval.ger.entity.declared.standalone.-5.test
9832     @@@DEnt:
9833     @@@@test:value:
9834     <?xml version="1.0" standalone="no"?>
9835     <!DOCTYPE p SYSTEM "dtd">
9836     <p a="&entity;"/>
9837     @@@test:domTree:
9838     document {
9839     document-type { }
9840     element {
9841     attribute {
9842     node-name: 'a';
9843     general-entity-reference {
9844     is-expanded: false;
9845     }
9846     }
9847     }
9848     }
9849     @@XMLTest:
9850     @@@QName: xp.attval.ger.entity.declared.standalone.-6.test
9851     @@@DEnt:
9852     @@@@test:value:
9853     <!DOCTYPE p SYSTEM "dtd">
9854     <p a="&entity;"/>
9855     @@@test:domTree:
9856     document {
9857     document-type { }
9858     element {
9859     attribute {
9860     node-name: 'a';
9861     general-entity-reference {
9862     is-expanded: false;
9863     }
9864     }
9865     }
9866     }
9867    
9868 wakaba 1.19 @@enImplNote:
9869     {TODO:: Entity declared WFC for
9870    
9871     - General entity references in attribute value literals in
9872     attlist declarations
9873    
9874     - General entity references in replacement texts referenced
9875     in attribute value literals in tags
9876    
9877     - General entity references in replacement texts referenced
9878     in attribute value literals in attlist declarations
9879 wakaba 1.20
9880     - General entity references in entity value??
9881 wakaba 1.19
9882     }
9883    
9884 wakaba 1.5 @@PerlDef:
9885     my $impl = $Message::DOM::ImplementationRegistry->get_implementation ({
9886     'Core' => '3.0',
9887     'XML' => '3.0',
9888     'XMLVersion' => ['1.0', '1.1'],
9889     });
9890     my $parser = <Class::ManakaiXMLParser>->new ($impl);
9891    
9892     for my $test_data (@$TestData) {
9893     $test->start_new_test ($test_data->{uri});
9894     my $doc_ent = $test_data->{entity}->{$test_data->{root_uri}};
9895 wakaba 1.14 my $not_ok;
9896 wakaba 1.12
9897     $parser->dom_config->set_parameter ('error-handler' => sub ($$) {
9898     my (undef, $err) = @_;
9899     my $err_type = $err->type;
9900     if ($test_data->{dom_error}->{$err_type}) {
9901     $test->assert_error_equals
9902     (actual_value => $err,
9903 wakaba 1.15 expected_hash => shift @{$test_data->{dom_error}
9904     ->{$err_type}});
9905 wakaba 1.12 } else { # Uncatched error
9906     warn $err;
9907 wakaba 1.14 unless ($err->severity == <C::c|DOMError.SEVERITY_WARNING>) {
9908     $test->failure_comment ('Unexpected error |'.$err->type.'|');
9909     $not_ok = true;
9910     }
9911 wakaba 1.12 }
9912     return true; # continue as far as possible
9913     });
9914    
9915     if ($test_data->{dom_tree}) { # Successful test
9916     try {
9917     my $doc = $parser->parse_string ($doc_ent->{<H::test:value>});
9918     $test->assert_dom_tree_equals
9919     (actual_value => $doc,
9920     expected_hash => $test_data->{dom_tree});
9921     for (values %{$test_data->{dom_error}||{}}) {
9922     if (@$_) {
9923     $test->failure_comment
9924     (@$_.' |DOMError|s of type |'.
9925 wakaba 1.13 $_->[0]->{type}->{value}.'| are not reported');
9926 wakaba 1.14 $not_ok = true;
9927 wakaba 1.12 }
9928     }
9929 wakaba 1.14 $not_ok ? $test->not_ok : $test->ok;
9930 wakaba 1.12 } catch Message::Util::IF::DTException with {
9931     #
9932     } catch Message::DOM::IF::LSException with {
9933 wakaba 1.14 # not_ok
9934     } otherwise {
9935     my $err = shift;
9936     warn $err;
9937     $test->not_ok;
9938 wakaba 1.12 };
9939     } else {
9940     try {
9941     my $doc = $parser->parse_string ($doc_ent->{<H::test:value>});
9942     } catch Message::Util::IF::DTException with {
9943     #
9944     } catch Message::DOM::IF::LSException with {
9945     #
9946 wakaba 1.14 } otherwise {
9947     my $err = shift;
9948     warn $err;
9949     $test->not_ok;
9950 wakaba 1.12 };
9951     for (values %{$test_data->{dom_error}||{}}) {
9952     if (@$_) {
9953     $test->failure_comment
9954     (@$_.' |DOMError|s of type |'.
9955 wakaba 1.13 $_->[0]->{type}->{value}.'| are not reported');
9956 wakaba 1.14 $not_ok = true;
9957 wakaba 1.12 }
9958     }
9959 wakaba 1.14 $not_ok ? $test->not_ok : $test->ok;
9960 wakaba 1.12 }
9961 wakaba 1.5 }
9962 wakaba 1.6
9963     @ResourceDef:
9964 wakaba 1.19 @@QName: getEmptyEntityState
9965     @@rdf:type: DISPerl|InlineCode
9966     @@ForCheck: ManakaiDOM|ForClass
9967     @@PerlDef:
9968     {reptxt => \'', line => 1, column => 1, pos => 0,
9969     is_externally_declared => true}
9970    
9971     @ResourceDef:
9972 wakaba 1.6 @@QName: getCopyOfEntityState
9973     @@rdf:type: DISPerl|InlineCode
9974     @@ForCheck: ManakaiDOM|ForClass
9975     @@PerlDef:
9976     {%{$self->{$entity_type}->{$entity_name}},
9977     line => 1, column => 1, pos => 0}
9978 wakaba 1.1 ##ManakaiXMLParser
9979 wakaba 1.5
9980     ElementTypeBinding:
9981     @Name: XMLTests
9982     @ElementType:
9983     dis:ResourceDef
9984     @ShadowContent:
9985     @@ForCheck: ManakaiDOM|ForClass
9986     @@rdf:type: test|ParserTestSet
9987    
9988     ElementTypeBinding:
9989     @Name: XMLTest
9990     @ElementType:
9991     dis:ResourceDef
9992     @ShadowContent:
9993     @@ForCheck: ManakaiDOM|ForClass
9994     @@rdf:type: test|ParserTest
9995    
9996     ElementTypeBinding:
9997     @Name: DEnt
9998     @ElementType:
9999     dis:ResourceDef
10000     @ShadowContent:
10001     @@rdf:type: test|RootEntity
10002    
10003     ElementTypeBinding:
10004     @Name: Ent
10005     @ElementType:
10006     dis:ResourceDef
10007     @ShadowContent:
10008     @@rdf:type: test|Entity
10009 wakaba 1.1
10010 wakaba 1.3 ResourceDef:
10011     @QName: xp|get-location-from-token
10012     @rdf:type: DISPerl|BlockCode
10013     @enDesc:
10014     Creates a <IF::DOMCore:DOMLocator> object from a token.
10015     @PerlDef:
10016 wakaba 1.14 my $__d = $token->{type} ne '#EOF'
10017     ? $token->{location}->{char_d}
10018     : 0;
10019 wakaba 1.15 $__d -= $token->{location_d} if $token->{location_d};
10020 wakaba 1.3 $result = {
10021 wakaba 1.14 utf32_offset => $token->{location}->{pos} - $__d,
10022     line_number => $token->{location}->{line},
10023     column_number => $token->{location}->{column} - $__d,
10024 wakaba 1.3 };
10025 wakaba 1.14 $result->{utf32_offset} = 0 if $result->{utf32_offset} < 0;
10026     $result->{column_number} = 0 if $result->{column_number} < 0;
10027     ## 0 or 1, which should be?
10028 wakaba 1.3 @For: ManakaiDOM|ManakaiDOM3
10029 wakaba 1.1
10030     ElementTypeBinding:
10031     @Name: RuleDef
10032     @ElementType:
10033     dis:ResourceDef
10034     @ShadowContent:
10035     @@ForCheck: ManakaiDOM|ForClass
10036     @@rdf:type: Muf2003|RuleDefClass
10037    
10038     ElementTypeBinding:
10039     @Name: RuleParam
10040     @ElementType:
10041     dis:ResourceDef
10042     @ShadowContent:
10043     @@rdf:type: Muf2003|RuleParameter
10044    
10045     ElementTypeBinding:
10046     @Name: enImplNote
10047     @ElementType:
10048     dis:ImplNote
10049     @ShadowContent:
10050     @@lang:en
10051    
10052     ElementTypeBinding:
10053     @Name: ErrDef
10054     @ElementType:
10055     dis:ResourceDef
10056     @ShadowContent:
10057     @@rdf:type: DOMCore|DOMErrorType
10058     @@For: ManakaiDOM|DOM3
10059     @@ecore:textFormatter: ManakaiXMLParserExceptionFormatter
10060    
10061 wakaba 1.3 ElementTypeBinding:
10062     @Name: WFErrDef
10063     @ElementType:
10064     dis:ResourceDef
10065     @ShadowContent:
10066     @@rdf:type: DOMCore|DOMErrorType
10067     @@For: ManakaiDOM|DOM3
10068     @@ecore:textFormatter: ManakaiXMLParserExceptionFormatter
10069    
10070 wakaba 1.16 ElementTypeBinding:
10071     @Name: FatalErrDef
10072     @ElementType:
10073     dis:ResourceDef
10074     @ShadowContent:
10075     @@rdf:type: DOMCore|DOMErrorType
10076     @@For: ManakaiDOM|DOM3
10077     @@ecore:textFormatter: ManakaiXMLParserExceptionFormatter
10078    
10079 wakaba 1.3 WFErrDef:
10080     @QName: xp|wf-syntax-error
10081     @enDesc:
10082     The entity does not match to the production rule; it is not
10083     well-formed.
10084     @DOMCore:severity: DOMCore|SEVERITY_FATAL_ERROR
10085     @enMufDef:
10086     |%xp-error-token-type;|%xp-error-token-value
10087     (prefix => { (|}, suffix => {|)}); is not
10088     allowed%xp-error-lines (prefix => { (|}, suffix => {|)});
10089     @ecore:hasParameter:
10090     @@@: xp|error-token
10091     @@enDesc:
10092     The token that is not allowed.
10093    
10094     WFErrDef:
10095     @QName: xp|wf-pi-target-is-xml
10096     @enDesc:
10097     A processing instruction has its <CODE::PITarget> of
10098     <XML::xml> (in any case) which is not allowed.
10099     @DOMCore:severity: DOMCore|SEVERITY_ERROR
10100     @enMufDef:
10101     Processing instruction target name cannot be |%p
10102     (name => {<Q::xp|name>});|
10103     @ecore:hasParameter:
10104     @@@: xp|error-token
10105     @@enDesc:
10106     The token that contains the name.
10107     @ecore:hasParameter:
10108     @@@: xp|name
10109     @@enDesc:
10110     A string that is specified as target name of the
10111     processing instruction.
10112     @ecore:hasParameter: xp|parent
10113    
10114     WFErrDef:
10115     @QName: xp|wf-no-end-tag
10116     @DOMCore:severity: DOMCore|SEVERITY_ERROR
10117     @enDesc:
10118     An end-tag is not found.
10119     @enMufDef:
10120     End-tag |</%p (name => {<Q::xp|expected-element-type>});>| is required
10121     @ecore:hasParameter: xp|error-token
10122     @ecore:hasParameter:
10123     @@@: xp|node
10124     @@enDesc:
10125     The element node that is not closed.
10126     @ecore:hasParameter:
10127     @@@: xp|expected-element-type
10128     @@enDesc:
10129     The element type name of the element that is not closed.
10130    
10131     WFErrDef:
10132     @QName: xp|wf-unsupported-xml-version
10133     @DOMCore:severity: DOMCore|SEVERITY_ERROR
10134     @enDesc:
10135     The XML version specified in the version declaration is not supported.
10136     @enMufDef:
10137     XML version |%p (name => {<Q::infoset|version>});| is not supported
10138     @ecore:hasParameter: xp|bad-token
10139     @ecore:hasParameter:
10140     @@@: xp|parent
10141     @@enDesc:
10142     The document node.
10143     @ecore:hasParameter:
10144     @@@: infoset|version
10145     @@enDesc:
10146     The specified XML version.
10147    
10148     WFErrDef:
10149     @QName: xp|wf-malformed-enc-name
10150     @DOMCore:severity: DOMCore|SEVERITY_ERROR
10151     @enDesc:
10152     An <XA::encoding> pseudo-attribute value does not match
10153     to the procduction rule <CODE::EncName>.
10154     @enMufDef:
10155     Encoding name |%p (name => {<Q::xp|name>});| is not allowed
10156     @ecore:hasParameter: xp|error-token
10157     @ecore:hasParameter:
10158     @@@: xp|parent
10159     @@enDesc: The document node.
10160     @ecore:hasParameter:
10161     @@@: xp|name
10162     @@enDesc:
10163     The <XA::encoding> value.
10164    
10165     WFErrDef:
10166     @QName: xp|wf-malformed-xml-standalone
10167     @DOMCore:severity: DOMCore|SEVERITY_ERROR
10168     @enDesc:
10169     An <XA::standalone> pseudo-attribute value is neither <XML::yes>
10170     or <XML::no>.
10171     @enMufDef:
10172     |standalone| pseudo-attribute value |%p (name => {<Q::xp|name>});|
10173     is not allowed
10174     @ecore:hasParameter: xp|error-token
10175     @ecore:hasParameter:
10176     @@@: xp|parent
10177     @@enDesc: The document node.
10178     @ecore:hasParameter:
10179     @@@: xp|name
10180     @@enDesc:
10181     The <XA::standalone> value.
10182    
10183     WFErrDef:
10184     @QName: xp|wf-legal-literal-character
10185     @DOMCore:severity: DOMCore|SEVERITY_ERROR
10186     @enDesc:
10187     Each character in XML entity must match to the production
10188     rule <CODE::Char - RestrictedChar>.
10189     @enMufDef:
10190     Character %character-code-point
10191     (v => {<Q::xp|character-number>}); is not allowed
10192     @ecore:hasParameter:
10193     @@@: xp|character-number
10194     @@enDesc:
10195     The code position of the character being referred.
10196    
10197     WFErrDef:
10198     @QName: xp|wf-element-type-match
10199     @DOMCore:severity: DOMCore|SEVERITY_FATAL_ERROR
10200 wakaba 1.1 @enDesc:
10201 wakaba 1.3 The <CODE::Name> in an element's end-tag must match the element type
10202     in the start-tag.
10203     @enMufDef:
10204     End-tag |</%p (name => {<Q::xp|actual-element-type>});>| does
10205     not match to start-tag |<%p (name => {<Q::xp|expected-element-type>});>|
10206     @ecore:hasParameter: xp|error-token
10207     @ecore:hasParameter:
10208     @@@: xp|node
10209     @@enDesc:
10210     The current opening element node.
10211     @ecore:hasParameter:
10212     @@@: xp|expected-element-type
10213     @@enDesc:
10214     The element type name of the current element.
10215     @ecore:hasParameter:
10216     @@@: xp|actual-element-type
10217     @@enDesc:
10218     The <CODE::Name> occurs in the end-tag.
10219    
10220     WFErrDef:
10221     @QName: xp|wf-unique-att-spec
10222 wakaba 1.1 @DOMCore:severity: DOMCore|SEVERITY_ERROR
10223 wakaba 1.3 @enDesc:
10224     An attribute name <kwd:MUST-NOT> appear more than once in
10225     the same start-tag or empty-element tag.
10226 wakaba 1.1 @enMufDef:
10227 wakaba 1.3 Attribute |%p (name => {<Q::xp|name>});| is specified more
10228     than once in the same tag
10229     @ecore:hasParameter: xp|error-token
10230     @ecore:hasParameter:
10231     @@@: xp|name
10232     @@enDesc:
10233     The name of the attribute.
10234 wakaba 1.18
10235     WFErrDef:
10236     @QName: xp|wf-no-external-entity-references
10237     @c:severity: c|SEVERITY_ERROR
10238     @enDesc:
10239     Attribute values <kwd:MUST-NOT> contain direct or indirect
10240     entity references to external entities.
10241     @enMufDef:
10242     External entity |%p (name => {<Q::xp|name>});| is referenced
10243     in an attribute value literal
10244     @ecore:hasParameter: xp|error-token
10245     @ecore:hasParameter:
10246     @@@: xp|name
10247     @@enDesc:
10248     The name of the entity.
10249    
10250     WFErrDef:
10251     @QName: xp|wf-no-lt-in-attribute-values
10252     @c:severity: c|SEVERITY_ERROR
10253     @enDesc:
10254     The replacement text of any entity referred to directly or indirectly
10255     in an attribute value literal <kwd:MUST-NOT> contain a
10256     <CHAR::LESS-THAN SIGN>.
10257     @enMufDef:
10258     Entity replacement text cannot contain a
10259     |LESS-THAN SIGN| since it is referenced from an attribute
10260     value literal
10261     @ecore:hasParameter: xp|error-token
10262 wakaba 1.3
10263     WFErrDef:
10264     @QName: xp|wf-legal-character
10265     @DOMCore:severity: DOMCore|SEVERITY_ERROR
10266     @enDesc:
10267     Characters referred to using character references <kwd:MUST>
10268     match the production for <CODE::Char>.
10269     @enMufDef:
10270     Reference to character %character-code-point
10271     (v => {<Q::xp|character-number>}); is not allowed
10272     @ecore:hasParameter: xp|error-token
10273     @ecore:hasParameter:
10274     @@@: xp|character-number
10275     @@enDesc:
10276     The code position of the character being referred.
10277     @ecore:hasParameter:
10278     @@@: xp|parent
10279     @@enDesc:
10280     The parent node in which the character reference has
10281     occurred, if available.
10282 wakaba 1.19
10283     WFErrDef:
10284     @QName: xp|wf-entity-declared
10285     @c:severity: c|SEVERITY_ERROR
10286     @enDesc:
10287     {P:: In a document
10288    
10289     - without any DTD,
10290    
10291     - with only an internal DTD subset that contains no parameter
10292     entity references, or
10293    
10294     - with <XML::standalone="yes">,
10295    
10296     for an entity reference that does not occur within the external
10297     subset or a parameter entity, the <CODE::Name> given in the
10298     entity reference <kwd:MUST> match the <CODE::Name> does not
10299     occur within the external subset or a parameter entity,
10300     except that five predefined character entities need not
10301     be declared. The declaration of a general entity <kwd:MUST>
10302     precede any reference to it which appears in a default value
10303     in an attribute list declaration.
10304     @enMufDef:
10305     Entity |%p (name => {<Q::xp|name>});| must be declared
10306     in the internal subset
10307     @ecore:hasParameter: xp|error-token
10308     @ecore:hasParameter:
10309     @@@: xp|name
10310     @@enDesc:
10311     The name of the entity.
10312 wakaba 1.16
10313     FatalErrDef:
10314     @QName: xp|fatal-xml11-end-of-line-in-xml-declaration
10315     @DOMCore:severity: DOMCore|SEVERITY_ERROR
10316     @enDesc:
10317     An end-of-line character <CODE::U+0085> or <CODE::U+2028> is appeared
10318     within an XML declaration or text declaration.
10319     @enMufDef:
10320     End-of-line character %character-code-point
10321     (v => {<Q::xp|character-number>}); cannot be used within the
10322     XML or text declaration
10323     @ecore:hasParameter:
10324     @@@: xp|character-number
10325     @@enDesc:
10326     The code position of the end-of-line character.
10327 wakaba 1.1
10328 wakaba 1.3 XWParam:
10329 wakaba 1.1 @QName: xp|error-token
10330     @enDesc:
10331     The token where the parser found an error.
10332    
10333 wakaba 1.3 XWParam:
10334     @QName: xp|name
10335     @enDesc:
10336     A name.
10337    
10338     XWParam:
10339     @QName: xp|parent
10340     @enDesc:
10341     The parent node in which the error occurs.
10342    
10343     XWParam:
10344     @QName: xp|node
10345     @enDesc:
10346     The current node.
10347    
10348     XWParam:
10349     @QName: xp|actual-element-type
10350     @enDesc:
10351     The actual element type name occured in the source.
10352    
10353     XWParam:
10354     @QName: xp|expected-element-type
10355 wakaba 1.1 @enDesc:
10356 wakaba 1.3 The element type name expected.
10357    
10358     XWParam:
10359     @QName: xp|character-number
10360     @enDesc:
10361     The character code position.
10362    
10363     ElementTypeBinding:
10364     @Name: XWParam
10365     @ElementType:
10366     dis:ResourceDef
10367     @ShadowContent:
10368     @@For: =ManakaiDOM|all
10369     @@rdf:type: ecore|Parameter
10370 wakaba 1.1
10371     ElementTypeBinding:
10372     @Name:enMufDef
10373     @ElementType:
10374     ecore:defaultMessage
10375     @ShadowContent:
10376     @@lang:en
10377     @@ContentType:
10378     lang:muf
10379    
10380     ResourceDef:
10381     @QName: DOMImpl
10382     @AliasFor: DOMCore|DOMImplementation
10383     @For: ManakaiDOM|DOM
10384    
10385     ElementTypeBinding:
10386     @Name: Attr
10387     @ElementType:
10388     dis:ResourceDef
10389     @ShadowContent:
10390     @@rdf:type: DISLang|Attribute
10391     @@ForCheck: !=ManakaiDOM|ManakaiDOM
10392    
10393     ElementTypeBinding:
10394     @Name: Get
10395     @ElementType:
10396     dis:ResourceDef
10397     @ShadowContent:
10398     @@rdf:type: DISLang|AttributeGet
10399    
10400     ElementTypeBinding:
10401     @Name: Set
10402     @ElementType:
10403     dis:ResourceDef
10404     @ShadowContent:
10405     @@rdf:type: DISLang|AttributeSet
10406    
10407     ElementTypeBinding:
10408     @Name: enDesc
10409     @ElementType:
10410     dis:Description
10411     @ShadowContent:
10412     @@lang:en
10413    
10414     ElementTypeBinding:
10415     @Name: Method
10416     @ElementType:
10417     dis:ResourceDef
10418     @ShadowContent:
10419     @@rdf:type: DISLang|Method
10420     @@For: !=ManakaiDOM|ManakaiDOM
10421    
10422     ElementTypeBinding:
10423     @Name: Return
10424     @ElementType:
10425     dis:ResourceDef
10426     @ShadowContent:
10427     @@rdf:type: DISLang|MethodReturn
10428    
10429     ElementTypeBinding:
10430     @Name: Param
10431     @ElementType:
10432     dis:ResourceDef
10433     @ShadowContent:
10434     @@rdf:type: DISLang|MethodParameter
10435    
10436     ElementTypeBinding:
10437     @Name: PerlDef
10438     @ElementType:
10439     dis:Def
10440     @ShadowContent:
10441     @@ContentType: lang|Perl
10442    
10443     ElementTypeBinding:
10444     @Name: PropDef
10445     @ElementType:
10446     dis:ResourceDef
10447     @ShadowContent:
10448     @@rdf:type: rdf|Property
10449    
10450     ClsDef:
10451     @ClsQName: ManakaiXMLParserExceptionFormatter
10452    
10453     @ClsISA: ecore|MUErrorFormatter||ManakaiDOM|Perl
10454    
10455     @RuleDef:
10456     @@Name: xp-error-token-type
10457     @@enDesc:
10458     The type of the token the parser is encountered.
10459    
10460     @@Method:
10461     @@@Name: after
10462     @@@Param:
10463     @@@@Name: name
10464     @@@@Type: DOMString
10465     @@@@enDesc: The name of the method.
10466     @@@Param:
10467     @@@@Name: p
10468     @@@@Type: DISPerl|HASH
10469     @@@@enDesc: The set of the parameters to the method.
10470     @@@Param:
10471     @@@@Name: o
10472     @@@@Type: DISPerl|HASH
10473     @@@@enDesc: The option value.
10474     @@@Return:
10475     @@@@PerlDef:
10476     $p->{-result} = $o->{<H::xp|error-token>}->{type}
10477     if defined $o->{<H::xp|error-token>}->{type};
10478    
10479     @RuleDef:
10480     @@Name: xp-error-token-value
10481     @@enDesc:
10482     The value of the token the parser is encountered, if any.
10483    
10484     @@Method:
10485     @@@Name: after
10486     @@@Param:
10487     @@@@Name: name
10488     @@@@Type: DOMString
10489     @@@@enDesc: The name of the method.
10490     @@@Param:
10491     @@@@Name: p
10492     @@@@Type: DISPerl|HASH
10493     @@@@enDesc: The set of the parameters to the method.
10494     @@@Param:
10495     @@@@Name: o
10496     @@@@Type: DISPerl|HASH
10497     @@@@enDesc: The option value.
10498     @@@Return:
10499     @@@@PerlDef:
10500     $p->{-result} = $o->{<H::xp|error-token>}->{value}
10501     if defined $o->{<H::xp|error-token>}->{value};
10502    
10503     @RuleDef:
10504     @@Name: xp-error-lines
10505     @@enDesc:
10506     A copy of fragment of the source text that contains the line
10507     where the error occurred, if available.
10508    
10509     @@Method:
10510     @@@Name: after
10511     @@@Param:
10512     @@@@Name: name
10513     @@@@Type: DOMString
10514     @@@@enDesc: The name of the method.
10515     @@@Param:
10516     @@@@Name: p
10517     @@@@Type: DISPerl|HASH
10518     @@@@enDesc: The set of the parameters to the method.
10519     @@@Param:
10520     @@@@Name: o
10521     @@@@Type: DISPerl|HASH
10522     @@@@enDesc: The option value.
10523     @@@Return:
10524     @@@@PerlDef:
10525     my $pos = $o-><AG::DOMCore|DOMError.location>
10526     -><AG::DOMCore|DOMLocator.utf32Offset>;
10527     if ($pos > -1) {
10528 wakaba 1.6 my $src = $o->{<H::ecore|object>}->{entity}->[-1]->{reptxt};
10529 wakaba 1.1 my $start = $pos;
10530     $start = rindex ($$src, "\x0A", $start - 1) for 0..2;
10531     $start++;
10532     my $end = $pos;
10533     $end = index ($$src, "\x0A", $end + 1) for 0..2;
10534     $end = length $$src if $end < 0;
10535     $p->{-result} = substr $$src, $start, $end - $start;
10536     }
10537 wakaba 1.3
10538     @RuleDef:
10539     @@Name: character-code-point
10540     @@enDesc:
10541     The character code position, in <CODE::U+<VAR::HHHH>> notation.
10542    
10543     @@Method:
10544     @@@Name: after
10545     @@@Param:
10546     @@@@Name: name
10547     @@@@Type: DOMString
10548     @@@@enDesc: The name of the method.
10549     @@@Param:
10550     @@@@Name: p
10551     @@@@Type: DISPerl|HASH
10552     @@@@enDesc: The set of the parameters to the method.
10553     @@@Param:
10554     @@@@Name: o
10555     @@@@Type: DISPerl|HASH
10556     @@@@enDesc: The option value.
10557     @@@RuleParam:
10558     @@@@Name: v
10559     @@@@Type: DISPerl|Number
10560     @@@@enDesc:
10561     The name of the error parameter that contains the character code.
10562     @@@Return:
10563     @@@@PerlDef:
10564     $p->{-result} = sprintf 'U+%04X', $o->{$p->{v}};
10565 wakaba 1.1 ##XMLParserExceptionFormatter

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24