/[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.19 - (hide annotations) (download)
Sat Feb 11 13:41:48 2006 UTC (18 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.18: +456 -10 lines
++ manakai/lib/Message/DOM/ChangeLog	11 Feb 2006 13:25:03 -0000
	* XMLParser.dis: |xp:wf-entity-declared| well-formedness
	constaraint for entity references that appear in
	content of elements is implemented.   Set |EntityReference.isExpanded|
	attribute.
	(getEmptyEntityState): New code.

	* XDoctype.dis (DocumentTypeDefinition.nodeType): Duplicate
	definition is removed.

	* DOMXML.dis (Entity.isExternallyDeclared): New attribute.
	(EntityReference.isExpanded): Setter is added.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24