/[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.18 - (hide annotations) (download)
Sat Feb 11 07:57:23 2006 UTC (18 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.17: +1927 -625 lines
++ manakai/lib/Message/DOM/ChangeLog	11 Feb 2006 07:53:06 -0000
	* XMLParser.dis: |xp:wf-no-lt-in-attribute-values|
	and |xp:wf-no-external-entity-references| well-formedness
	constraints are implemented.

2006-02-11  Wakaba  <wakaba@suika.fam.cx>

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24