/[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.21 - (hide annotations) (download)
Mon Feb 13 08:33:54 2006 UTC (18 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.20: +572 -13 lines
++ manakai/lib/Message/DOM/ChangeLog	13 Feb 2006 08:33:39 -0000
2006-02-13  Wakaba  <wakaba@suika.fam.cx>

	* XMLParser.dis: Set |cfg:clone-entity-reference-subtree|
	configuration parameter |true| during tree construction
	to ensure default attribute value is cloned as is
	including entity reference subtree.

	* Tree.dis (cfg:clone-entity-reference-subtree): New configuration
	parameter.
	(Node.cloneNode): The |cfg:clone-entity-reference-subtree|
	configuration parameter support is added.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24