/[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.46 - (hide annotations) (download)
Sat Dec 30 08:27:48 2006 UTC (17 years, 11 months ago) by wakaba
Branch: MAIN
Changes since 1.45: +1 -44 lines
++ manakai/bin/ChangeLog	30 Dec 2006 06:47:17 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* idl2dis.pl: Removed.

++ manakai/lib/Message/Markup/ChangeLog	30 Dec 2006 08:26:03 -0000
	* Atom.dis, SuikaWiki.dis, H2H.dis: |WithFor|
	and |DefaultFor| properties are removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Util/ChangeLog	30 Dec 2006 08:26:59 -0000
	* PerlCode.dis: |WithFor| and |DefaultFor| are removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/DOM/ChangeLog	30 Dec 2006 08:25:38 -0000
        GenericLS.dis, TreeCore.dis, DOMString.dis,
        XML.dis, Element.dis, Document.dis, TreeStore,dis,
        Traversal.dis, XDoctype.dis, XMLParser.dis, DOMLS.dis,
        SimpleLS.dis, DOMMain.dis, XDP.dis: |WithFor| specifications
	and |DefaultFor|s are removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* CharacterData.dis, DOMCore.dis, DOMFeature.dis,
++ manakai/lib/Message/URI/ChangeLog	30 Dec 2006 08:26:32 -0000
	* Generic.dis: |WithFor| and |DefaultFor| are removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Charset/ChangeLog	30 Dec 2006 08:24:04 -0000
	* Encode.dis (Require): |WithFor| specifications are removed.
	(DefaultFor): Removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/manakai/ChangeLog	30 Dec 2006 07:46:56 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* dis.pl: Removed.

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.46 $Date: 2006/12/30 04:42:54 $
14 wakaba 1.1
15     @Require:
16     @@Module:
17     @@@QName: MDOM|DOMLS
18 wakaba 1.6 @@Module:
19 wakaba 1.35 @@@QName: MDOM|XML
20     @@Module:
21 wakaba 1.6 @@@QName: MDOM|XDoctype
22 wakaba 1.37 @@Module:
23     @@@QName: MCharset|Encode
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.37 @cs:
31     http://suika.fam.cx/~wakaba/archive/2004/dis/Charset/
32 wakaba 1.6 @d:
33     http://suika.fam.cx/~wakaba/archive/2004/dom/xdt#
34 wakaba 1.1 @dis:
35     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
36 wakaba 1.5 @dtest:
37     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#Test/
38 wakaba 1.1 @dx:
39     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#
40     @ecore:
41     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/Core/
42     @f:
43     http://suika.fam.cx/~wakaba/archive/2004/dom/feature#
44 wakaba 1.11 @fe:
45     http://suika.fam.cx/www/2006/feature/
46     @gls:
47     http://suika.fam.cx/~wakaba/archive/2004/dom/gls#
48 wakaba 1.1 @idl:
49     http://suika.fam.cx/~wakaba/archive/2004/dis/IDL#
50     @infoset:
51     http://www.w3.org/2001/04/infoset#
52     @lang:
53     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
54     @license:
55     http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
56     @LSEV:
57     http://www.w3.org/2002/DOMLS
58     @ManakaiDOM:
59     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
60     @ManakaiDOMLS:
61     http://suika.fam.cx/~wakaba/archive/2004/mdom-ls#
62 wakaba 1.37 @MCharset:
63     http://suika.fam.cx/~wakaba/archive/2005/manakai/Charset/
64     @mce:
65     http://suika.fam.cx/~wakaba/archive/2005/manakai/Charset/Encode/
66 wakaba 1.1 @MDOM:
67     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.
68     @MDOMX:
69     http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#
70     @rdf:
71     http://www.w3.org/1999/02/22-rdf-syntax-ns#
72     @rdfs:
73     http://www.w3.org/2000/01/rdf-schema#
74     @t:
75     http://suika.fam.cx/~wakaba/archive/2004/dom/tree#
76 wakaba 1.35 @tc:
77     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/
78     @td:
79     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/Document/
80     @te:
81     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/Element/
82 wakaba 1.5 @test:
83     http://suika.fam.cx/~wakaba/archive/2004/dis/Test#
84 wakaba 1.35 @tx:
85     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/XML/
86 wakaba 1.29 @urigen:
87     http://suika.fam.cx/~wakaba/archive/2005/manakai/URI/Generic/
88 wakaba 1.8 @x:
89     http://suika.fam.cx/~wakaba/archive/2004/dom/xml#
90 wakaba 1.1 @xml:
91     http://www.w3.org/XML/1998/namespace
92 wakaba 1.37 @xml-auto-charset:
93     http://suika.fam.cx/www/2006/03/xml-entity/
94 wakaba 1.9 @xml-dtd:
95     http://www.w3.org/TR/REC-xml
96 wakaba 1.1 @xmlns:
97     http://www.w3.org/2000/xmlns/
98     @xp:
99     http://suika.fam.cx/~wakaba/archive/2004/dom/xml-parser#
100    
101     ## -- Features
102    
103     ElementTypeBinding:
104     @Name: FeatureDef
105     @ElementType:
106     dis:ResourceDef
107     @ShadowContent:
108     @@rdf:type: f|Feature
109     @@For: =ManakaiDOM|all
110    
111     ElementTypeBinding:
112     @Name: FeatureVerDef
113     @ElementType:
114     dis:ResourceDef
115     @ShadowContent:
116     @@rdf:type: f|Feature
117    
118     ElementTypeBinding:
119     @Name: featureQName
120     @ElementType:
121     f:name
122     @ShadowContent:
123     @@ContentType: DISCore|QName
124    
125     ResourceDef:
126     @QName: DOMString
127     @AliasFor: DOMMain|DOMString
128    
129     ResourceDef:
130     @QName: Node
131 wakaba 1.35 @AliasFor: tc|Node
132 wakaba 1.1
133     ResourceDef:
134     @QName: Element
135 wakaba 1.35 @AliasFor: te|Element
136    
137     ResourceDef:
138     @QName: Attr
139     @AliasFor: te|Attr
140 wakaba 1.1
141     ResourceDef:
142     @QName: Document
143 wakaba 1.35 @AliasFor: td|Document
144 wakaba 1.1
145 wakaba 1.6 ResourceDef:
146     @QName: DocumentXDoctype
147     @AliasFor: d|DocumentXDoctype
148    
149 wakaba 1.8 ResourceDef:
150     @QName: DTDef
151     @AliasFor: d|DocumentTypeDefinition
152    
153     ResourceDef:
154     @QName: ETDef
155     @AliasFor: d|ElementTypeDefinition
156    
157     ResourceDef:
158     @QName: ATDef
159     @AliasFor: d|AttributeDefinition
160    
161 wakaba 1.35 ResourceDef:
162     @QName: GE
163     @AliasFor: tx|Entity
164    
165     ResourceDef:
166     @QName: GERef
167     @AliasFor: tx|EntityReference
168    
169 wakaba 1.1 ElementTypeBinding:
170     @Name: ClsDef
171     @ElementType:
172     dis:ResourceDef
173     @ShadowContent:
174     @@rdf:type:
175     @@@@: dis|MultipleResource
176     @@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
177     @@resourceFor:
178     @@@@: ManakaiDOM|ForClass
179    
180     @@rdf:type:
181     @@@@: DISLang|Class
182     @@@ForCheck: ManakaiDOM|ForClass
183    
184     ElementTypeBinding:
185     @Name: ClsQName
186     @ElementType:
187     dis:QName
188     @ShadowContent:
189     @@ForCheck: ManakaiDOM|ForClass
190    
191     ElementTypeBinding:
192     @Name: ClsISA
193     @ElementType:
194     dis:ISA
195     @ShadowContent:
196     @@ForCheck: ManakaiDOM|ForClass
197    
198     ElementTypeBinding:
199     @Name: nullCase
200     @ElementType:
201     dis:ResourceDef
202     @ShadowContent:
203     @@rdf:type: ManakaiDOM|InCase
204     @@Value:
205     @@@is-null:1
206    
207 wakaba 1.27 ElementTypeBinding:
208     @Name: TrueCase
209     @ElementType:
210     dis:ResourceDef
211     @ShadowContent:
212     @@rdf:type:
213     ManakaiDOM:InCase
214     @@Value:
215     @@@@: 1
216     @@@ContentType: DISCore|Boolean
217     @@Type: idl|boolean||ManakaiDOM|all
218    
219     ElementTypeBinding:
220     @Name: FalseCase
221     @ElementType:
222     dis:ResourceDef
223     @ShadowContent:
224     @@rdf:type:
225     ManakaiDOM:InCase
226     @@Value:
227     @@@@: 0
228     @@@ContentType: DISCore|Boolean
229     @@Type: idl|boolean||ManakaiDOM|all
230    
231 wakaba 1.1 ResourceDef:
232     @QName: LSParser
233     @AliasFor: DOMLS|LSParser
234    
235     ClsDef:
236     @ClsQName: ManakaiXMLParser
237    
238     @Implement: DOMLS|LSParser
239    
240 wakaba 1.28 @f:implements: DOMLS|LSFeature30
241     @f:implements: DOMLS|ParseString10
242     @enImplNote:
243     @@ddid: dtdfeature
244     @@@:
245     {TODO::
246     Once DTD validation is implemented, add <Q::f:implements>
247     for XML-DTD-feature.
248     }
249 wakaba 1.1
250 wakaba 1.11 @DISLang:role: gls|ParserRole
251 wakaba 1.1
252 wakaba 1.3 @enDesc:
253     Note that the <Class::ManakaiXMLParser> reports any XML errors
254     (syntax errors and / or well-formedness constraint errors)
255     via the <IF::DOMCore:error-handler> registered to
256     the <A::DOMLS:LSParser.domConfig> object. Each error has
257     its <A::DOMCore:DOMError.severity>, either <C::DOMCore:SEVERITY_ERROR>
258     or <C::DOMCore:SEVERITY_FATAL_ERROR>. However, their semantics
259     are slight different from the ones of <QUOTE::error> and
260     <QUOTE::fatal error> in XML; in this implemenetation,
261     <C::DOMCore:SEVERITY_ERROR> implies that the parsing process
262     can effectively be continued to detect more errors while
263     <C::DOMCore:SEVERITY_FATAL_ERROR> implies that the error
264     is serious so that the result document tree and any errors
265     might be far from the ones obtained when the error would not
266     be found.
267 wakaba 1.28
268     @Test:
269     @@QName: GLSImpl.createGLSParser.LS.test
270     @@enDesc:
271     Since there is at least one implementation of the feature (i.e.
272     this class), the <M::gls|GLSImplementation.createGLSParser>
273     must not throw an exception.
274     @@PerlDef:
275     my $impl;
276     __CODE{DOMLS|createImplForTest:: $impl => $impl}__;
277    
278     my $p = $impl-><M::gls|GLSImplementation.createGLSParser>
279     ({LS => '3.0'});
280    
281     $test->assert_isa ($p, <IFName::LSParser>);
282     @Test:
283     @@QName: GLSImpl.createGLSParser.ParseXMLString.test
284     @@enDesc:
285     Since there is at least one implementation of the feature (i.e.
286     this class), the <M::gls|GLSImplementation.createGLSParser>
287     must not throw an exception.
288     @@PerlDef:
289     my $impl;
290     __CODE{DOMLS|createImplForTest:: $impl => $impl}__;
291    
292     my $p = $impl-><M::gls|GLSImplementation.createGLSParser>
293     ({<Q::fe|ParseXMLString> => '1.0'});
294    
295     $test->assert_not_null ($p);
296     @Test:
297     @@QName: GLSImpl.createGLSParser.LS.ParseXMLString.test
298     @@enDesc:
299     Since there is at least one implementation of the feature (i.e.
300     this class), the <M::gls|GLSImplementation.createGLSParser>
301     must not throw an exception.
302     @@PerlDef:
303     my $impl;
304     __CODE{DOMLS|createImplForTest:: $impl => $impl}__;
305    
306     my $p = $impl-><M::gls|GLSImplementation.createGLSParser>
307     ({LS => '3.0', <Q::fe|ParseXMLString> => '1.0'});
308    
309     $test->assert_isa ($p, <IFName::LSParser>);
310    
311     @Test:
312     @@QName: DOMImplLS.createLSParser.1.test
313     @@enDesc:
314     Since there is at least one implementation of the feature (i.e.
315     this class), the <M::gls|GLSImplementation.createGLSParser>
316     must not throw an exception.
317     @@PerlDef:
318     my $impl;
319     __CODE{DOMLS|createImplForTest:: $impl => $impl}__;
320    
321     my $p = $impl-><M::DOMLS|DOMImplementationLS.createLSParser>
322     (<C::DOMLS|DOMImplementationLS.MODE_SYNCHRONOUS>);
323     $test->assert_isa ($p, <IFName::LSParser>);
324     @enImplNote:
325     @@ddid: lsparsertext
326     @@@:
327     Future version should add test:
328     @@QName: DOMImplLS.createLSParser.2.test
329     @@enDesc:
330     Since there is at least one implementation of the feature (i.e.
331     this class), the <M::gls|GLSImplementation.createGLSParser>
332     must not throw an exception.
333     @@PerlDef:
334     my $impl;
335     __CODE{DOMLS|createImplForTest:: $impl => $impl}__;
336    
337     my $p = $impl-><M::DOMLS|DOMImplementationLS.createLSParser>
338     (<C::DOMLS|DOMImplementationLS.MODE_SYNCHRONOUS>,
339     <Q::xml-dtd:>);
340     $test->assert_isa ($p, <IFName::LSParser>);
341 wakaba 1.3
342 wakaba 1.27 @Test:
343     @@QName: Perl.open.utf8.strref.1.test
344     @@enDesc:
345     Does PerlIO works as intended?
346     @@PerlDef:
347     my $s = qq<\x{3001}\x0A\x{10001}>;
348     #open my $a, '<'.':utf8', \$s;
349     require IO::String;
350     my $a = IO::String->new ($s);
351     $test->assert_num_equals
352     (actual_value => ord getc $a,
353     expected_value => 0x3001);
354     $test->assert_num_equals
355     (actual_value => ord getc $a,
356     expected_value => 0x000A);
357     $test->assert_num_equals
358     (actual_value => ord getc $a,
359     expected_value => 0x10001);
360     $a->ungetc (0x10001);
361     $test->assert_num_equals
362     (actual_value => ord getc $a,
363     expected_value => 0x10001);
364     $test->assert_null (getc $a);
365     close $a;
366     @Test:
367     @@QName: Perl.open.8859.strref.2.test
368     @@enDesc:
369     Does PerlIO works as intended?
370     @@PerlDef:
371     my $s = qq<\x{0080}\x0A\x{00A9}>;
372     #open my $a, '<', \$s;
373     require IO::String;
374     my $a = IO::String->new ($s);
375     $test->assert_num_equals
376     (actual_value => ord getc $a,
377     expected_value => 0x0080);
378     $test->assert_num_equals
379     (actual_value => ord getc $a,
380     expected_value => 0x000A);
381     $test->assert_num_equals
382     (actual_value => ord getc $a,
383     expected_value => 0x00A9);
384     $a->ungetc (0x00A9);
385     $test->assert_num_equals
386     (actual_value => ord getc $a,
387     expected_value => 0x00A9);
388     $test->assert_null (getc $a);
389     close $a;
390    
391 wakaba 1.1 @Attr:
392     @@Name: domConfig
393     @@enDesc:
394     The configuration of the parser.
395    
396     @@Get:
397     @@@Type: DOMCore|DOMConfiguration
398     @@@enDesc: The DOM configuration object.
399     @@@PerlDef:
400     __CODE{DOMCore|getConfigObject::
401     $target => $self,
402     $targetHash => $self,
403 wakaba 1.27 $targetType => {<ClassName::xp|ManakaiXMLParser>},
404 wakaba 1.1 $result => $r,
405     }__;
406    
407 wakaba 1.27 @Attr:
408     @@ForCheck: ManakaiDOM|ForClass
409     @@Name: async
410     @@enDesc:
411     Whether the parser is asynchronous or not.
412     @@Type: idl|boolean||ManakaiDOM|all
413     @@Get:
414     @@@FalseCase:
415     @@@@enDesc:
416     The parser does not in asynchronous mode.
417     @@@PerlDef: \
418     @@Test:
419     @@@QName: XMLParser.async.test
420     @@@PerlDef:
421     my $xp;
422     __CODE{createParserForTest:: $xp => $xp}__;
423    
424     $test->assert_false ($xp-><AG::DOMLS|LSParser.async>);
425    
426     @Attr:
427     @@ForCheck: ManakaiDOM|ForClass
428     @@Name: busy
429     @@enDesc:
430     Whether the parser is currently busy loading a document or not.
431     @@Type: idl|boolean||ManakaiDOM|all
432     @@Get:
433     @@@TrueCase:
434     @@@@enDesc:
435     The parser is currently busy.
436     @@@FalseCase:
437     @@@@enDesc:
438     The parser is not busy.
439     @@@PerlDef:
440     $r = $self->{<H::DOMLS|busy>};
441    
442     @enImplNote:
443     @@ddid: abort
444     @@@:
445     {ISSUE::
446     LSParser.abort:
447    
448     Is it required to support even in synchronous mode?
449     }
450    
451     {TODO::
452     LSParser.filter
453     }
454    
455     @ResourceDef:
456     @@QName: createParserForTest
457     @@ForCheck: ManakaiDOM|ForClass
458     @@rdf:type: DISPerl|BlockCode
459     @@PerlDef:
460     require Message::DOM::GenericLS;
461     $xp = <Class::ManakaiXMLParser>
462 wakaba 1.40 ->new (<Class::c|ManakaiDOMImplementation>->_new, '');
463 wakaba 1.27
464 wakaba 1.1 @Method:
465     @@ManakaiDOM:isForInternal:1
466     @@ForCheck: ManakaiDOM|ForClass
467     @@Operator: DISPerl|NewMethod
468     @@enDesc:
469     Creates a new instance of the object.
470     @@Param:
471     @@@Name: impl
472 wakaba 1.11 @@@Type: gls|GLSImplementation
473 wakaba 1.1 @@@enDesc:
474     The implementation from which the parser is created.
475     @@Param:
476     @@@Name: features
477     @@@Type: DOMString
478     @@@dis:actualType: f|FeaturesString
479     @@@enDesc:
480     The set of features requested for the parser.
481     @@Return:
482     @@@Type: DOMMain|DOMObject
483     @@@dis:actualType: LSParser
484     @@@enDesc:
485     The newly created parser.
486     @@@PerlDef:
487     $r = bless {
488 wakaba 1.35 <H::f|implementation> => $impl,
489 wakaba 1.1 }, $self;
490    
491     @Method:
492 wakaba 1.27 @@Name: parseURI
493     @@enDesc:
494     Parses an XML document identified by a DOM URI.
495 wakaba 1.1
496 wakaba 1.27 It is equivalent to <M::.parse> method with its <P::input>
497     parameter set to a <IF::LSInput> object whose
498     <A::LSInput.systemId> set to <P::uri>.
499 wakaba 1.1 @@Param:
500 wakaba 1.27 @@@Name: uri
501 wakaba 1.1 @@@Type: DOMString
502 wakaba 1.27 @@@enDesc:
503     The DOM URI of the XML document to be read.
504 wakaba 1.1 @@Return:
505     @@@Type: Document
506 wakaba 1.27 @@@enDesc:
507     The newly created and populated <IF::Document> node.
508     @@@dx:raises:
509     @@@@@: ManakaiDOMLS|MDOMLS_BUSY
510     @@@@enDesc:
511     If <A::LSParser.busy> is <DOM::true>.
512     @@@dx:raises:
513     @@@@@: DOMLS|PARSE_ERR
514     @@@@enDesc:
515     If the <IF::LSParser> was unable to load the document.
516     @@@PerlDef:
517     __DEEP{
518     $r = $self-><M::LSParser.parse> ({system_id => $uri});
519     }__;
520    
521     @Method:
522     @@Name: parse
523     @@enDesc:
524     Parses an XML document from a resource identified
525     by a <IF::LSInput>.
526     @@Param:
527     @@@Name: input
528     @@@Type: LSInput
529     @@@enDesc:
530     The <IF::LSInput> from which the source of the document
531     is to be read.
532     @@Return:
533     @@@Type: Document
534     @@@enDesc:
535     The newly created and populated <IF::Document> node.
536     @@@dx:raises:
537     @@@@@: ManakaiDOMLS|MDOMLS_BUSY
538     @@@@enDesc:
539     If the <A::LSParser.busy> is <DOM::true>.
540     @@@dx:raises:
541     @@@@@: DOMLS|PARSE_ERR
542     @@@@enDesc:
543     If the <IF::LSParser> was unable to load the document.
544 wakaba 1.1 @@@PerlDef:
545 wakaba 1.27 if ($self->{<H::DOMLS|busy>}) {
546     __EXCEPTION{ManakaiDOMLS|MDOMLS_BUSY}__;
547     }
548     local $self->{<H::DOMLS|busy>} = true;
549    
550     my $in;
551     __DEEP{
552     $self->{parser_cfg} = $self-><AG::LSParser.domConfig>;
553     ## Parser's |domConfig| object.
554     $self->{in_in} = $self->{parser_cfg}
555     -><M::c|DOMConfiguration.getParameter>
556     (<Q::xp|ls-input-to-input-file>);
557     $in = $self->{in_in}-><M::ManakaiDOMLSInputToInputFile.resolveLSInput>
558 wakaba 1.37 ($self->{<H::f|implementation>}, $input,
559     $self,
560 wakaba 1.27 $self->{parser_cfg}
561     -><M::c|DOMConfiguration.getParameter>
562     ('error-handler'));
563     }__;
564     unless (defined $in) {
565     __c|ERROR{DOMLS|no-input-specified::
566     MDOMX:param-name => 'input',
567     }__;
568     __CODE{ParseError}__;
569     }
570    
571     require IO::Handle;
572 wakaba 1.1
573     $self->{char} = [];
574     $self->{token} = [];
575 wakaba 1.6 $self->{entity} = [{
576 wakaba 1.27 fh => $in-><AG::ManakaiDOMInputFile.filehandle>,
577     base_uri => $in-><AG::ManakaiDOMInputFile.baseURI>,
578     doc_uri => $in-><AG::ManakaiDOMInputFile.documentURI>,
579 wakaba 1.37 in_enc => $in-><AG::ManakaiDOMInputFile.inputEncoding>,
580 wakaba 1.6 line => 1,
581     column => 1,
582     pos => 0,
583 wakaba 1.27 close_file => sub { $in-><M::ManakaiDOMInputFile.close> },
584     reptxt => \'',
585     is_external_entity => true,
586 wakaba 1.6 }];
587 wakaba 1.27 ## Entity stack.
588 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
589 wakaba 1.27 ## Parsing location object as required by DPG.
590     ## It must always be equal to |{entity}->[-1]|.
591 wakaba 1.6 $self->{entity_char} = [];
592 wakaba 1.27 ## Stack for |{char}| stacks analog to |{entity}| stack.
593 wakaba 1.6 $self->{entity_token} = [];
594 wakaba 1.27 ## Stack for |{token}| stacks analog to |{entity}| stack.
595 wakaba 1.3 $self->{xml_version} = '1.0';
596 wakaba 1.27 ## Document XML version: either |1.0| or |1.1|.
597 wakaba 1.3 $self->{standalone} = false;
598 wakaba 1.27 ## True iff |standalone=yes| is explicitly specified.
599 wakaba 1.19 $self->{has_xref} = false;
600 wakaba 1.27 ## There is an unread external entity.
601     $self->{dont_process} = false;
602     ## So, don't process |ENTITY| and |ATTLIST| declarations.
603 wakaba 1.11 $self->{general_entity} = {
604     lt => {is_predefined => true},
605     gt => {is_predefined => true},
606     amp => {is_predefined => true},
607     quot => {is_predefined => true},
608     apos => {is_predefined => true},
609     };
610 wakaba 1.27 ## Declared general entities.
611 wakaba 1.6 $self->{param_entity} = {};
612 wakaba 1.27 ## Declared parameter entities.
613 wakaba 1.9 $self->{attr} = {};
614     # $self->{attr}->{$element_type_name}->{$attr_name} = $attr_def
615 wakaba 1.27 ## Declared attributes.
616 wakaba 1.1
617     __DEEP{
618 wakaba 1.35 $r = $self->{<H::f|implementation>}-><M::DOMImpl.createDocument>;
619 wakaba 1.11 $self->{doc} = $r;
620 wakaba 1.27 ## |Document| object.
621     CORE::delete $self->{docx};
622     ## |DocumentXDoctype| object (if necessary).
623 wakaba 1.21 $self->{doc_cfg} = $r-><AG::Document.domConfig>;
624 wakaba 1.27 ## |Document|'s configuration.
625 wakaba 1.11 CORE::delete $self->{dtdef};
626 wakaba 1.27 ## |DocumentTypeDefinition| object (if created).
627 wakaba 1.17 CORE::delete $self->{dtdecl};
628 wakaba 1.27 ## |DocumentTypeDeclaration| object (if created).
629 wakaba 1.21
630     $r-><AS::Document.strictErrorChecking> (false);
631     ## NOTE: Any checks such as |Name| validity done by
632     ## methods on DOM nodes are disabled. It might result
633     ## in creating an ill-formed DOM tree when parser
634     ## errors are traped by |error-handler|.
635     $self->{doc_cfg}-><M::c|DOMConfiguration.setParameter>
636     (<Q::cfg|clone-entity-reference-subtree> => true);
637     ## NOTE: Turn this configuration parameter on makes
638     ## entity reference subtrees in attribute default values
639     ## cloned as is into default attribute node subtrees.
640 wakaba 1.26 $self->{doc_cfg}-><M::c|DOMConfiguration.setParameter>
641 wakaba 1.36 (<Q::cfg|dtd-default-attribute> => false);
642 wakaba 1.26 ## NOTE: Don't create DTD default attributes by
643     ## |createElementNS| method.
644     $self->{doc_cfg}-><M::c|DOMConfiguration.setParameter>
645 wakaba 1.30 (<Q::cfg|xml-id> => $self->{parser_cfg}
646     -><M::c|DOMConfiguration.getParameter>
647     (<Q::cfg|xml-id>));
648     $self->{doc_cfg}-><M::c|DOMConfiguration.setParameter>
649 wakaba 1.26 ('error-handler' => sub {
650     my (undef, $err) = @_;
651     return ($err-><AG::c|DOMError.severity> !=
652     <C::c|DOMError.SEVERITY_FATAL_ERROR>);
653     })
654     unless $Message::DOM::XMLParser::DEBUG;
655 wakaba 1.29 ## NOTE: The default error handler in manakai |warn|s error
656 wakaba 1.26 ## description.
657 wakaba 1.11
658 wakaba 1.29 ## Document entity's URI and base URI
659     $r-><AS::Document.documentURI> ($self->{entity}->[0]->{doc_uri});
660     $r-><AS::Document.manakaiEntityBaseURI>
661     ($self->{entity}->[0]->{base_uri});
662    
663 wakaba 1.37 ## Encoding name
664     $r-><AS::Document.inputEncoding> ($self->{entity}->[0]->{in_enc});
665    
666 wakaba 1.11 ## Document entity -> |Document| node
667     $self->_parse_DocumentEntity;
668    
669 wakaba 1.27 for (@{$self->{entity}}) {
670     $_->{close_file}->();
671     ## NOTE: There should be only the document entity.
672     }
673    
674 wakaba 1.11 ## Replacement tree for general |Entity| nodes
675 wakaba 1.34 if ($self->{parser_cfg}-><M::c|DOMConfiguration.getParameter>
676     (<Q::cfg|entity-replacement-tree>)) {
677     my @ent = values %{$self->{general_entity}};
678     for my $ent (@ent) {
679     if (exists $ent->{has_replacement_text}) {
680 wakaba 1.11 my $ent_name = $ent->{name};
681     $self->{entity} = [<Code::getCopyOfEntityState::
682     $entity_type = 'general_entity',
683     $entity_name = $ent_name>];
684 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
685 wakaba 1.11 $self->{token} = [];
686     $self->{char} = [];
687 wakaba 1.23 local $ent->{is_opened} = true;
688 wakaba 1.11 ## TODO: External entity support
689 wakaba 1.35 $ent->{node}-><M::Node.manakaiSetReadOnly> (false, true);
690 wakaba 1.11 $self->_parse_InternalGeneralParsedEntity ($ent->{node});
691 wakaba 1.35 $ent->{node}-><AS::GE.hasReplacementTree> (true);
692     $ent->{node}-><M::Node.manakaiSetReadOnly> (true, true);
693 wakaba 1.27 $self->{entity}->[-1]->{close_file}->();
694 wakaba 1.35 ## ISSUE: Should errors detected by this phase result
695     ## in |DOMLS:PARSE_ERR| exception thrown?
696     }
697 wakaba 1.34 }
698     } # cfg|entity-replacement-tree
699 wakaba 1.11
700 wakaba 1.21 ## Turns flags to their default value
701     $self->{doc_cfg}-><M::c|DOMConfiguration.setParameter>
702     (<Q::cfg|clone-entity-reference-subtree> => null);
703 wakaba 1.26 $self->{doc_cfg}-><M::c|DOMConfiguration.setParameter>
704 wakaba 1.36 (<Q::cfg|dtd-default-attribute> => null);
705 wakaba 1.26 $self->{doc_cfg}-><M::c|DOMConfiguration.setParameter>
706 wakaba 1.30 (<Q::cfg|xml-id> => null);
707     $self->{doc_cfg}-><M::c|DOMConfiguration.setParameter>
708 wakaba 1.26 ('error-handler' => null);
709 wakaba 1.11 $r-><AS::Document.strictErrorChecking> (true);
710 wakaba 1.1 }__;
711    
712     @Method:
713     @@Name: shiftChar
714     @@ManakaiDOM:isForInternal:1
715     @@ForCheck: ManakaiDOM|ForClass
716     @@enDesc:
717     Returns the next character.
718     @@Return:
719     @@@Type: idl|long||ManakaiDOM|all
720     @@@enDesc:
721     The code position number of the next character, if any,
722 wakaba 1.6 or <CODE::-1>.
723 wakaba 1.1 @@@PerlDef:
724     if (@{$self->{char}}) {
725     $r = shift @{$self->{char}};
726     } else {
727 wakaba 1.6 GETCHAR: {
728 wakaba 1.27 no warnings 'closed'; # getc() on closed filehandle warning
729     my $ent = $self->{entity}->[-1];
730 wakaba 1.32 my $char = $ent->{fh}->getc;
731 wakaba 1.6
732 wakaba 1.7 if (defined $char and length $char) {
733 wakaba 1.27 $ent->{pos}++;
734 wakaba 1.6 $r = ord $char;
735     if ($r == 0x000A) {
736 wakaba 1.27 $ent->{line}++;
737     $ent->{column} = 1;
738 wakaba 1.6 } elsif ($r == 0x000D) {
739 wakaba 1.32 my $next_char = $ent->{fh}->getc;
740 wakaba 1.6 if ($next_char eq "\x0A") {
741 wakaba 1.27 if ($ent->{is_external_entity}) {
742     $ent->{pos}++;
743     $ent->{line}++;
744     $ent->{column} = 1;
745     $r = 0x000A; # ^ U+000D U+000A -> U+000A ^
746     } else { # Internal entity
747     $ent->{column}++;
748     ## Line number will be increased by next |shiftChar|.
749     $ent->{fh}->ungetc (0x000A);
750     #$r = 0x000D; # ^ U+000D U+000A -> U+000D ^ U+000A
751     # no change
752     }
753 wakaba 1.6 } elsif ($next_char eq "\x85") {
754     if ($self->{xml_version} eq '1.1') {
755 wakaba 1.27 if ($ent->{is_external_entity}) {
756     if ($ent->{no_xml11_eol}) {
757     my $location = {
758     utf32_offset => $ent->{pos} - 1,
759     line_number => $ent->{line},
760     column_number => $ent->{column},
761     };
762     my $continue = __c|ERROR{
763     xp|fatal-xml11-end-of-line-in-xml-declaration::
764     c|location => {$location},
765     xp|character-number => {$r},
766     }__;
767     unless ($continue) {
768     __CODE{ParseError}__;
769     }
770     } # no_xml11_eol
771     $ent->{pos}++;
772     $ent->{line}++;
773     $ent->{column} = 1;
774     $r = 0x000A; # ^ U+000D U+0085 -> U+000A ^
775     } else { # internal entity
776     $ent->{column}++;
777     ## Line number will be increased by next |shiftChar|.
778     $ent->{fh}->ungetc (0x0085);
779     #$r = 0x000D; # ^ U+000D U+0085 -> U+000D ^ U+0085
780     # no change
781     }
782     } else { # XML 1.0
783 wakaba 1.16 ## |no_xml11_eol| will be tested later.
784 wakaba 1.27 $ent->{column}++;
785     ## Line number will be increased by next |shiftChar|.
786     $ent->{fh}->ungetc (0x0085);
787     $r = 0x000A if $ent->{is_external_entity};
788     # external: ^ U+000D U+0085 -> U+000A ^ U+0085
789     # internal: ^ U+000D U+0085 -> U+000D ^ U+0085 (as is)
790 wakaba 1.6 }
791 wakaba 1.27 } else { # neither U+000A nor U+0085
792     $ent->{line}++;
793     $ent->{column} = 1;
794     $ent->{fh}->ungetc (ord $next_char);
795     $r = 0x000A if $ent->{is_external_entity};
796     # external: ^ U+000D _ -> U+000A ^ _
797     # internal: ^ U+000D _ -> U+000D ^ _ (as is)
798 wakaba 1.6 }
799 wakaba 1.27 } elsif ($r == 0x0085 or $r == 0x2028) {
800     if ($ent->{no_xml11_eol}) {
801     my $location = {
802     utf32_offset => $ent->{pos} - 1,
803     line_number => $ent->{line},
804     column_number => $ent->{column},
805     };
806     my $continue = __c|ERROR{
807     xp|fatal-xml11-end-of-line-in-xml-declaration::
808     c|location => {$location},
809     xp|character-number => {$r},
810     }__;
811     unless ($continue) {
812     __CODE{ParseError}__;
813     }
814     } # no_xml11_eol
815     $r = 0x000A if $self->{xml_version} eq '1.1' and
816     $ent->{is_external_entity};
817     ## Even in XML 1.0 it increases the line number.
818     $ent->{line}++;
819     $ent->{column} = 1;
820 wakaba 1.6 } elsif (
821     not ((0x0020 <= $r and $r <= 0x007E) or
822     (0x00A0 <= $r and $r <= 0xD7FF) or
823     (0xE000 <= $r and $r <= 0xFFFD) or
824     (0x10000 <= $r and $r <= 0x10FFFF)) and
825 wakaba 1.27 $r != 0x0009 and
826     not (($self->{xml_version} eq '1.0' or
827     not $ent->{is_external_entity}) and
828     (0x007F <= $r and $r <= 0x009F)) and
829     not ($self->{xml_version} eq '1.1' and
830     not $ent->{is_external_entity} and
831     0x0001 <= $r and $r <= 0x001F)
832 wakaba 1.6 ) {
833     my $location = {
834 wakaba 1.27 utf32_offset => $ent->{pos} - 1,
835     line_number => $ent->{line},
836     column_number => $ent->{column},
837 wakaba 1.6 };
838 wakaba 1.27 my $continue = __c|ERROR{xp|wf-legal-literal-character::
839     c|location => {$location},
840 wakaba 1.6 xp|character-number => {$r},
841     }__;
842     unless ($continue) {
843 wakaba 1.27 __CODE{ParseError}__;
844 wakaba 1.3 }
845 wakaba 1.27 $ent->{column}++;
846     } else { # XML |Char|
847     $ent->{column}++;
848 wakaba 1.3 }
849     } else {
850 wakaba 1.6 $r = -1;
851 wakaba 1.3 }
852 wakaba 1.6 } # GETCHAR
853 wakaba 1.1 }
854    
855     @Method:
856     @@ManakaiDOM:isForInternal: 1
857     @@Operator: ManakaiDOM|MUErrorHandler
858     @@enDesc:
859     When a <IF::ecore|ErrorInterface||ManakaiDOM|Perl> is <Perl::report>ed,
860     then this method is invoked.
861    
862     The method calls the <cfg::DOMCore|error-handler> if the error is of
863     <IF::DOMCore|DOMError>. Otherwise, the error is re-thrown so that
864     corresponding <Perl::catch> clause, if any, can catch the error.
865     @@Param:
866     @@@Name: err
867     @@@Type: ecore|ErrorInterface||ManakaiDOM|Perl
868     @@@enDesc:
869     The reported error object.
870     @@Return:
871     @@@Type: DISPerl|Any
872     @@@enDesc:
873     If the <P::err> is a <IF::DOMCore|DOMError>, then the return value
874     of the error handler.
875    
876     {NOTE:: If the error is thrown, the method never returns.
877     }
878     @@@nullCase:
879     @@@@enDesc:
880     No error handler.
881     @@@PerlDef:
882 wakaba 1.45 if ($err->isa (<IFName::DOMCore|DOMError>)) {
883 wakaba 1.1 __DEEP{
884     A: {
885     my $cfg = $self-><AG::LSParser.domConfig>;
886     my $h = $cfg-><M::DOMCore|DOMConfiguration.getParameter>
887     ('error-handler');
888     $r = $h-><M::DOMCore|DOMErrorHandler.handleError> ($err);
889     } # A
890     }__;
891     } else {
892     $err-><M::ecore|ErrorInterface||ManakaiDOM|Perl.throw>;
893     }
894    
895     @DISPerl:dpgDef:
896    
897     /*
898     XML Document Entity
899    
900     document := prolog element *Misc
901     - *Char RestrictedChar *Char ;; [1]
902     */
903 wakaba 1.11 rule DocumentEntity : standalone {
904 wakaba 1.1 /*
905     prolog := XMLDecl? *Misc [doctypedecl *Misc] ;; [22]
906     */
907 wakaba 1.16 ?lexmode DocumentStart;
908 wakaba 1.11
909     my $doc;
910     lang:Perl {
911     $doc = $self->{doc};
912     }
913 wakaba 1.1
914 wakaba 1.3 ~? (XDO) {
915 wakaba 1.16 ?lexmode XMLDeclarationOrPI;
916     lang:Perl {
917     $self->{entity}->[-1]->{no_xml11_eol} = true;
918     }
919     ~ (S) { // XML declaration
920     &_XMLDeclaration_ ($doc => $doc);
921     ~ (PIC2) {
922     ?lexmode DocumentProlog;
923     } else {
924     ?lexmode DocumentProlog;
925     }
926     } (NameChar) { // Processing instruction whose target begins with |xml|
927     my $target_token;
928     lang:Perl ($v => $token.value) {
929     $target_token = $token;
930     $target_token->{value} = 'xml'.$target_token->{value};
931     $self->{entity}->[-1]->{no_xml11_eol} = false;
932     }
933     ?lexmode PINmtoken;
934     ~? (Nmtoken) {
935     lang:Perl ($v => $token.value) {
936     $target_token->{value} .= $v;
937     }
938     ?lexmode PIName;
939     }
940     lang:Perl {
941     $target_token->{type} = 'Name';
942     $target_token->{location_d} += 3; # 'xml'
943     unshift @{$self->{token}}, $token;
944     $token = $target_token;
945     }
946     &_ProcessingInstruction_ ($doc => $doc, $parent => $doc);
947     ~ (PIC) {
948     ?lexmode DocumentProlog;
949     } else {
950     ?lexmode DocumentProlog;
951     }
952 wakaba 1.3 } else {
953 wakaba 1.16 lang:Perl {
954     $self->{entity}->[-1]->{no_xml11_eol} = false;
955     }
956 wakaba 1.3 }
957     } else {
958     ?lexmode 'DocumentProlog';
959     }
960 wakaba 1.1
961     // *Misc
962 wakaba 1.2 ~* (CDO) {
963 wakaba 1.1 &_CommentDeclaration_ ($doc => $doc, $parent => $doc);
964    
965     ~ (MDC) {
966     ?lexmode DocumentProlog;
967     } else {
968     ?lexmode DocumentProlog;
969     }
970     } (PIO) {
971     &_ProcessingInstruction_ ($doc => $doc, $parent => $doc);
972    
973     ~ (PIC) {
974     ?lexmode 'DocumentProlog';
975     } else {
976     ?lexmode DocumentProlog;
977     }
978     } (S) {
979     //
980     }
981    
982     // doctypedecl
983     ~? (MDO) {
984     &_DocumentTypeDeclaration_ ($doc => $doc);
985    
986 wakaba 1.3 ~ (MDC) {
987     ?lexmode DocumentMisc;
988     } else {
989     ?lexmode DocumentMisc;
990     }
991     } else {
992     ?lexmode DocumentMisc;
993 wakaba 1.1 }
994 wakaba 1.25
995     lang:Perl {
996     $self->{doc}-><AS::Document.allDeclarationsProcessed> (true)
997     unless $self->{dont_process};
998     }
999 wakaba 1.1
1000     // *Misc
1001 wakaba 1.2 ~* (CDO) {
1002 wakaba 1.1 &_CommentDeclaration_ ($doc => $doc, $parent => $doc);
1003    
1004     ~ (MDC) {
1005     ?lexmode DocumentMisc;
1006     } else {
1007     ?lexmode DocumentMisc;
1008     }
1009     } (PIO) {
1010     &_ProcessingInstruction_ ($doc => $doc, $parent => $doc);
1011    
1012     ~ (PIC) {
1013     ?lexmode 'DocumentMisc';
1014     } else {
1015     ?lexmode DocumentMisc;
1016     }
1017     } (S) {
1018     //
1019     }
1020    
1021     // Document element
1022     ~ (STAGO) {
1023     &Element_ ($doc => $doc, $parent => $doc)
1024     : unshift-current-token;
1025     ~ (TAGC) {
1026     ?lexmode DocumentEnd;
1027     } else {
1028     ?lexmode DocumentEnd;
1029     }
1030     } else {
1031     ?lexmode 'DocumentEnd';
1032     }
1033    
1034     // *Misc
1035 wakaba 1.2 ~* (CDO) {
1036 wakaba 1.1 &_CommentDeclaration_ ($doc => $doc, $parent => $doc);
1037    
1038     ~ (MDC) {
1039     ?lexmode DocumentEnd;
1040     } else {
1041     ?lexmode DocumentEnd;
1042     }
1043     } (PIO) {
1044     &_ProcessingInstruction_ ($doc => $doc, $parent => $doc);
1045     ~ (PIC) {
1046     ?lexmode 'DocumentEnd';
1047     } else {
1048     ?lexmode DocumentEnd;
1049     }
1050     } (S) {
1051     //
1052     }
1053    
1054     ~ (#EOF) { }
1055     } // DocumentEntity
1056 wakaba 1.11
1057     /*
1058     Internal General Parsed Entity
1059    
1060     An internal general parsed entity is well-formed if its
1061     replacement text matches the production labeled |content|.
1062     */
1063     rule InternalGeneralParsedEntity ($ent) : standalone {
1064     ?lexmode ElementContent;
1065    
1066     my $ns;
1067     lang:Perl {
1068     $ns = {
1069     xml => <Q::xml:>,
1070     xmlns => <Q::xmlns:>,
1071     };
1072     }
1073    
1074     &content ($parent => $ent, $ns => $ns);
1075    
1076     ~ (#EOF) { }
1077     } // InternalGeneralParsedEntity
1078    
1079 wakaba 1.1 /*
1080     XML Declaration
1081    
1082     XMLDecl := '<?xml' VersionInfo
1083     [EncodingDecl]
1084     [SDDecl]
1085     [S] '?>' ;; [23]
1086    
1087     NOTE: XML declaration is optional in XML 1.0
1088     while it is required in XML 1.1.
1089     */
1090 wakaba 1.16 rule _XMLDeclaration_ {
1091     // ~ (XDO) { }
1092 wakaba 1.3 ?lexmode XMLDeclaration;
1093 wakaba 1.16 //lang:Perl {
1094     // $self->{entity}->[-1]->{no_xml11_eol} = true;
1095     //}
1096     //~ (S) { }
1097 wakaba 1.3
1098     ~ (Name == 'version') {
1099     ~? (S) { }
1100     ~ (VI) { }
1101     ~? (S) { }
1102 wakaba 1.1
1103 wakaba 1.3 my $ver;
1104     my $bad_token;
1105    
1106     ~ (LIT) {
1107     ?lexmode AttributeValueLiteral;
1108    
1109     ~ (STRING) {
1110     lang:Perl ($version => $token.value) {
1111     $ver = $version;
1112     $bad_token = $token;
1113     }
1114     }
1115    
1116     ~ (LIT) {
1117     ?lexmode XMLDeclaration;
1118     }
1119     } (LITA) {
1120     ?lexmode AttributeValueLiteralA;
1121    
1122     ~ (STRING) {
1123     lang:Perl ($version => $token.value) {
1124     $ver = $version;
1125     $bad_token = $token;
1126     }
1127     }
1128    
1129     ~ (LITA) {
1130     ?lexmode XMLDeclaration;
1131     }
1132     }
1133    
1134     lang:Perl : has-error {
1135     unless ($ver eq '1.0' or $ver eq '1.1') {
1136     my $location;
1137     __CODE{xp|get-location-from-token::
1138     $token => {$bad_token},
1139     $result => {$location},
1140     }__;
1141     my $continue = __DOMCore:ERROR{xp|wf-unsupported-xml-version::
1142     DOMCore|location => {$location},
1143 wakaba 1.16 xp|parent => {$self->{doc}},
1144 wakaba 1.3 infoset|version => {$ver},
1145     xp|error-token => {$bad_token},
1146     }__;
1147     unless ($continue) {
1148 wakaba 1.27 __CODE{ParseError}__;
1149 wakaba 1.3 }
1150     }
1151 wakaba 1.16 $self->{doc}-><AS::Document.xmlVersion> ($ver);
1152 wakaba 1.3 $self->{xml_version} = $ver;
1153     }
1154    
1155     ~? (S) { }
1156 wakaba 1.1 }
1157    
1158 wakaba 1.3 ~? (Name == 'encoding') {
1159     ~? (S) { }
1160     ~ (VI) { }
1161     ~? (S) { }
1162    
1163     my $ver;
1164     my $bad_token;
1165    
1166     ~ (LIT) {
1167     ?lexmode AttributeValueLiteral;
1168    
1169     ~ (STRING) {
1170     lang:Perl ($version => $token.value) {
1171     $ver = $version;
1172     $bad_token = $token;
1173     }
1174     }
1175    
1176     ~ (LIT) {
1177     ?lexmode XMLDeclaration;
1178     }
1179     } (LITA) {
1180     ?lexmode AttributeValueLiteralA;
1181    
1182     ~ (STRING) {
1183     lang:Perl ($version => $token.value) {
1184     $ver = $version;
1185     $bad_token = $token;
1186     }
1187     }
1188    
1189     ~ (LITA) {
1190     ?lexmode XMLDeclaration;
1191     }
1192     }
1193    
1194     lang:Perl : has-error {
1195     unless ($ver =~ /\A[A-Za-z][A-Za-z0-9._-]*\z/) {
1196     my $location;
1197     __CODE{xp|get-location-from-token::
1198     $token => {$bad_token},
1199     $result => {$location},
1200     }__;
1201     my $continue = __DOMCore:ERROR{xp|wf-malformed-enc-name::
1202     DOMCore|location => {$location},
1203 wakaba 1.16 xp|parent => {$self->{doc}},
1204 wakaba 1.3 xp|name => {$ver},
1205     xp|error-token => {$bad_token},
1206     }__;
1207     unless ($continue) {
1208 wakaba 1.27 __CODE{ParseError}__;
1209 wakaba 1.3 }
1210     }
1211 wakaba 1.16 $self->{doc}-><AS::Document.xmlEncoding> ($ver);
1212 wakaba 1.3 }
1213    
1214     ~? (S) { }
1215 wakaba 1.1 }
1216 wakaba 1.3
1217     ~? (Name == 'standalone') {
1218     ~? (S) { }
1219     ~ (VI) { }
1220     ~? (S) { }
1221    
1222     my $ver;
1223     my $bad_token;
1224    
1225     ~ (LIT) {
1226     ?lexmode AttributeValueLiteral;
1227    
1228     ~ (STRING) {
1229     lang:Perl ($version => $token.value) {
1230     $ver = $version;
1231     $bad_token = $token;
1232     }
1233     }
1234    
1235     ~ (LIT) {
1236     ?lexmode XMLDeclaration;
1237     }
1238     } (LITA) {
1239     ?lexmode AttributeValueLiteralA;
1240    
1241     ~ (STRING) {
1242     lang:Perl ($version => $token.value) {
1243     $ver = $version;
1244     $bad_token = $token;
1245     }
1246     }
1247 wakaba 1.1
1248 wakaba 1.3 ~ (LITA) {
1249     ?lexmode XMLDeclaration;
1250     }
1251     }
1252    
1253     lang:Perl : has-error {
1254     unless ($ver eq 'yes' or $ver eq 'no') {
1255     my $location;
1256     __CODE{xp|get-location-from-token::
1257     $token => {$bad_token},
1258     $result => {$location},
1259     }__;
1260     my $continue = __DOMCore:ERROR{xp|wf-malformed-xml-standalone::
1261     DOMCore|location => {$location},
1262 wakaba 1.16 xp|parent => {$self->{doc}},
1263 wakaba 1.3 xp|name => {$ver},
1264     xp|error-token => {$bad_token},
1265     }__;
1266     unless ($continue) {
1267 wakaba 1.27 __CODE{ParseError}__;
1268 wakaba 1.3 }
1269     }
1270 wakaba 1.13 if ($ver eq 'yes') {
1271 wakaba 1.16 $self->{doc}-><AS::Document.xmlStandalone> (true);
1272 wakaba 1.13 $self->{standalone} = true;
1273     }
1274 wakaba 1.3 }
1275    
1276     ~? (S) { }
1277     }
1278    
1279 wakaba 1.16 ~ (PIC1) {
1280     lang:Perl {
1281     $self->{entity}->[-1]->{no_xml11_eol} = false;
1282     }
1283     } else {
1284     lang:Perl {
1285     $self->{entity}->[-1]->{no_xml11_eol} = false;
1286     }
1287     }
1288    
1289     // ~ (PIC2) { }
1290 wakaba 1.3 } // _XMLDeclaration_
1291 wakaba 1.1
1292     /*
1293     Comment Declaration
1294    
1295     Comment := '<!--' *(Char - '-' / '-' (Char - '-'))
1296     '-->' ;; [15]
1297 wakaba 1.4 */
1298 wakaba 1.1 rule _CommentDeclaration_ ($doc, $parent) {
1299     ?lexmode 'CommentDeclaration';
1300    
1301     ~? (STRING) {
1302     lang:Perl ($data => $token.value) {
1303     my $com = $doc-><M::Document.createComment> ($data);
1304     $parent-><M::Node.appendChild> ($com);
1305     }
1306     } else {
1307     lang:Perl {
1308     my $com = $doc-><M::Document.createComment> ('');
1309     $parent-><M::Node.appendChild> ($com);
1310     }
1311     }
1312    
1313     ~ (COM) {
1314     ?lexmode MarkupDeclaration;
1315     } else {
1316     ?lexmode MarkupDeclaration;
1317     }
1318    
1319     // ~ (MDC) { }
1320 wakaba 1.4 } // _CommentDeclaration
1321 wakaba 1.15
1322     rule _CommentDeclarationDTD {
1323     ?lexmode CommentDeclaration;
1324 wakaba 1.4
1325     ~? (STRING) {
1326     //
1327     }
1328    
1329     ~ (COM) {
1330     ?lexmode MarkupDeclaration;
1331     } else {
1332     ?lexmode MarkupDeclaration;
1333     }
1334    
1335     ~ (MDC) {
1336     ?lexmode DTD;
1337     } else {
1338     ?lexmode DTD;
1339     }
1340     } // _CommentDeclarationDTD
1341    
1342 wakaba 1.1 /*
1343     Processing Instruction
1344    
1345     PI := '<?' PITarget [S *Char - *Char '?>' *Char]
1346     '?>' ;; [16]
1347     */
1348     rule _ProcessingInstruction_ ($doc, $parent) {
1349     ?lexmode 'PIName';
1350    
1351     my $pi;
1352    
1353     ~ (Name) {
1354 wakaba 1.3 lang:Perl ($name => $token.value) : has-error {
1355 wakaba 1.1 if (lc $name eq 'xml') {
1356 wakaba 1.3 my $location;
1357     __CODE{xp|get-location-from-token::
1358     $token => {$token},
1359     $result => {$location},
1360     }__;
1361     my $continue = __DOMCore:ERROR{xp|wf-pi-target-is-xml::
1362     xp|name => {$name},
1363     DOMCore|location => {$location},
1364     xp|parent => {$parent},
1365     }__;
1366     unless ($continue) {
1367 wakaba 1.27 __CODE{ParseError}__;
1368 wakaba 1.3 }
1369 wakaba 1.1 }
1370 wakaba 1.26 __CODE{checkNCName:: $name => $name}__;
1371    
1372 wakaba 1.1 $pi = $doc-><M::Document.createProcessingInstruction>
1373     ($name);
1374     }
1375 wakaba 1.14 } else {
1376     lang:Perl {
1377     $pi = $doc-><M::Document.createProcessingInstruction> ('#INVALID');
1378     }
1379 wakaba 1.1 }
1380    
1381 wakaba 1.14 ~? (S) {
1382 wakaba 1.1 ?lexmode 'PIData';
1383    
1384     my $tdata;
1385    
1386     ~? (DATA) {
1387     lang:Perl ($data => $token.value) {
1388     $tdata = $data;
1389     }
1390     } else {
1391     lang:Perl {
1392     $tdata = '';
1393     }
1394     }
1395    
1396     lang:Perl {
1397     $pi-><AS::Node.nodeValue> ($tdata);
1398     }
1399     }
1400    
1401     lang:Perl {
1402     $parent-><M::Node.appendChild> ($pi);
1403     }
1404    
1405     // ~ (PIC) { }
1406     } // _ProcessingInstruction_
1407 wakaba 1.4
1408 wakaba 1.6 /*
1409     Processing instruction in DTD
1410     */
1411     rule _ProcessingInstructionDTD ($doc, $doctype) {
1412 wakaba 1.4 ?lexmode 'PIName';
1413 wakaba 1.6
1414     my $pi;
1415 wakaba 1.4
1416     ~ (Name) {
1417 wakaba 1.6 lang:Perl ($name => $token.value) : has-error {
1418     if (lc $name eq 'xml') {
1419     my $location;
1420     __CODE{xp|get-location-from-token::
1421     $token => {$token},
1422     $result => {$location},
1423     }__;
1424     my $continue = __DOMCore:ERROR{xp|wf-pi-target-is-xml::
1425     xp|name => {$name},
1426     DOMCore|location => {$location},
1427     xp|parent => {$doctype},
1428     }__;
1429     unless ($continue) {
1430 wakaba 1.27 __CODE{ParseError}__;
1431 wakaba 1.6 }
1432     }
1433 wakaba 1.26 __CODE{checkNCName:: $name => $name}__;
1434    
1435 wakaba 1.6 $pi = $doc-><M::Document.createProcessingInstruction>
1436     ($name);
1437 wakaba 1.35 $pi-><AS::tx|ProcessingInstruction.manakaiBaseURI>
1438 wakaba 1.29 ($self->{location}->{base_uri});
1439 wakaba 1.6 }
1440 wakaba 1.14 } else {
1441     lang:Perl {
1442     $pi = $doc-><M::Document.createProcessingInstruction> ('#INVALID');
1443     }
1444 wakaba 1.4 }
1445    
1446 wakaba 1.14 ~? (S) {
1447 wakaba 1.4 ?lexmode 'PIData';
1448    
1449 wakaba 1.6 my $tdata;
1450    
1451 wakaba 1.4 ~? (DATA) {
1452 wakaba 1.6 lang:Perl ($data => $token.value) {
1453     $tdata = $data;
1454     }
1455     } else {
1456     lang:Perl {
1457     $tdata = '';
1458     }
1459     }
1460    
1461     lang:Perl {
1462     $pi-><AS::Node.nodeValue> ($tdata);
1463 wakaba 1.4 }
1464     }
1465    
1466 wakaba 1.6 lang:Perl {
1467     $doctype-><M::Node.appendChild> ($pi);
1468     }
1469    
1470 wakaba 1.4 ~ (PIC) {
1471     ?lexmode DTD;
1472     } else {
1473     ?lexmode DTD;
1474     }
1475     } // _ProcessingInstructionDTD
1476 wakaba 1.1
1477     /*
1478     Element content parsing mode
1479    
1480     element := EmptyElemTag /
1481     STag content ETag ;; [39]
1482     content := (CharData / element / Reference / CDSect /
1483     PI / Comment) ;; [43]
1484     */
1485 wakaba 1.6 rule Element_ ($doc, $parent, $ns) : standalone {
1486 wakaba 1.1 ?lexmode 'ElementContent';
1487    
1488     my $node; // Current "parent" node
1489     my $nodes; // Node stack (w/o $current_node)
1490     my $type; // Current "parent" element type QName
1491     my $types; // Element type stack (w/o $current_type)
1492 wakaba 1.6 //my $ns; // Current in-scope namespace bindings
1493 wakaba 1.1 my $nses; // Namespace binding stack (w/o $current_ns)
1494    
1495     lang:Perl {
1496     $node = $parent;
1497     $nodes = [];
1498     $type = '';
1499     $types = [];
1500 wakaba 1.6 $ns ||= {
1501 wakaba 1.1 xml => <Q::xml:>,
1502     xmlns => <Q::xmlns:>,
1503     };
1504     $nses = [];
1505     }
1506    
1507     ~* : name => CONTENT
1508     (CharData) {
1509     // Character data
1510     lang:Perl ($data => $token.value) {
1511 wakaba 1.31 $node-><M::Node.manakaiAppendText> (\($data));
1512 wakaba 1.1 }
1513     } (STAGO) {
1514     // Start tag or empty element tag
1515    
1516     ?lexmode 'StartTag';
1517    
1518     ~ (Name) {
1519     my $attrs;
1520 wakaba 1.26 lang:Perl ($name => $token.value) : has-error {
1521     __CODE{checkQName:: $name => $name}__;
1522 wakaba 1.1 push @{$types}, $type;
1523     $type = $name;
1524     $attrs = {};
1525     }
1526    
1527     ~? (S) {
1528     &AttributeSpecificationList
1529     ($doc => $doc, $attrs => $attrs);
1530     }
1531    
1532     my $el;
1533 wakaba 1.9
1534     /*
1535     Note that this implementation does not perform
1536     attribute value tokenization (but does white space
1537     normalization common to attribute types) and
1538     construct the tree as is. DOM Level 3 Core spec
1539     is unclear on this point. With tokenization,
1540     entity references cannot be preserved.
1541    
1542     The manakai Node.nodeValue and Attr.value attributes
1543     do tokenization according to attribute types.
1544     */
1545    
1546     /*
1547     ISSUE: Should |xml:id| attribute be typed?
1548     */
1549 wakaba 1.1
1550     lang:Perl {
1551     push @{$nses}, $ns;
1552     $ns = {%$ns};
1553 wakaba 1.26
1554     ## Default attributes
1555     DA: for my $atqname (%{$self->{attr}->{$type}}) {
1556     next DA unless $self->{attr}->{$type}->{$atqname};
1557     next DA if exists $attrs->{$atqname}; # specified
1558     my $dtype = $self->{attr}->{$type}->{$atqname}
1559     -><AG::ATDef.defaultType>;
1560     next DA unless $dtype == <C::ATDef.EXPLICIT_DEFAULT> or
1561     $dtype == <C::ATDef.FIXED_DEFAULT>;
1562     $attrs->{$atqname} = {is_default => true, nodes => []};
1563     for (@{$self->{attr}->{$type}->{$atqname}
1564     -><AG::Node.childNodes>}) {
1565     push @{$attrs->{$atqname}->{nodes}},
1566     $_-><M::Node.cloneNode> (true);
1567     }
1568     }
1569 wakaba 1.1
1570     my %gattr;
1571     my %lattr;
1572     for my $atqname (keys %$attrs) {
1573     my ($pfx, $lname) = split /:/, $atqname;
1574 wakaba 1.9 $attrs->{$atqname}->{def} = $self->{attr}->{$type}->{$atqname};
1575 wakaba 1.1 if (defined $lname) { ## Global attribute
1576     if ($pfx eq 'xmlns') {
1577 wakaba 1.26 my $nsuri = $attrs->{$atqname}->{is_default}
1578     ? $attrs->{$atqname}->{def}-><AG::Node.nodeValue>
1579     : $attrs->{$atqname}->{value};
1580     if (not $attrs->{$atqname}->{is_default} and
1581     $attrs->{$atqname}->{def}) {
1582 wakaba 1.9 my $dt = $attrs->{$atqname}->{def}-><AG::ATDef.declaredType>;
1583     if ({
1584     <C::ATDef.ID_ATTR> => true,
1585     <C::ATDef.IDREF_ATTR> => true,
1586     <C::ATDef.IDREFS_ATTR> => true,
1587     <C::ATDef.ENTITY_ATTR> => true,
1588     <C::ATDef.ENTITIES_ATTR> => true,
1589     <C::ATDef.NMTOKEN_ATTR> => true,
1590     <C::ATDef.NMTOKENS_ATTR> => true,
1591     <C::ATDef.NOTATION_ATTR> => true,
1592     <C::ATDef.ENUMERATION_ATTR> => true,
1593     }->{$dt}) {
1594     ## Tokenization (XML 1 3.3.3)
1595 wakaba 1.26 for ($nsuri) {
1596 wakaba 1.9 s/^\x20+//;
1597     s/\x20+\z//;
1598     s/\x20+/ /g;
1599     }
1600     }
1601     }
1602 wakaba 1.26 if ($lname eq 'xml' and
1603     $nsuri ne <Q::xml:>) {
1604     my $location;
1605     __CODE{xp|get-location-from-token::
1606     $token => $token,
1607     $result => $location,
1608     }__;
1609     my $continue = __c|ERROR{xp|nsc-reserved-prefix-xml::
1610     c|location => {$location},
1611     xp|token => {$token},
1612     infoset|prefix => {$lname},
1613     infoset|namespaceName => {$nsuri},
1614     }__;
1615     unless ($continue) {
1616 wakaba 1.27 __CODE{ParseError}__;
1617 wakaba 1.26 }
1618     } elsif ($lname eq 'xmlns') {
1619     my $location;
1620     __CODE{xp|get-location-from-token::
1621     $token => $token,
1622     $result => $location,
1623     }__;
1624     my $continue = __c|ERROR{xp|nsc-reserved-prefix-xmlns::
1625     c|location => {$location},
1626     xp|token => {$token},
1627     infoset|prefix => {$lname},
1628     infoset|namespaceName => {$nsuri},
1629     }__;
1630     unless ($continue) {
1631 wakaba 1.27 __CODE{ParseError}__;
1632 wakaba 1.26 }
1633     }
1634     if ($nsuri eq '') {
1635     if ($self->{xml_version} eq '1.0') {
1636     my $location;
1637     __CODE{xp|get-location-from-token::
1638     $token => $token,
1639     $result => $location,
1640     }__;
1641     my $continue = __c|ERROR{xp|nswf-empty-namespace-name::
1642     c|location => {$location},
1643     xp|token => {$token},
1644     infoset|namespaceName => {$nsuri},
1645     infoset|prefix => {$lname},
1646     }__;
1647     unless ($continue) {
1648 wakaba 1.27 __CODE{ParseError}__;
1649 wakaba 1.26 }
1650     }
1651     } elsif ($nsuri eq <Q::xml:> and
1652     $lname ne 'xml') {
1653     my $location;
1654     __CODE{xp|get-location-from-token::
1655     $token => $token,
1656     $result => $location,
1657     }__;
1658     my $continue = __c|ERROR{
1659     xp|nsc-reserved-namespace-name-xml::
1660     c|location => {$location},
1661     xp|token => {$token},
1662     infoset|prefix => {$lname},
1663     infoset|namespaceName => {$nsuri},
1664     }__;
1665     unless ($continue) {
1666 wakaba 1.27 __CODE{ParseError}__;
1667 wakaba 1.26 }
1668     } elsif ($nsuri eq <Q::xmlns:>) {
1669     my $location;
1670     __CODE{xp|get-location-from-token::
1671     $token => $token,
1672     $result => $location,
1673     }__;
1674     my $continue = __c|ERROR{
1675     xp|nsc-reserved-namespace-name-xmlns::
1676     c|location => {$location},
1677     xp|token => {$token},
1678     infoset|prefix => {$lname},
1679     infoset|namespaceName => {$nsuri},
1680     }__;
1681     unless ($continue) {
1682 wakaba 1.27 __CODE{ParseError}__;
1683 wakaba 1.26 }
1684     }
1685     $ns->{$lname} = $nsuri;
1686 wakaba 1.1 delete $ns->{$lname} unless length $ns->{$lname};
1687     }
1688     $gattr{$pfx}->{$lname} = $attrs->{$atqname};
1689     } else { ## Local attribute
1690     if ($pfx eq 'xmlns') {
1691 wakaba 1.26 $ns->{''} = $attrs->{xmlns}->{is_default}
1692     ? $attrs->{xmlns}->{def}-><AG::Node.nodeValue>
1693     : $attrs->{xmlns}->{value};
1694     if (not $attrs->{$atqname}->{is_default} and
1695     $attrs->{$atqname}->{def}) {
1696 wakaba 1.9 my $dt = $attrs->{$atqname}->{def}-><AG::ATDef.declaredType>;
1697     if ({
1698     <C::ATDef.ID_ATTR> => true,
1699     <C::ATDef.IDREF_ATTR> => true,
1700     <C::ATDef.IDREFS_ATTR> => true,
1701     <C::ATDef.ENTITY_ATTR> => true,
1702     <C::ATDef.ENTITIES_ATTR> => true,
1703     <C::ATDef.NMTOKEN_ATTR> => true,
1704     <C::ATDef.NMTOKENS_ATTR> => true,
1705     <C::ATDef.NOTATION_ATTR> => true,
1706     <C::ATDef.ENUMERATION_ATTR> => true,
1707     }->{$dt}) {
1708     ## Tokenization (XML 1 3.3.3)
1709     for ($ns->{''}) {
1710     s/^\x20+//;
1711     s/\x20+\z//;
1712     s/\x20+/ /g;
1713     }
1714     }
1715     }
1716 wakaba 1.26 unless ($ns->{''}) {
1717     delete $ns->{''};
1718     } elsif ($ns->{''} eq <Q::xml:>) {
1719     my $location;
1720     __CODE{xp|get-location-from-token::
1721     $token => $token,
1722     $result => $location,
1723     }__;
1724     my $continue = __c|ERROR{
1725     xp|nsc-reserved-namespace-name-xml::
1726     c|location => {$location},
1727     xp|token => {$token},
1728     infoset|prefix => {null},
1729     infoset|namespaceName => {<Q::xml:>},
1730     }__;
1731     unless ($continue) {
1732 wakaba 1.27 __CODE{ParseError}__;
1733 wakaba 1.26 }
1734     } elsif ($ns->{''} eq <Q::xmlns:>) {
1735     my $location;
1736     __CODE{xp|get-location-from-token::
1737     $token => $token,
1738     $result => $location,
1739     }__;
1740     my $continue = __c|ERROR{
1741     xp|nsc-reserved-namespace-name-xmlns::
1742     c|location => {$location},
1743     xp|token => {$token},
1744     infoset|prefix => {null},
1745     infoset|namespaceName => {<Q::xmlns:>},
1746     }__;
1747     unless ($continue) {
1748 wakaba 1.27 __CODE{ParseError}__;
1749 wakaba 1.26 }
1750     }
1751 wakaba 1.1 } else {
1752     $lattr{$pfx} = $attrs->{$atqname};
1753     }
1754     }
1755     }
1756    
1757     my ($pfx, $lname) = split /:/, $type;
1758     my $nsuri;
1759     if (defined $lname) { ## Prefixed namespace
1760     if (defined $ns->{$pfx}) {
1761     $nsuri = $ns->{$pfx};
1762     } else {
1763 wakaba 1.26 my $location;
1764     __CODE{xp|get-location-from-token::
1765     $token => $token,
1766     $result => $location,
1767     }__;
1768     my $continue = __c|ERROR{xp|nsc-prefix-declared::
1769     c|location => {$location},
1770     xp|token => {$token},
1771     infoset|prefix => {$pfx},
1772     xp|name => {$type},
1773     }__;
1774     unless ($continue) {
1775 wakaba 1.27 __CODE{ParseError}__;
1776 wakaba 1.26 }
1777 wakaba 1.1 }
1778     } else { ## Default namespace
1779     $nsuri = $ns->{''};
1780     }
1781    
1782     $el = $doc-><M::Document.createElementNS>
1783     ($nsuri, $type);
1784    
1785     if ($attrs->{xmlns}) {
1786     my $attr = $doc-><M::Document.createAttributeNS>
1787     (<Q::xmlns:>, 'xmlns');
1788     for (@{$attrs->{xmlns}->{nodes}}) {
1789 wakaba 1.31 if ($_-><AG::Node.nodeType> == <C::Node.TEXT_NODE>) {
1790     $attr-><M::Node.manakaiAppendText>
1791     (\($_-><AG::Node.textContent>));
1792     } else {
1793     $attr-><M::Node.appendChild> ($_);
1794     }
1795 wakaba 1.1 }
1796 wakaba 1.9 if ($attrs->{xmlns}->{def}) {
1797 wakaba 1.35 $attr-><AS::Attr.manakaiAttributeType>
1798     ($attrs->{xmlns}->{def}-><AG::ATDef.declaredType>);
1799 wakaba 1.9 }
1800 wakaba 1.1 $el-><M::Element.setAttributeNodeNS> ($attr);
1801 wakaba 1.35 $attr-><AS::Attr.specified> (false)
1802 wakaba 1.26 if $attrs->{xmlns}->{is_default};
1803 wakaba 1.1 }
1804    
1805     for my $lname (keys %lattr) {
1806     my $attr = $doc-><M::Document.createAttributeNS>
1807     (null, $lname);
1808     for (@{$lattr{$lname}->{nodes}}) {
1809 wakaba 1.31 if ($_-><AG::Node.nodeType> == <C::Node.TEXT_NODE>) {
1810     $attr-><M::Node.manakaiAppendText>
1811     (\($_-><AG::Node.textContent>));
1812     } else {
1813     $attr-><M::Node.appendChild> ($_);
1814     }
1815 wakaba 1.1 }
1816 wakaba 1.9 if ($attrs->{$lname}->{def}) {
1817 wakaba 1.35 $attr-><AS::Attr.manakaiAttributeType>
1818     ($attrs->{$lname}->{def}-><AG::ATDef.declaredType>);
1819 wakaba 1.9 }
1820 wakaba 1.1 $el-><M::Element.setAttributeNodeNS> ($attr);
1821 wakaba 1.35 $attr-><AS::Attr.specified> (false)
1822 wakaba 1.26 if $attrs->{$lname}->{is_default};
1823 wakaba 1.1 }
1824    
1825     for my $pfx (keys %gattr) {
1826 wakaba 1.26 LN: for my $lname (keys %{$gattr{$pfx}}) {
1827     my $name = $pfx.':'.$lname;
1828     unless (defined $ns->{$pfx}) {
1829     my $location;
1830     __CODE{xp|get-location-from-token::
1831     $token => $token,
1832     $result => $location,
1833     }__;
1834     my $continue = __c|ERROR{xp|nsc-prefix-declared::
1835     c|location => {$location},
1836     xp|token => {$token},
1837     xp|name => {$name},
1838     infoset|prefix => {$pfx},
1839     }__;
1840     unless ($continue) {
1841 wakaba 1.27 __CODE{ParseError}__;
1842 wakaba 1.26 }
1843     }
1844     my $attr = $el-><M::Element.getAttributeNodeNS>
1845     ($ns->{$pfx}, $lname);
1846     if ($attr) {
1847     my $another_name = $attr-><AG::Node.nodeName>;
1848     if ($name ne $another_name) {
1849     my $location;
1850     __CODE{xp|get-location-from-token::
1851     $token => $token,
1852     $result => $location,
1853     }__;
1854     my $continue = __c|ERROR{
1855     xp|nswf-unique-att-spec-expanded-name::
1856     c|location => {$location},
1857     xp|token => {$token},
1858     xp|another-attribute-name => {$another_name},
1859     xp|name => {$name},
1860     infoset|namespaceName => {$ns->{$pfx}},
1861     infoset|localName => {$lname},
1862     }__;
1863     unless ($continue) {
1864 wakaba 1.27 __CODE{ParseError}__;
1865 wakaba 1.26 }
1866 wakaba 1.35 unless ($attr-><AG::Attr.specified>) {
1867 wakaba 1.26 ## It is a default attribute
1868     $attr = $doc-><M::Document.createAttributeNS>
1869     ($ns->{$pfx}, $name);
1870     } else {
1871     ## It is a specified attribute
1872     next LN;
1873     }
1874     } else { ## There is default attribute
1875     $attr = $doc-><M::Document.createAttributeNS>
1876     ($ns->{$pfx}, $name);
1877     }
1878     } else {
1879     $attr = $doc-><M::Document.createAttributeNS>
1880     ($ns->{$pfx}, $name);
1881     }
1882 wakaba 1.1 for (@{$gattr{$pfx}->{$lname}->{nodes}}) {
1883 wakaba 1.31 if ($_-><AG::Node.nodeType> == <C::Node.TEXT_NODE>) {
1884     $attr-><M::Node.manakaiAppendText>
1885     (\($_-><AG::Node.textContent>));
1886     } else {
1887     $attr-><M::Node.appendChild> ($_);
1888     }
1889 wakaba 1.1 }
1890 wakaba 1.26 if ($gattr{$pfx}->{$lname}->{def}) {
1891 wakaba 1.35 $attr-><AS::Attr.manakaiAttributeType>
1892     ($gattr{$pfx}->{$lname}->{def}
1893     -><AG::ATDef.declaredType>);
1894 wakaba 1.9 }
1895 wakaba 1.1 $el-><M::Element.setAttributeNodeNS> ($attr);
1896 wakaba 1.35 $attr-><AS::Attr.specified> (false)
1897 wakaba 1.26 if $gattr{$pfx}->{$lname}->{is_default};
1898     } # PFX
1899 wakaba 1.1 }
1900    
1901     $node-><M::Node.appendChild> ($el);
1902     }
1903    
1904     ~ (TAGC) {
1905     lang:Perl {
1906     push @{$nodes}, $node;
1907     $node = $el;
1908     }
1909     ?lexmode ElementContent;
1910 wakaba 1.6 } (NESTC) {
1911     my $is_docel;
1912 wakaba 1.1 lang:Perl {
1913     $ns = pop @{$nses};
1914     $type = pop @{$types};
1915 wakaba 1.6 $is_docel = (@{$types} == 0);
1916     }
1917    
1918     if-true ($is_docel) {
1919     return;
1920     }
1921    
1922     ~ (TAGC) {
1923     ?lexmode ElementContent;
1924     } else {
1925     ?lexmode ElementContent;
1926 wakaba 1.1 }
1927     } else {
1928     ?lexmode ElementContent;
1929     }
1930     } else {
1931     ?lexmode ElementContent;
1932     }
1933    
1934     } (ETAGO) {
1935     // End tag
1936    
1937     ?lexmode 'EndTag';
1938    
1939     my $is_docel;
1940    
1941     ~ (Name) {
1942 wakaba 1.26 // No NCName & QName check (it must match to start-tag)
1943 wakaba 1.3 lang:Perl ($name => $token.value) : has-error {
1944 wakaba 1.1 if ($name eq $type) {
1945     $type = pop @{$types};
1946     if ($type eq '') {
1947     $is_docel = true;
1948     }
1949     $node = pop @{$nodes};
1950     $ns = pop @{$nses};
1951     } else {
1952 wakaba 1.3 my $location;
1953     __CODE{xp|get-location-from-token::
1954     $token => $token,
1955     $result => $location,
1956     }__;
1957     my $continue = __DOMCore:ERROR{xp|wf-element-type-match::
1958     DOMCore:location => {$location},
1959     xp|token => {$token},
1960     xp|expected-element-type => {$type},
1961     xp|actual-element-type => {$name},
1962     xp|node => {$node},
1963     }__;
1964     unless ($continue) {
1965 wakaba 1.27 __CODE{ParseError}__;
1966 wakaba 1.3 }
1967 wakaba 1.1 }
1968     }
1969     }
1970    
1971     ~? (S) { }
1972    
1973     if-true ($is_docel) {
1974 wakaba 1.3 lang:Perl : has-error {
1975 wakaba 1.1 if (@{$types}) {
1976 wakaba 1.3 my $location;
1977     __CODE{xp|get-location-from-token::
1978     $token => $token,
1979     $result => $location,
1980     }__;
1981     for my $type (reverse @{$types}) {
1982     my $continue = __DOMCore:ERROR{xp|wf-no-end-tag::
1983     DOMCore:location => {$location},
1984     xp|token => {$token},
1985     xp|expected-element-type => {$type},
1986     xp|node => {$node},
1987     }__;
1988     unless ($continue) {
1989 wakaba 1.27 __CODE{ParseError}__;
1990 wakaba 1.3 }
1991     $node = shift @{$nodes};
1992     }
1993 wakaba 1.1 }
1994     }
1995     return;
1996     }
1997    
1998     ~ (TAGC) {
1999     ?lexmode ElementContent;
2000     } else {
2001     ?lexmode 'ElementContent';
2002     }
2003    
2004     } (HCRO) {
2005     &_HexadecimalCharacterReference_
2006     ($doc => $doc, $parent => $node);
2007    
2008     ~ (REFC) {
2009     ?lexmode 'ElementContent';
2010     } else {
2011     ?lexmode ElementContent;
2012     }
2013     } (CRO) {
2014     &_NumericCharacterReference_
2015     ($doc => $doc, $parent => $node);
2016    
2017     ~ (REFC) {
2018     ?lexmode 'ElementContent';
2019     } else {
2020     ?lexmode ElementContent;
2021     }
2022     } (ERO) {
2023 wakaba 1.6 &_GeneralEntityReferenceEC
2024     ($doc => $doc, $parent => $node, $ns => $ns);
2025 wakaba 1.1 } (CDO) {
2026     &_CommentDeclaration_ ($doc => $doc, $parent => $node);
2027    
2028     ~ (MDC) {
2029     ?lexmode ElementContent;
2030     } else {
2031     ?lexmode ElementContent;
2032     }
2033     } (CDSO) {
2034     &_CDATASection_ ($doc => $doc, $parent => $node);
2035    
2036     ~ (MSE) {
2037     ?lexmode 'ElementContent';
2038     } else {
2039     ?lexmode ElementContent;
2040     }
2041     } (PIO) {
2042     &_ProcessingInstruction_ ($doc => $doc, $parent => $node);
2043    
2044     ~ (PIC) {
2045     ?lexmode 'ElementContent';
2046     } else {
2047     ?lexmode ElementContent;
2048     }
2049     }
2050 wakaba 1.3
2051     ~ (#NONE) { }
2052 wakaba 1.1 } // Element_
2053 wakaba 1.11
2054     /*
2055     content := [CharData]
2056     *((element / Reference / CDSect / PI / Comment) [CharData])
2057     */
2058     rule content ($parent, $ns) {
2059     // ?lexmode ElementContent;
2060    
2061     my $doc;
2062     lang:Perl {
2063     $doc = $self->{doc};
2064     }
2065    
2066     ~* (CharData) {
2067     lang:Perl ($data => $token.value) {
2068 wakaba 1.31 $parent-><M::Node.manakaiAppendText> (\($data));
2069 wakaba 1.11 }
2070     } (STAGO) {
2071     &Element_ ($doc => $doc, $parent => $parent, $ns => $ns)
2072     : unshift-current-token;
2073     ~ (TAGC) {
2074     ?lexmode ElementContent;
2075     } else {
2076     ?lexmode ElementContent;
2077     }
2078     } (HCRO) {
2079 wakaba 1.31 &_HexadecimalCharacterReference_ ($parent => $parent);
2080 wakaba 1.11
2081     ~ (REFC) {
2082     ?lexmode 'ElementContent';
2083     } else {
2084     ?lexmode ElementContent;
2085     }
2086     } (CRO) {
2087 wakaba 1.31 &_NumericCharacterReference_ ($parent => $parent);
2088 wakaba 1.11
2089     ~ (REFC) {
2090     ?lexmode 'ElementContent';
2091     } else {
2092     ?lexmode ElementContent;
2093     }
2094     } (ERO) {
2095     &_GeneralEntityReferenceEC
2096     ($doc => $doc, $parent => $parent, $ns => $ns);
2097     } (CDO) {
2098     &_CommentDeclaration_ ($doc => $doc, $parent => $parent);
2099    
2100     ~ (MDC) {
2101     ?lexmode ElementContent;
2102     } else {
2103     ?lexmode ElementContent;
2104     }
2105     } (CDSO) {
2106     &_CDATASection_ ($doc => $doc, $parent => $parent);
2107    
2108     ~ (MSE) {
2109     ?lexmode 'ElementContent';
2110     } else {
2111     ?lexmode ElementContent;
2112     }
2113     } (PIO) {
2114     &_ProcessingInstruction_ ($doc => $doc, $parent => $parent);
2115    
2116     ~ (PIC) {
2117     ?lexmode 'ElementContent';
2118     } else {
2119     ?lexmode ElementContent;
2120     }
2121     }
2122     } // content
2123 wakaba 1.1
2124     rule AttributeSpecificationList ($doc, $attrs)
2125     : standalone
2126     {
2127     ?lexmode 'StartTag';
2128    
2129     my $i;
2130     lang:Perl {
2131     $i = 0;
2132     }
2133    
2134     ~* (Name) {
2135     my $atqname;
2136 wakaba 1.26 lang:Perl ($name => $token.value) : has-error {
2137     __CODE{checkQName:: $name => $name}__;
2138 wakaba 1.1 $atqname = $name;
2139     }
2140    
2141     my $vals;
2142 wakaba 1.18 lang:Perl : has-error {
2143 wakaba 1.1 if ($attrs->{$atqname}) {
2144 wakaba 1.3 my $location;
2145     __CODE{xp|get-location-from-token::
2146     $token => $token,
2147     $result => $location,
2148     }__;
2149     my $continue = __DOMCore:ERROR{xp|wf-unique-att-spec::
2150     DOMCore:location => {$location},
2151     xp|token => {$token},
2152     xp|name => {$atqname},
2153     }__;
2154     unless ($continue) {
2155 wakaba 1.27 __CODE{ParseError}__;
2156 wakaba 1.3 }
2157 wakaba 1.1 }
2158    
2159     $vals = $attrs->{$atqname} = {
2160     nodes => [],
2161     value => '',
2162     index => $i++,
2163     };
2164     }
2165 wakaba 1.3
2166     ~? (S) { }
2167     ~ (VI) { }
2168     ~? (S) { }
2169 wakaba 1.1
2170     ~ (LIT) {
2171     &_AttributeValueSpecification_
2172     ($doc => $doc, $vals => $vals);
2173    
2174     ~ (LIT) {
2175     ?lexmode StartTag;
2176     } else {
2177     ?lexmode StartTag;
2178     }
2179     } (LITA) {
2180     &_AttributeValueSpecificationA_
2181     ($doc => $doc, $vals => $vals);
2182    
2183     ~ (LITA) {
2184     ?lexmode StartTag;
2185     } else {
2186     ?lexmode StartTag;
2187     }
2188     }
2189     } (S) : separator : terminator? { }
2190     } // AttributeSpecificationList
2191    
2192     rule _AttributeValueSpecification_ ($doc, $vals) {
2193     // ~ (LIT) { }
2194     ?lexmode 'AttributeValueLiteral';
2195    
2196     ~* (STRING) {
2197     lang:Perl ($value => $token.value) {
2198     $value =~ s/[\x09\x0A\x0D]/ /g;
2199     my $text = $doc-><M::Document.createTextNode> ($value);
2200     push @{$vals->{nodes}}, $text;
2201     $vals->{value} .= $value;
2202     }
2203     } (HCRO) {
2204     &_HexadecimalCharacterReferenceV_
2205     ($doc => $doc, $vals => $vals);
2206    
2207     ~ (REFC) {
2208     ?lexmode AttributeValueLiteral;
2209     } else {
2210     ?lexmode AttributeValueLiteral;
2211     }
2212     } (CRO) {
2213     &_NumericCharacterReferenceV_
2214     ($doc => $doc, $vals => $vals);
2215    
2216     ~ (REFC) {
2217     ?lexmode AttributeValueLiteral;
2218     } else {
2219     ?lexmode AttributeValueLiteral;
2220     }
2221     } (ERO) {
2222     // TODO: Attribute value normalization
2223     &_GeneralEntityReferenceV_
2224     ($doc => $doc, $vals => $vals);
2225    
2226     ~ (REFC) {
2227     ?lexmode AttributeValueLiteral;
2228     } else {
2229     ?lexmode AttributeValueLiteral;
2230     }
2231     }
2232    
2233     // ~ (LIT) { } (LITA) { }
2234     } // _AttributeValueSpecification_
2235    
2236     rule _AttributeValueSpecificationA_ ($doc, $vals) {
2237     // ~ (LITA) { }
2238     ?lexmode 'AttributeValueLiteralA';
2239    
2240     ~* (STRING) {
2241     lang:Perl ($value => $token.value) {
2242     $value =~ s/[\x09\x0A\x0D]/ /g;
2243     my $text = $doc-><M::Document.createTextNode> ($value);
2244     push @{$vals->{nodes}}, $text;
2245     $vals->{value} .= $value;
2246     }
2247     } (HCRO) {
2248     &_HexadecimalCharacterReferenceV_
2249     ($doc => $doc, $vals => $vals);
2250    
2251     ~ (REFC) {
2252     ?lexmode AttributeValueLiteralA;
2253     } else {
2254     ?lexmode AttributeValueLiteralA;
2255     }
2256     } (CRO) {
2257     &_NumericCharacterReferenceV_
2258     ($doc => $doc, $vals => $vals);
2259    
2260     ~ (REFC) {
2261     ?lexmode AttributeValueLiteralA;
2262     } else {
2263     ?lexmode AttributeValueLiteralA;
2264     }
2265     } (ERO) {
2266     // TODO: Attribute value normalization
2267     &_GeneralEntityReferenceV_
2268     ($doc => $doc, $vals => $vals);
2269    
2270     ~ (REFC) {
2271     ?lexmode AttributeValueLiteralA;
2272     } else {
2273     ?lexmode AttributeValueLiteralA;
2274     }
2275     }
2276    
2277     // ~ (LITA) { }
2278     } // _AttributeValueSpecificationA_
2279    
2280     /*
2281 wakaba 1.11 Parsing replacement text of an entity referenced in
2282     an attribute value specification.
2283     */
2284     rule AttributeValueLiteralE_ ($parent, $vals)
2285     : recursive
2286     {
2287     // ?lexmode AttributeValueLiteralE;
2288    
2289     ~* (STRING) {
2290     lang:Perl ($value => $token.value) {
2291     $value =~ s/[\x09\x0A\x0D]/ /g;
2292 wakaba 1.31 $parent-><M::Node.manakaiAppendText> (\($value));
2293 wakaba 1.11 $vals->{value} .= $value;
2294     }
2295     } (HCRO) {
2296     &_HexadecimalCharacterReferenceAE_
2297     ($parent => $parent, $vals => $vals);
2298    
2299     ~ (REFC) {
2300     ?lexmode AttributeValueLiteralE;
2301     } else {
2302     ?lexmode AttributeValueLiteralE;
2303     }
2304     } (CRO) {
2305     &_NumericCharacterReferenceAE_
2306     ($parent => $parent, $vals => $vals);
2307    
2308     ~ (REFC) {
2309     ?lexmode AttributeValueLiteralE;
2310     } else {
2311     ?lexmode AttributeValueLiteralE;
2312     }
2313     } (ERO) {
2314     &_GeneralEntityReferenceAE_ ($parent => $parent, $vals => $vals);
2315    
2316     ~ (REFC) {
2317     ?lexmode AttributeValueLiteralE;
2318     } else {
2319     ?lexmode AttributeValueLiteralE;
2320     }
2321 wakaba 1.18 } (#INVALID == '<') {
2322     lang:Perl : has-error {
2323     my $location;
2324     __CODE{xp|get-location-from-token::
2325     $token => $token,
2326     $result => $location,
2327     }__;
2328     my $continue = __DOMCore:ERROR{xp|wf-no-lt-in-attribute-values::
2329     c|location => {$location},
2330     xp|token => {$token},
2331     }__;
2332     unless ($continue) {
2333 wakaba 1.27 __CODE{ParseError}__;
2334 wakaba 1.18 }
2335    
2336 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ('<');
2337 wakaba 1.18 $vals->{value} .= '<';
2338     }
2339 wakaba 1.11 }
2340    
2341     // ~ (#EOF) { }
2342     } // AttributeValueLiteralE_
2343    
2344     /*
2345 wakaba 1.1 CDATA Section Content Parsing Mode
2346     */
2347     rule _CDATASection_ ($doc, $parent) {
2348     ?lexmode 'CDATASectionContent';
2349    
2350     my $cdata;
2351    
2352 wakaba 1.2 ~? (CData) {
2353 wakaba 1.1 lang:Perl ($data => $token.value) {
2354     $cdata = $data;
2355     }
2356     } else {
2357     lang:Perl {
2358     $cdata = '';
2359     }
2360     }
2361    
2362     lang:Perl {
2363     my $cdsect = $doc-><M::Document.createCDATASection>
2364     ($cdata);
2365     $parent-><M::Node.appendChild> ($cdsect);
2366     }
2367    
2368     // ~ (MSE) { }
2369     } // _CDATASection_
2370    
2371 wakaba 1.31 rule _NumericCharacterReference_ ($parent) {
2372 wakaba 1.1 ?lexmode 'NumericCharacterReference';
2373    
2374     ~ (NUMBER) {
2375 wakaba 1.3 lang:Perl ($num => $token.value) : has-error {
2376     $num += 0;
2377     unless (
2378     ($self->{xml_version} eq '1.0' and
2379     ((0x0020 <= $num and $num <= 0xD7FF) or
2380     (0xE000 <= $num and $num <= 0xFFFD) or
2381     (0x10000 <= $num and $num <= 0x10FFFF) or
2382     $num == 0x9 or $num == 0xA or $num == 0xD)) or
2383     ($self->{xml_version} eq '1.1' and
2384     ((0x0001 <= $num and $num <= 0xD7FF) or
2385     (0xE000 <= $num and $num <= 0xFFFD) or
2386     (0x10000 <= $num and $num <= 0x10FFFF)))
2387     ) {
2388     my $location;
2389     __CODE{xp|get-location-from-token::
2390     $token => $token,
2391     $result => $location,
2392     }__;
2393     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2394     DOMCore:location => {$location},
2395     xp|token => {$token},
2396     xp|character-number => {$num},
2397     xp|parent => {$parent},
2398     }__;
2399     unless ($continue) {
2400 wakaba 1.27 __CODE{ParseError}__;
2401 wakaba 1.3 }
2402     }
2403 wakaba 1.31 $parent-><M::Node.manakaiAppendText> (chr $num);
2404 wakaba 1.1 }
2405     }
2406    
2407     // ~ (REFC) { }
2408     } // _NumericCharacterReference_
2409    
2410     rule _NumericCharacterReferenceV_ ($doc, $vals) {
2411     ?lexmode 'NumericCharacterReference';
2412    
2413     ~ (NUMBER) {
2414 wakaba 1.3 lang:Perl ($num => $token.value) : has-error {
2415     $num += 0;
2416     unless (
2417     ($self->{xml_version} eq '1.0' and
2418     ((0x0020 <= $num and $num <= 0xD7FF) or
2419     (0xE000 <= $num and $num <= 0xFFFD) or
2420     (0x10000 <= $num and $num <= 0x10FFFF) or
2421     $num == 0x9 or $num == 0xA or $num == 0xD)) or
2422     ($self->{xml_version} eq '1.1' and
2423     ((0x0001 <= $num and $num <= 0xD7FF) or
2424     (0xE000 <= $num and $num <= 0xFFFD) or
2425     (0x10000 <= $num and $num <= 0x10FFFF)))
2426     ) {
2427     my $location;
2428     __CODE{xp|get-location-from-token::
2429     $token => $token,
2430     $result => $location,
2431     }__;
2432     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2433     DOMCore:location => {$location},
2434     xp|token => {$token},
2435     xp|character-number => {$num},
2436     }__;
2437     unless ($continue) {
2438 wakaba 1.27 __CODE{ParseError}__;
2439 wakaba 1.3 }
2440     }
2441 wakaba 1.1 my $ncr = $doc-><M::Document.createTextNode>
2442 wakaba 1.9 (my $char = chr $num);
2443 wakaba 1.1 push @{$vals->{nodes}}, $ncr;
2444     $vals->{value} .= $char;
2445     }
2446     }
2447    
2448     // ~ (REFC) { }
2449     } // _NumericCharacterReferenceV_
2450    
2451 wakaba 1.11 /*
2452     Numeric character reference in the replacement text
2453     of the entity referenced in an attribute value specification
2454     */
2455     rule _NumericCharacterReferenceAE_ ($parent, $vals)
2456     {
2457     ?lexmode NumericCharacterReference;
2458    
2459     ~ (NUMBER) {
2460     lang:Perl ($num => $token.value) : has-error {
2461     $num += 0;
2462     unless (
2463     ($self->{xml_version} eq '1.0' and
2464     ((0x0020 <= $num and $num <= 0xD7FF) or
2465     (0xE000 <= $num and $num <= 0xFFFD) or
2466     (0x10000 <= $num and $num <= 0x10FFFF) or
2467     $num == 0x9 or $num == 0xA or $num == 0xD)) or
2468     ($self->{xml_version} eq '1.1' and
2469     ((0x0001 <= $num and $num <= 0xD7FF) or
2470     (0xE000 <= $num and $num <= 0xFFFD) or
2471     (0x10000 <= $num and $num <= 0x10FFFF)))
2472     ) {
2473     my $location;
2474     __CODE{xp|get-location-from-token::
2475     $token => $token,
2476     $result => $location,
2477     }__;
2478     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2479     DOMCore:location => {$location},
2480     xp|token => {$token},
2481     xp|character-number => {$num},
2482     }__;
2483     unless ($continue) {
2484 wakaba 1.27 __CODE{ParseError}__;
2485 wakaba 1.11 }
2486     }
2487 wakaba 1.31 my $char = chr $num;
2488     $parent-><M::Node.manakaiAppendText> (\$char);
2489 wakaba 1.11 $vals->{value} .= $char;
2490     }
2491     }
2492    
2493     // ~ (REFC) { }
2494     } // _NumericCharacterReferenceAE_
2495    
2496     rule _NumericCharacterReferenceEV_ ($vals)
2497     {
2498     ?lexmode 'NumericCharacterReference';
2499    
2500     ~ (NUMBER) {
2501     lang:Perl ($num => $token.value) : has-error {
2502     $num += 0;
2503     unless (
2504     ($self->{xml_version} eq '1.0' and
2505     ((0x0020 <= $num and $num <= 0xD7FF) or
2506     (0xE000 <= $num and $num <= 0xFFFD) or
2507     (0x10000 <= $num and $num <= 0x10FFFF) or
2508     $num == 0x9 or $num == 0xA or $num == 0xD)) or
2509     ($self->{xml_version} eq '1.1' and
2510     ((0x0001 <= $num and $num <= 0xD7FF) or
2511     (0xE000 <= $num and $num <= 0xFFFD) or
2512     (0x10000 <= $num and $num <= 0x10FFFF)))
2513     ) {
2514     my $location;
2515     __CODE{xp|get-location-from-token::
2516     $token => $token,
2517     $result => $location,
2518     }__;
2519     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2520     DOMCore:location => {$location},
2521     xp|token => {$token},
2522     xp|character-number => {$num},
2523     }__;
2524     unless ($continue) {
2525 wakaba 1.27 __CODE{ParseError}__;
2526 wakaba 1.11 }
2527     }
2528     push @{$vals}, chr $num;
2529     }
2530     }
2531    
2532     // ~ (REFC) { }
2533     } // _NumericCharacterReferenceEV_
2534    
2535 wakaba 1.31 rule _HexadecimalCharacterReference_ ($parent) {
2536 wakaba 1.1 ?lexmode 'HexadecimalCharacterReference';
2537    
2538     ~ (Hex) {
2539 wakaba 1.9 lang:Perl ($v => $token.value) : has-error {
2540     my $num = hex $v;
2541 wakaba 1.3 unless (
2542     ($self->{xml_version} eq '1.0' and
2543     ((0x0020 <= $num and $num <= 0xD7FF) or
2544     (0xE000 <= $num and $num <= 0xFFFD) or
2545     (0x10000 <= $num and $num <= 0x10FFFF) or
2546     $num == 0x9 or $num == 0xA or $num == 0xD)) or
2547     ($self->{xml_version} eq '1.1' and
2548     ((0x0001 <= $num and $num <= 0xD7FF) or
2549     (0xE000 <= $num and $num <= 0xFFFD) or
2550     (0x10000 <= $num and $num <= 0x10FFFF)))
2551     ) {
2552     my $location;
2553     __CODE{xp|get-location-from-token::
2554     $token => $token,
2555     $result => $location,
2556     }__;
2557     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2558     DOMCore:location => {$location},
2559     xp|token => {$token},
2560     xp|character-number => {$num},
2561     xp|parent => {$parent},
2562     }__;
2563     unless ($continue) {
2564 wakaba 1.27 __CODE{ParseError}__;
2565 wakaba 1.3 }
2566     }
2567 wakaba 1.31 $parent-><M::Node.manakaiAppendText> (chr $num);
2568 wakaba 1.1 }
2569     }
2570    
2571     // ~ (REFC) { }
2572     } // _HexadecimalCharacterReference_
2573    
2574 wakaba 1.3 rule _HexadecimalCharacterReferenceV_ ($doc, $vals) {
2575 wakaba 1.1 ?lexmode 'HexadecimalCharacterReference';
2576    
2577     ~ (Hex) {
2578 wakaba 1.9 lang:Perl ($v => $token.value) : has-error {
2579     my $num = hex $v;
2580 wakaba 1.3 unless (
2581     ($self->{xml_version} eq '1.0' and
2582     ((0x0020 <= $num and $num <= 0xD7FF) or
2583     (0xE000 <= $num and $num <= 0xFFFD) or
2584     (0x10000 <= $num and $num <= 0x10FFFF) or
2585     $num == 0x9 or $num == 0xA or $num == 0xD)) or
2586     ($self->{xml_version} eq '1.1' and
2587     ((0x0001 <= $num and $num <= 0xD7FF) or
2588     (0xE000 <= $num and $num <= 0xFFFD) or
2589     (0x10000 <= $num and $num <= 0x10FFFF)))
2590     ) {
2591     my $location;
2592     __CODE{xp|get-location-from-token::
2593     $token => $token,
2594     $result => $location,
2595     }__;
2596     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2597     DOMCore:location => {$location},
2598     xp|token => {$token},
2599     xp|character-number => {$num},
2600     }__;
2601     unless ($continue) {
2602 wakaba 1.27 __CODE{ParseError}__;
2603 wakaba 1.3 }
2604     }
2605 wakaba 1.1 my $ncr = $doc-><M::Document.createTextNode>
2606 wakaba 1.9 (my $char = chr $num);
2607 wakaba 1.1 push @{$vals->{nodes}}, $ncr;
2608     $vals->{value} .= $char;
2609     }
2610     }
2611    
2612     // ~ (REFC) { }
2613 wakaba 1.11 } // _HexadecimalCharacterReferenceV_
2614    
2615     /*
2616     Hexadecimal character reference in the replacement text
2617     of the entity referenced in an attribute value literal
2618     */
2619     rule _HexadecimalCharacterReferenceAE_ ($parent, $vals)
2620     {
2621     ?lexmode HexadecimalCharacterReference;
2622    
2623     ~ (Hex) {
2624     lang:Perl ($v => $token.value) : has-error {
2625     my $num = hex $v;
2626     unless (
2627     ($self->{xml_version} eq '1.0' and
2628     ((0x0020 <= $num and $num <= 0xD7FF) or
2629     (0xE000 <= $num and $num <= 0xFFFD) or
2630     (0x10000 <= $num and $num <= 0x10FFFF) or
2631     $num == 0x9 or $num == 0xA or $num == 0xD)) or
2632     ($self->{xml_version} eq '1.1' and
2633     ((0x0001 <= $num and $num <= 0xD7FF) or
2634     (0xE000 <= $num and $num <= 0xFFFD) or
2635     (0x10000 <= $num and $num <= 0x10FFFF)))
2636     ) {
2637     my $location;
2638     __CODE{xp|get-location-from-token::
2639     $token => $token,
2640     $result => $location,
2641     }__;
2642     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2643     DOMCore:location => {$location},
2644     xp|token => {$token},
2645     xp|character-number => {$num},
2646     }__;
2647     unless ($continue) {
2648 wakaba 1.27 __CODE{ParseError}__;
2649 wakaba 1.11 }
2650     }
2651 wakaba 1.31 my $char = chr $num;
2652     $parent-><M::Node.manakaiAppendText> (\$char);
2653 wakaba 1.11 $vals->{value} .= $char;
2654     }
2655     }
2656    
2657     // ~ (REFC) { }
2658     } // _HexadecimalCharacterReferenceAE_
2659    
2660     rule _HexadecimalCharacterReferenceEV_ ($vals) {
2661     ?lexmode HexadecimalCharacterReference;
2662    
2663     ~ (Hex) {
2664     lang:Perl ($v => $token.value) : has-error {
2665     my $num = hex $v;
2666     unless (
2667     ($self->{xml_version} eq '1.0' and
2668     ((0x0020 <= $num and $num <= 0xD7FF) or
2669     (0xE000 <= $num and $num <= 0xFFFD) or
2670     (0x10000 <= $num and $num <= 0x10FFFF) or
2671     $num == 0x9 or $num == 0xA or $num == 0xD)) or
2672     ($self->{xml_version} eq '1.1' and
2673     ((0x0001 <= $num and $num <= 0xD7FF) or
2674     (0xE000 <= $num and $num <= 0xFFFD) or
2675     (0x10000 <= $num and $num <= 0x10FFFF)))
2676     ) {
2677     my $location;
2678     __CODE{xp|get-location-from-token::
2679     $token => $token,
2680     $result => $location,
2681     }__;
2682     my $continue = __DOMCore:ERROR{xp|wf-legal-character::
2683     DOMCore:location => {$location},
2684     xp|token => {$token},
2685     xp|character-number => {$num},
2686     }__;
2687     unless ($continue) {
2688 wakaba 1.27 __CODE{ParseError}__;
2689 wakaba 1.11 }
2690     }
2691     push @{$vals}, chr $num;
2692     }
2693     }
2694    
2695     // ~ (REFC) { }
2696     } // _HexadecimalCharacterReferenceEV_
2697    
2698     /*
2699     General entity reference in element's content
2700     */
2701     rule _GeneralEntityReferenceEC ($doc, $parent, $ns)
2702     : recursive
2703     {
2704     ?lexmode 'EntityReference';
2705    
2706     ~ (Name == 'lt') {
2707     lang:Perl {
2708 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ('<');
2709 wakaba 1.11 }
2710     } (Name == 'gt') {
2711     lang:Perl {
2712 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ('>');
2713 wakaba 1.11 }
2714     } (Name == 'amp') {
2715     lang:Perl {
2716 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ('&');
2717 wakaba 1.11 }
2718     } (Name == 'quot') {
2719     lang:Perl {
2720 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ('"');
2721 wakaba 1.11 }
2722     } (Name == 'apos') {
2723     lang:Perl {
2724 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ("'");
2725 wakaba 1.11 }
2726     } (Name) {
2727     my $er;
2728 wakaba 1.19 lang:Perl ($name => $token.value) : has-error {
2729 wakaba 1.26 __CODE{checkNCName:: $name => $name}__;
2730    
2731 wakaba 1.11 $er = $doc-><M::Document.createEntityReference>
2732     ($name);
2733 wakaba 1.35 $er-><M::Node.manakaiSetReadOnly> (false, true);
2734 wakaba 1.20 $er-><AS::Node.textContent> ('');
2735     ## NOTE: When document entity (and entities referenced directly
2736     ## or indirectly from it) is parsed, no general entity
2737     ## node have its replacement tree. During general
2738     ## entity node collection construction, however,
2739     ## some entity node has replacement tree.
2740 wakaba 1.11 $parent-><M::Node.appendChild> ($er);
2741 wakaba 1.19
2742     my $ent = $self->{general_entity}->{$name};
2743     if (not $ent) { # no entity declaration
2744     if ($self->{standalone} or not $self->{has_xref}) { # WFC error
2745     my $location;
2746     __CODE{xp|get-location-from-token::
2747     $token => {$token},
2748     $result => {$location},
2749     }__;
2750     my $continue = __DOMCore:ERROR{xp|wf-entity-declared::
2751     xp|error-token => {$token},
2752     c|location => {$location},
2753     xp|name => {$name},
2754     }__;
2755     unless ($continue) {
2756 wakaba 1.27 __CODE{ParseError}__;
2757 wakaba 1.19 }
2758     } # Otherwise VC error
2759 wakaba 1.23 push @{$self->{entity}}, <Code::getEmptyEntityState::
2760     $name = $name>;
2761 wakaba 1.35 $er-><AS::GERef.manakaiExpanded> (false);
2762 wakaba 1.19
2763     } else { # there IS entity declaration
2764     if (($self->{standalone} or not $self->{has_xref}) and
2765     $ent->{is_externally_declared} and
2766     not $self->{entity}->[-1]->{is_externally_declared}) {
2767     my $location;
2768     __CODE{xp|get-location-from-token::
2769     $token => {$token},
2770     $result => {$location},
2771     }__;
2772     my $continue = __DOMCore:ERROR{xp|wf-entity-declared::
2773     xp|error-token => {$token},
2774     c|location => {$location},
2775     xp|name => {$name},
2776     }__;
2777     unless ($continue) {
2778 wakaba 1.27 __CODE{ParseError}__;
2779 wakaba 1.19 }
2780     }
2781 wakaba 1.35 $er-><AS::GERef.manakaiExpanded>
2782 wakaba 1.19 ($ent->{has_replacement_text});
2783     push @{$self->{entity}}, <Code::getCopyOfEntityState::
2784 wakaba 1.11 $entity_type = 'general_entity',
2785     $entity_name = $name>;
2786 wakaba 1.23
2787     if (defined $ent->{notation}) {
2788     my $location;
2789     __CODE{xp|get-location-from-token::
2790     $token => {$token},
2791     $result => {$location},
2792     }__;
2793     my $continue = __c|ERROR{xp|wf-parsed-entity::
2794     xp|error-token => {$token},
2795     c|location => {$location},
2796     xp|name => {$name},
2797     }__;
2798     unless ($continue) {
2799 wakaba 1.27 __CODE{ParseError}__;
2800 wakaba 1.23 }
2801     } # if unparsed entity
2802    
2803     if ($ent->{is_opened}) {
2804     my $location;
2805     __CODE{xp|get-location-from-token::
2806     $token => {$token},
2807     $result => {$location},
2808     }__;
2809     my $continue = __c|ERROR{xp|wf-no-recursion::
2810     xp|error-token => {$token},
2811     c|location => {$location},
2812     xp|name => {$name},
2813     }__;
2814     unless ($continue) {
2815 wakaba 1.27 __CODE{ParseError}__;
2816 wakaba 1.23 }
2817 wakaba 1.27 open my $empty, '<', \'';
2818     $self->{entity}->[-1]->{fh} = $empty;
2819 wakaba 1.35 $er-><AS::GERef.manakaiExpanded> (false);
2820 wakaba 1.23 } # recursive
2821     $ent->{is_opened} = true;
2822     } # entity declared
2823 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
2824 wakaba 1.11 push @{$self->{entity_token}}, $self->{token};
2825     $self->{token} = [];
2826     push @{$self->{entity_char}}, $self->{char};
2827     $self->{char} = [];
2828     }
2829    
2830     ?lexmode ElementContent;
2831     &content ($doc => $doc, $parent => $er, $ns => $ns);
2832     ~ (#EOF) { }
2833     lang:Perl {
2834 wakaba 1.23 $self->{general_entity}->{$self->{entity}->[-1]->{name}}
2835     ->{is_opened} = false
2836     if $self->{general_entity}->{$self->{entity}->[-1]->{name}};
2837 wakaba 1.11 $self->{token} = pop @{$self->{entity_token}};
2838     $self->{char} = pop @{$self->{entity_char}};
2839 wakaba 1.27 pop (@{$self->{entity}})->{close_file}->();
2840 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
2841 wakaba 1.35
2842     $er-><M::Node.manakaiSetReadOnly> (true, true);
2843 wakaba 1.11 }
2844    
2845     ?lexmode EntityReference;
2846     ?requires-next-token;
2847     }
2848    
2849     ~ (REFC) {
2850     ?lexmode ElementContent;
2851     } else {
2852     ?lexmode ElementContent;
2853     }
2854     } // _GeneralEntityReferenceEC
2855    
2856     /*
2857     General entity reference in an attribute value literal
2858     */
2859     rule _GeneralEntityReferenceV_ ($vals) {
2860     ?lexmode EntityReference;
2861    
2862     ~ (Name == 'lt') {
2863     lang:Perl {
2864     push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode>
2865     ('<');
2866     $vals->{value} .= '<';
2867     }
2868     } (Name == 'gt') {
2869     lang:Perl {
2870     push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode>
2871     ('>');
2872     $vals->{value} .= '>';
2873     }
2874     } (Name == 'amp') {
2875     lang:Perl {
2876     push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode>
2877     ('&');
2878     $vals->{value} .= '&';
2879     }
2880     } (Name == 'quot') {
2881     lang:Perl {
2882     push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode>
2883     ('"');
2884     $vals->{value} .= '"';
2885     }
2886     } (Name == 'apos') {
2887     lang:Perl {
2888     push @{$vals->{nodes}}, $self->{doc}-><M::Document.createTextNode>
2889     ("'");
2890     $vals->{value} .= "'";
2891     }
2892     } (Name) {
2893     my $er;
2894 wakaba 1.18 lang:Perl ($name => $token.value) : has-error {
2895 wakaba 1.26 __CODE{checkNCName:: $name => $name}__;
2896 wakaba 1.18
2897 wakaba 1.11 $er = $self->{doc}-><M::Document.createEntityReference> ($name);
2898 wakaba 1.35 $er-><M::Node.manakaiSetReadOnly> (false, true);
2899 wakaba 1.20 $er-><AS::Node.textContent> ('');
2900     ## NOTE: When document entity (and entities referenced directly
2901     ## or indirectly from it) is parsed, no general entity
2902     ## node have its replacement tree. During general
2903     ## entity node collection construction, however,
2904     ## some entity node has replacement tree.
2905 wakaba 1.19 my $ent = $self->{general_entity}->{$name};
2906 wakaba 1.20 if (not $ent) { # no entity declaration
2907     if ($self->{standalone} or not $self->{has_xref}) { # WFC error
2908     my $location;
2909     __CODE{xp|get-location-from-token::
2910     $token => {$token},
2911     $result => {$location},
2912     }__;
2913     my $continue = __DOMCore:ERROR{xp|wf-entity-declared::
2914     xp|error-token => {$token},
2915     c|location => {$location},
2916     xp|name => {$name},
2917     }__;
2918     unless ($continue) {
2919 wakaba 1.27 __CODE{ParseError}__;
2920 wakaba 1.20 }
2921     } # Otherwise VC error
2922 wakaba 1.23 push @{$self->{entity}}, <Code::getEmptyEntityState::
2923     $name = $name>;
2924 wakaba 1.35 $er-><AS::GERef.manakaiExpanded> (false);
2925 wakaba 1.20
2926     } else { # there IS entity declaration
2927     if (($self->{standalone} or not $self->{has_xref}) and
2928     $ent->{is_externally_declared} and
2929     not $self->{entity}->[-1]->{is_externally_declared}) {
2930     my $location;
2931     __CODE{xp|get-location-from-token::
2932     $token => {$token},
2933     $result => {$location},
2934     }__;
2935     my $continue = __DOMCore:ERROR{xp|wf-entity-declared::
2936     xp|error-token => {$token},
2937     c|location => {$location},
2938     xp|name => {$name},
2939     }__;
2940     unless ($continue) {
2941 wakaba 1.27 __CODE{ParseError}__;
2942 wakaba 1.20 }
2943     }
2944    
2945     if ($ent->{is_external_entity}) {
2946     my $location;
2947     __CODE{xp|get-location-from-token::
2948     $token => {$token},
2949     $result => {$location},
2950     }__;
2951     my $continue = __c|ERROR{xp|wf-no-external-entity-references::
2952     xp|error-token => {$token},
2953     c|location => {$location},
2954     xp|name => {$name},
2955     }__;
2956     unless ($continue) {
2957 wakaba 1.27 __CODE{ParseError}__;
2958 wakaba 1.20 }
2959 wakaba 1.23 ## NOTE: |xp:wf-parsed-entity| is not checked
2960 wakaba 1.20 } # if external entity
2961    
2962 wakaba 1.35 $er-><AS::GERef.manakaiExpanded>
2963 wakaba 1.19 ($ent->{has_replacement_text});
2964 wakaba 1.20 push @{$self->{entity}}, <Code::getCopyOfEntityState::
2965 wakaba 1.11 $entity_type = 'general_entity',
2966     $entity_name = $name>;
2967 wakaba 1.23
2968     if ($ent->{is_opened}) {
2969     my $location;
2970     __CODE{xp|get-location-from-token::
2971     $token => {$token},
2972     $result => {$location},
2973     }__;
2974     my $continue = __c|ERROR{xp|wf-no-recursion::
2975     xp|error-token => {$token},
2976     c|location => {$location},
2977     xp|name => {$name},
2978     }__;
2979     unless ($continue) {
2980 wakaba 1.27 __CODE{ParseError}__;
2981 wakaba 1.23 }
2982 wakaba 1.27 open my $empty, '<', \'';
2983     $self->{entity}->[-1]->{fh} = $empty;
2984 wakaba 1.35 $er-><AS::GERef.manakaiExpanded> (false);
2985 wakaba 1.23 } # recursive
2986     $ent->{is_opened} = true;
2987 wakaba 1.20 }
2988     push @{$vals->{nodes}}, $er;
2989 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
2990 wakaba 1.11 push @{$self->{entity_token}}, $self->{token};
2991     $self->{token} = [];
2992     push @{$self->{entity_char}}, $self->{char};
2993     $self->{char} = [];
2994     }
2995    
2996     ?lexmode AttributeValueLiteralE;
2997     &AttributeValueLiteralE_ ($parent => $er, $vals => $vals);
2998     ~ (#EOF) { }
2999     lang:Perl {
3000 wakaba 1.23 $self->{general_entity}->{$self->{entity}->[-1]->{name}}
3001     ->{is_opened} = false
3002     if $self->{general_entity}->{$self->{entity}->[-1]->{name}};
3003 wakaba 1.11 $self->{token} = pop @{$self->{entity_token}};
3004     $self->{char} = pop @{$self->{entity_char}};
3005 wakaba 1.27 pop (@{$self->{entity}})->{close_file}->();
3006 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
3007 wakaba 1.35
3008     $er-><M::Node.manakaiSetReadOnly> (true, true);
3009 wakaba 1.11 }
3010    
3011     ?lexmode EntityReference;
3012     ?requires-next-token;
3013     }
3014    
3015     // ~ (REFC) { }
3016     } // _GeneralEntityReferenceV_
3017 wakaba 1.1
3018 wakaba 1.6 /*
3019 wakaba 1.11 General entity reference in the replacement text
3020     of the entity referenced in an attribute value literal
3021 wakaba 1.6 */
3022 wakaba 1.11 rule _GeneralEntityReferenceAE_ ($parent, $vals)
3023 wakaba 1.6 {
3024 wakaba 1.11 ?lexmode EntityReference;
3025 wakaba 1.1
3026 wakaba 1.11 ~ (Name == 'lt') {
3027     lang:Perl {
3028 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ('<');
3029 wakaba 1.11 $vals->{value} .= '<';
3030     }
3031     } (Name == 'gt') {
3032     lang:Perl {
3033 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ('>');
3034 wakaba 1.11 $vals->{value} .= '>';
3035     }
3036     } (Name == 'amp') {
3037     lang:Perl {
3038 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ('&');
3039 wakaba 1.11 $vals->{value} .= '&';
3040     }
3041     } (Name == 'quot') {
3042     lang:Perl {
3043 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ('"');
3044 wakaba 1.11 $vals->{value} .= '"';
3045     }
3046     } (Name == 'apos') {
3047     lang:Perl {
3048 wakaba 1.31 $parent-><M::Node.manakaiAppendText> ("'");
3049 wakaba 1.11 $vals->{value} .= "'";
3050     }
3051     } (Name) {
3052 wakaba 1.6 my $er;
3053 wakaba 1.26 lang:Perl ($name => $token.value) : has-error {
3054     __CODE{checkNCName:: $name => $name}__;
3055 wakaba 1.18
3056 wakaba 1.11 $er = $self->{doc}-><M::Document.createEntityReference> ($name);
3057 wakaba 1.35 $er-><M::Node.manakaiSetReadOnly> (false, true);
3058 wakaba 1.20 $er-><AS::Node.textContent> ('');
3059     ## NOTE: When document entity (and entities referenced directly
3060     ## or indirectly from it) is parsed, no general entity
3061     ## node have its replacement tree. During general
3062     ## entity node collection construction, however,
3063     ## some entity node has replacement tree.
3064 wakaba 1.19 my $ent = $self->{general_entity}->{$name};
3065 wakaba 1.22 if (not $ent) { # no entity declaration
3066     if ($self->{standalone} or not $self->{has_xref}) { # WFC error
3067     my $location;
3068     __CODE{xp|get-location-from-token::
3069     $token => {$token},
3070     $result => {$location},
3071     }__;
3072     my $continue = __DOMCore:ERROR{xp|wf-entity-declared::
3073     xp|error-token => {$token},
3074     c|location => {$location},
3075     xp|name => {$name},
3076     }__;
3077     unless ($continue) {
3078 wakaba 1.27 __CODE{ParseError}__;
3079 wakaba 1.22 }
3080     } # Otherwise VC error
3081 wakaba 1.23 push @{$self->{entity}}, <Code::getEmptyEntityState::
3082     $name = $name>;
3083 wakaba 1.35 $er-><AS::GERef.manakaiExpanded> (false);
3084 wakaba 1.22
3085     } else { # there IS entity declaration
3086     if (($self->{standalone} or not $self->{has_xref}) and
3087     $ent->{is_externally_declared} and
3088     not $self->{entity}->[-1]->{is_externally_declared}) {
3089     my $location;
3090     __CODE{xp|get-location-from-token::
3091     $token => {$token},
3092     $result => {$location},
3093     }__;
3094     my $continue = __DOMCore:ERROR{xp|wf-entity-declared::
3095     xp|error-token => {$token},
3096     c|location => {$location},
3097     xp|name => {$name},
3098     }__;
3099     unless ($continue) {
3100 wakaba 1.27 __CODE{ParseError}__;
3101 wakaba 1.22 }
3102     }
3103    
3104     if ($ent->{is_external_entity}) {
3105     my $location;
3106     __CODE{xp|get-location-from-token::
3107     $token => {$token},
3108     $result => {$location},
3109     }__;
3110     my $continue = __c|ERROR{xp|wf-no-external-entity-references::
3111     xp|error-token => {$token},
3112     c|location => {$location},
3113     xp|name => {$name},
3114     }__;
3115     unless ($continue) {
3116 wakaba 1.27 __CODE{ParseError}__;
3117 wakaba 1.22 }
3118 wakaba 1.23 ## NOTE: |xp:wf-parsed-entity| is not checked
3119 wakaba 1.22 } # if external entity
3120    
3121 wakaba 1.35 $er-><AS::GERef.manakaiExpanded>
3122 wakaba 1.19 ($ent->{has_replacement_text});
3123 wakaba 1.22 push @{$self->{entity}}, <Code::getCopyOfEntityState::
3124 wakaba 1.6 $entity_type = 'general_entity',
3125     $entity_name = $name>;
3126 wakaba 1.23
3127     if ($ent->{is_opened}) {
3128     my $location;
3129     __CODE{xp|get-location-from-token::
3130     $token => {$token},
3131     $result => {$location},
3132     }__;
3133     my $continue = __c|ERROR{xp|wf-no-recursion::
3134     xp|error-token => {$token},
3135     c|location => {$location},
3136     xp|name => {$name},
3137     }__;
3138     unless ($continue) {
3139 wakaba 1.27 __CODE{ParseError}__;
3140 wakaba 1.23 }
3141 wakaba 1.27 open my $empty, '<', \'';
3142     $self->{entity}->[-1]->{fh} = $empty;
3143 wakaba 1.35 $er-><AS::GERef.manakaiExpanded> (false);
3144 wakaba 1.23 } # recursive
3145     $ent->{is_opened} = true;
3146 wakaba 1.22 }
3147     $parent-><M::Node.appendChild> ($er);
3148 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
3149 wakaba 1.6 push @{$self->{entity_token}}, $self->{token};
3150     $self->{token} = [];
3151     push @{$self->{entity_char}}, $self->{char};
3152     $self->{char} = [];
3153     }
3154    
3155 wakaba 1.11 ?lexmode AttributeValueLiteralE;
3156     &AttributeValueLiteralE_ ($parent => $er, $vals => $vals);
3157 wakaba 1.6 ~ (#EOF) { }
3158     lang:Perl {
3159 wakaba 1.23 $self->{general_entity}->{$self->{entity}->[-1]->{name}}
3160     ->{is_opened} = false
3161     if $self->{general_entity}->{$self->{entity}->[-1]->{name}};
3162 wakaba 1.6 $self->{token} = pop @{$self->{entity_token}};
3163     $self->{char} = pop @{$self->{entity_char}};
3164 wakaba 1.27 pop (@{$self->{entity}})->{close_file}->();
3165 wakaba 1.14 $self->{location} = $self->{entity}->[-1];
3166 wakaba 1.35
3167     $er-><M::Node.manakaiSetReadOnly> (true, true);
3168 wakaba 1.6 }
3169    
3170     ?lexmode EntityReference;
3171     ?requires-next-token;
3172 wakaba 1.1 }
3173    
3174     // ~ (REFC) { }
3175 wakaba 1.11 } // _GeneralEntityReferenceAE_
3176 wakaba 1.6
3177     /*
3178 wakaba 1.24 General Entity Reference in Literal Entity Value in Entity Declaration
3179 wakaba 1.6 */
3180 wakaba 1.11 rule _GeneralEntityReferenceEV_ ($vals) {
3181 wakaba 1.6 ?lexmode 'EntityReference';
3182    
3183     ~ (Name) {
3184     lang:Perl ($name => $token.value) {
3185 wakaba 1.26 __CODE{checkNCName:: $name => $name}__;
3186 wakaba 1.6 push @$vals, $name;
3187     }
3188 wakaba 1.24 /*
3189     WFCs such as Entity Declared are not checked
3190     <http://www.w3.org/TR/xml11/#bypass>
3191    
3192     Note that violation to the Parsed Entity WFC is an error
3193     rather than fatal error here.
3194     */
3195 wakaba 1.6 }
3196 wakaba 1.11
3197     // No expansion
3198 wakaba 1.6
3199     // ~ (REFC) { }
3200     } // _GeneralEntityReferenceEV_
3201 wakaba 1.1
3202     /*
3203 wakaba 1.4 Document Type Declaration
3204 wakaba 1.1 */
3205 wakaba 1.4 rule _DocumentTypeDeclaration_ ($doc) {
3206     ?lexmode MarkupDeclaration;
3207    
3208     ~ (Name == 'DOCTYPE') { }
3209    
3210     ~ (S) { }
3211    
3212     // Document type name
3213 wakaba 1.6 my $name;
3214 wakaba 1.4 ~ (Name) {
3215 wakaba 1.6 lang:Perl ($v => $token.value) {
3216 wakaba 1.26 __CODE{checkQName:: $name => $v}__;
3217 wakaba 1.6 $name = $v;
3218     }
3219     }
3220 wakaba 1.17
3221     my $node;
3222     my $decl;
3223 wakaba 1.6 lang:Perl {
3224 wakaba 1.11 $self->{docx} = $self->{doc}
3225     -><M::Node.getFeature> (<Q::fe:XDoctype>, '3.0');
3226     $node = $self->{docx}-><M::DocumentXDoctype.createDocumentTypeDefinition>
3227     ($name);
3228 wakaba 1.17 $decl = $self->{dtdecl} = $node-><M::Node.getFeature>
3229     (<Q::fe:XDoctypeDeclaration>, '3.0');
3230 wakaba 1.4 }
3231    
3232 wakaba 1.25 my $has_extid;
3233 wakaba 1.4 ~? (S) {
3234     ~? (Name == 'PUBLIC') {
3235     ~ (S) { }
3236    
3237 wakaba 1.17 &PubidLiteral ($decl => $decl);
3238 wakaba 1.4
3239     ~ (S) { }
3240    
3241 wakaba 1.17 &SystemLiteral ($decl => $decl);
3242 wakaba 1.4
3243     ~? (S) { }
3244 wakaba 1.19
3245     lang:Perl {
3246     $self->{has_xref} = true;
3247 wakaba 1.25 $has_extid = true;
3248 wakaba 1.19 }
3249 wakaba 1.4 } (Name == 'SYSTEM') {
3250     ~ (S) { }
3251    
3252 wakaba 1.17 &SystemLiteral ($decl => $decl);
3253 wakaba 1.4
3254     ~? (S) { }
3255 wakaba 1.19
3256     lang:Perl {
3257     $self->{has_xref} = true;
3258 wakaba 1.25 $has_extid = true;
3259 wakaba 1.19 }
3260 wakaba 1.4 }
3261     }
3262 wakaba 1.17
3263 wakaba 1.11 lang:Perl {
3264     $self->{dtdef} = $node;
3265 wakaba 1.21 $self->{doc}-><M::Node.appendChild> ($node);
3266     $self->{doc_cfg}-><M::c|DOMConfiguration.setParameter>
3267     ('schema-type' => <Q::xml-dtd:>);
3268     ## ISSUE: Should default schema language information be
3269     ## preserved by some other flag?
3270 wakaba 1.11 }
3271    
3272 wakaba 1.4 ~? (DSO) {
3273 wakaba 1.6 &InternalSubset ($doc => $doc, $doctype => $node);
3274 wakaba 1.4
3275     ~ (DSC) {
3276     ?lexmode MarkupDeclaration;
3277     } else {
3278     ?lexmode MarkupDeclaration;
3279     }
3280    
3281     ~? (S) { }
3282     }
3283    
3284 wakaba 1.25 // TODO: Read and process external subset if any.
3285     lang:Perl {
3286     $self->{dont_process} = true if $has_extid;
3287 wakaba 1.35 $node-><M::Node.manakaiSetReadOnly> (true, true);
3288 wakaba 1.25 }
3289    
3290 wakaba 1.4 // ~ (MDC) { }
3291     } // _DocumentTypeDeclaration_
3292    
3293 wakaba 1.17 /*
3294     Public Identifier Literal
3295     */
3296     rule PubidLiteral ($decl) {
3297     my $pubid;
3298     my $pubid_token;
3299 wakaba 1.4 ~ (LIT) {
3300     ?lexmode SystemLiteral;
3301    
3302     ~? (STRING) {
3303 wakaba 1.17 lang:Perl ($v => $token.value) {
3304     $pubid = $v;
3305     $pubid_token = $token;
3306     }
3307 wakaba 1.4 }
3308    
3309     ~ (LIT) {
3310     ?lexmode MarkupDeclaration;
3311     } else {
3312     ?lexmode MarkupDeclaration;
3313     }
3314     } (LITA) {
3315     ?lexmode SystemLiteralA;
3316    
3317     ~? (STRING) {
3318 wakaba 1.17 lang:Perl ($v => $token.value) {
3319     $pubid = $v;
3320     $pubid_token = $token;
3321     }
3322 wakaba 1.4 }
3323    
3324     ~ (LITA) {
3325     ?lexmode MarkupDeclaration;
3326     } else {
3327     ?lexmode MarkupDeclaration;
3328     }
3329     }
3330 wakaba 1.17
3331     if-true ($pubid_token) {
3332     lang:Perl : has-error {
3333     if ($pubid =~ m{[^\x20\x0D\x0Aa-zA-Z0-9'()+,./:=?;!*#\@\$_%-]}s) {
3334     my $location;
3335     __CODE{xp|get-location-from-token::
3336     $token => {$pubid_token},
3337     $result => {$location},
3338     }__;
3339     ## Should this be other (new) error type?
3340     my $continue = __DOMCore:ERROR{xp|wf-syntax-error::
3341     xp|error-token => {$token},
3342     c|location => {$location},
3343     }__;
3344     unless ($continue) {
3345 wakaba 1.27 __CODE{ParseError}__;
3346 wakaba 1.17 }
3347     }
3348    
3349     ## NOTE: U+0009 is syntactically illegal.
3350 wakaba 1.23 $pubid =~ s/[\x09\x0A\x0D\x20]+/\x20/gs;
3351 wakaba 1.17 $pubid =~ s/\A\x20//s;
3352     $pubid =~ s/\x20\z//s;
3353     ## NOTE: Bare attribute name is written.
3354     $decl->public_id ($pubid);
3355     }
3356     }
3357 wakaba 1.4 } // PubidLiteral
3358    
3359 wakaba 1.17 /*
3360     System Identifier Literal
3361     */
3362     rule SystemLiteral ($decl) {
3363 wakaba 1.4 ~ (LIT) {
3364     ?lexmode SystemLiteral;
3365 wakaba 1.17 &_SystemLiteral ($decl => $decl);
3366 wakaba 1.4 } (LITA) {
3367     ?lexmode SystemLiteralA;
3368 wakaba 1.17 &_SystemLiteral ($decl => $decl);
3369 wakaba 1.4 }
3370     } // SystemLiteral
3371    
3372 wakaba 1.17 /*
3373     System Identifier Literal Content
3374 wakaba 1.29
3375     Used in document type declaration, entity declaration,
3376     and notation declaration.
3377 wakaba 1.17 */
3378     rule _SystemLiteral ($decl) {
3379     // LIT or LITA
3380    
3381 wakaba 1.4 ~? (STRING) {
3382 wakaba 1.17 lang:Perl ($v => $token.value) {
3383 wakaba 1.35 $decl-><AS::GE.systemId> ($v);
3384     $decl-><AS::GE.manakaiDeclarationBaseURI>
3385 wakaba 1.29 ($self->{location}->{base_uri});
3386 wakaba 1.17 }
3387 wakaba 1.4 }
3388    
3389     ~ (LIT) {
3390     ?lexmode MarkupDeclaration;
3391     } (LITA) {
3392     ?lexmode MarkupDeclaration;
3393     } else {
3394     ?lexmode MarkupDeclaration;
3395     }
3396     } // _SystemLiteral
3397    
3398     /*
3399     DTD Internal Subset
3400    
3401     intSubset := *(markupdecl / DeclSep) ;; [28b]
3402     */
3403 wakaba 1.6 rule InternalSubset ($doc, $doctype) {
3404 wakaba 1.4 ?lexmode DTD;
3405    
3406     ~* (MDO) {
3407     ?lexmode MarkupDeclaration;
3408    
3409     ~ (Name == 'ELEMENT') {
3410     &_ElementDeclaration ($doc => $doc);
3411     } (Name == 'ATTLIST') {
3412 wakaba 1.8 &_AttlistDeclaration ($doc => $doc, $doctype => $doctype);
3413 wakaba 1.4 } (Name == 'ENTITY') {
3414     &_EntityDeclaration ($doc => $doc);
3415     } (Name == 'NOTATION') {
3416     &_NotationDeclaration ($doc => $doc);
3417     }
3418     } (S) {
3419     //
3420     } (CDO) {
3421     &_CommentDeclarationDTD ($doc => $doc);
3422     } (PIO) {
3423 wakaba 1.6 &_ProcessingInstructionDTD ($doc => $doc, $doctype => $doctype);
3424 wakaba 1.4 } (PERO) {
3425     ?lexmode EntityReference;
3426    
3427 wakaba 1.19 lang:Perl {
3428     $self->{has_xref} = true;
3429 wakaba 1.25 $self->{dont_process} = true;
3430 wakaba 1.19 }
3431    
3432 wakaba 1.4 ~ (Name) {
3433 wakaba 1.26 // TODO: __CODE{checkNCName:: $name => $name}__;
3434 wakaba 1.4
3435     }
3436    
3437     ~ (REFC) {
3438     ?lexmode DTD;
3439     } else {
3440     ?lexmode DTD;
3441     }
3442     }
3443     } // InternalSubset
3444    
3445     rule _ElementDeclaration ($doc) {
3446     // ~ (MDO) { }
3447     // ?lexmode MarkupDeclaration
3448     // ~ (Name == 'Element') { }
3449    
3450     ~ (S) { }
3451    
3452     ~ (Name) {
3453 wakaba 1.26 // TODO: __CODE{checkQName:: $name => $name}__;
3454 wakaba 1.4
3455     }
3456    
3457     ?lexmode ElementDeclaration;
3458    
3459     ~ (S) { }
3460    
3461     // contentspec
3462     ~ (MGO) {
3463     &_ContentModel ($doc => $doc);
3464     } (Name == 'EMPTY') {
3465    
3466     } (Name == 'ANY') {
3467    
3468     }
3469    
3470     ~? (S) { }
3471    
3472     ~ (MDC) {
3473     ?lexmode DTD;
3474     } else {
3475     ?lexmode DTD;
3476     }
3477     } // _ElementDeclaration
3478    
3479     rule _ContentModel ($doc) {
3480     // ~ (MGO) { }
3481    
3482     ~? (S) { }
3483    
3484     ~ (Name) {
3485     // Element content model
3486     &_ModelGroup ($doc => $doc)
3487     : unshift-current-token;
3488    
3489     ~? (OPT) {
3490    
3491     } (REP) {
3492    
3493     } (PLUS) {
3494    
3495     }
3496    
3497     } (MDO) {
3498     &_ModelGroup ($doc => $doc)
3499     : unshift-current-token;
3500    
3501     ~? (OPT) {
3502    
3503     } (REP) {
3504    
3505     } (PLUS) {
3506    
3507     }
3508    
3509     } (PCDATA) {
3510     // Mixed content declaration
3511     ~? (S) { }
3512    
3513     ~* (OR) {
3514     ~? (S) { }
3515    
3516     ~ (Name) {
3517 wakaba 1.26 // TODO: Name & QName check
3518 wakaba 1.4
3519     }
3520    
3521     ~? (S) { }
3522     }
3523    
3524     ~ (MGC) { }
3525    
3526     ~? (REP) {
3527    
3528     } else {
3529     // TODO: error if |Name|
3530     }
3531    
3532    
3533     }
3534     } // _ContentModel
3535    
3536     rule _ModelGroup ($doc)
3537     : standalone
3538     : recursive
3539     {
3540     // ~ (MGO) { }
3541     // ~? (S) { }
3542    
3543     &ContentParticle ($doc => $doc);
3544    
3545     ~? (S) { }
3546    
3547     ~? (OR) {
3548     ~? (S) { }
3549    
3550     &ContentParticle ($doc => $doc);
3551    
3552     ~? (S) { }
3553    
3554     ~* (OR) {
3555     ~? (S) { }
3556    
3557     &ContentParticle ($doc => $doc);
3558    
3559     ~? (S) { }
3560     }
3561    
3562     } (SEQ) {
3563     ~? (S) { }
3564    
3565     &ContentParticle ($doc => $doc);
3566    
3567     ~? (S) { }
3568    
3569     ~* (SEQ) {
3570     ~? (S) { }
3571    
3572     &ContentParticle ($doc => $doc);
3573    
3574     ~? (S) { }
3575     }
3576    
3577     }
3578    
3579     ~ (MGC) { }
3580     } // _ModelGroup
3581    
3582     rule ContentParticle ($doc) {
3583     ~ (Name) {
3584 wakaba 1.26 // TODO: Name & QName check
3585 wakaba 1.4
3586     } (MGO) {
3587     ~? (S) { }
3588    
3589     &_ModelGroup ($doc => $doc);
3590     }
3591    
3592     ~? (OPT) {
3593    
3594     } (REP) {
3595    
3596     } (PLUS) {
3597    
3598     }
3599     } // ContentParticle
3600    
3601 wakaba 1.8 /*
3602     Attribute list declaration
3603     */
3604     rule _AttlistDeclaration ($doc, $doctype) {
3605 wakaba 1.4 // ~ (MDO) { }
3606     // ~ (Name == 'ATTLIST') { }
3607    
3608     ?lexmode AttlistDeclaration;
3609    
3610     ~ (S) { }
3611    
3612 wakaba 1.8 my $name;
3613 wakaba 1.4 ~ (Name) {
3614 wakaba 1.8 lang:Perl ($v => $token.value) {
3615 wakaba 1.26 __CODE{checkQName:: $name => $v}__;
3616 wakaba 1.8 $name = $v;
3617     }
3618     } else {
3619     lang:Perl { $name = '#ILLEGAL' }
3620     }
3621 wakaba 1.4
3622 wakaba 1.8 my $docxd;
3623     my $et;
3624     lang:Perl {
3625     $et = $doctype-><M::DTDef.getElementTypeDefinitionNode> ($name);
3626     unless ($et) {
3627 wakaba 1.11 $docxd = $doc-><M::Node.getFeature> (<Q::fe:XDoctype>, '3.0');
3628 wakaba 1.8 $et = $docxd-><M::DocumentXDoctype.createElementTypeDefinition>
3629     ($name);
3630     $doctype-><M::DTDef.setElementTypeDefinitionNode> ($et)
3631     unless $name eq '#ILLEGAL';
3632     }
3633 wakaba 1.4 }
3634    
3635     ~? (S) { }
3636    
3637     ~* (Name) {
3638 wakaba 1.8 my $at;
3639 wakaba 1.25 lang:Perl ($v => $token.value) : has-error {
3640 wakaba 1.26 __CODE{checkQName:: $name => $v}__;
3641 wakaba 1.8 $docxd ||= $doc-><M::Node.getFeature>
3642 wakaba 1.11 (<Q::fe:XDoctype>, '3.0');
3643 wakaba 1.8 $at = $docxd-><M::DocumentXDoctype.createAttributeDefinition> ($v);
3644 wakaba 1.25 if (exists $et-><AG::ETDef.attributeDefinitions>->{$v}) {
3645     my $location;
3646     __CODE{xp|get-location-from-token::
3647     $token => {$token},
3648     $result => {$location},
3649     }__;
3650     my $continue = __c|ERROR{xp|warning-attribute-definition-ignored::
3651     xp|error-token => {$token},
3652     c|location => {$location},
3653     xp|name => {$v},
3654     }__;
3655     unless ($continue) {
3656 wakaba 1.27 __CODE{ParseError}__;
3657 wakaba 1.25 }
3658     } elsif ($self->{dont_process} and not $self->{standalone}) {
3659     my $location;
3660     __CODE{xp|get-location-from-token::
3661     $token => {$token},
3662     $result => {$location},
3663     }__;
3664     my $continue = __c|ERROR{
3665     xp|warning-attribute-definition-not-processed::
3666     xp|error-token => {$token},
3667     c|location => {$location},
3668     xp|name => {$v},
3669     }__;
3670     unless ($continue) {
3671 wakaba 1.27 __CODE{ParseError}__;
3672 wakaba 1.25 }
3673     } else {
3674 wakaba 1.9 $et-><M::ETDef.setAttributeDefinitionNode> ($at);
3675     $self->{attr}->{$name}->{$v} = $at;
3676     }
3677 wakaba 1.8 }
3678 wakaba 1.4
3679     ~ (S) { }
3680    
3681     // AttType
3682     ~ (Name == 'NOTATION') {
3683     ~ (S) { }
3684    
3685 wakaba 1.8 my $kwd;
3686     lang:Perl {
3687     $at-><AS::ATDef.declaredType> (<C::ATDef.NOTATION_ATTR>);
3688     $kwd = $at-><AG::ATDef.allowedTokens>;
3689     }
3690    
3691 wakaba 1.4 ~ (EGO) {
3692     ~? (S) { }
3693    
3694 wakaba 1.8 ~+ (Name) {
3695 wakaba 1.26 lang:Perl ($v => $token.value) : has-error {
3696     __CODE{checkNCName:: $name => $v}__;
3697 wakaba 1.8 push @$kwd, $v;
3698     }
3699 wakaba 1.4
3700     ~? (S) { }
3701     } (OR) : separator {
3702     ~? (S) { }
3703     }
3704    
3705     ~ (EGC) { }
3706     }
3707 wakaba 1.8
3708 wakaba 1.4 } (Name) {
3709 wakaba 1.8 my $type;
3710     lang:Perl ($v => $token.value) : has-error {
3711     my $map = {
3712     CDATA => <C::ATDef.CDATA_ATTR>,
3713     ID => <C::ATDef.ID_ATTR>,
3714     IDREF => <C::ATDef.IDREF_ATTR>,
3715     IDREFS => <C::ATDef.IDREFS_ATTR>,
3716     ENTITY => <C::ATDef.ENTITY_ATTR>,
3717     ENTITIES => <C::ATDef.ENTITIES_ATTR>,
3718     NMTOKEN => <C::ATDef.NMTOKEN_ATTR>,
3719     NMTOKENS => <C::ATDef.NMTOKENS_ATTR>,
3720     };
3721     if ($map->{$v}) {
3722     $at-><AS::ATDef.declaredType> ($map->{$v});
3723     } else {
3724     ## TODO: Exception
3725     }
3726     }
3727 wakaba 1.4
3728     } (EGO) {
3729     ?lexmode Enumeration;
3730    
3731     ~? (S) { }
3732    
3733 wakaba 1.8 my $kwd;
3734     lang:Perl {
3735     $at-><AS::ATDef.declaredType> (<C::ATDef.ENUMERATION_ATTR>);
3736     $kwd = $at-><AG::ATDef.allowedTokens>;
3737     }
3738    
3739     ~+ (Nmtoken) {
3740     lang:Perl ($v => $token.value) {
3741     push @$kwd, $v;
3742     }
3743 wakaba 1.4
3744     ~? (S) { }
3745     } (OR) : separator {
3746     ~? (S) { }
3747     }
3748    
3749     ~ (EGC) {
3750     ?lexmode AttlistDeclaration;
3751     } else {
3752     ?lexmode AttlistDeclaration;
3753     }
3754    
3755     }
3756    
3757     ~ (S) { }
3758    
3759     // DefaultDecl
3760     ~ (RNI) {
3761     ~ (Name == 'REQUIRED') {
3762 wakaba 1.8 lang:Perl {
3763     $at-><AS::ATDef.defaultType> (<C::ATDef.REQUIRED_DEFAULT>);
3764     }
3765 wakaba 1.4 } (Name == 'IMPLIED') {
3766 wakaba 1.8 lang:Perl {
3767     $at-><AS::ATDef.defaultType> (<C::ATDef.IMPLIED_DEFAULT>);
3768     }
3769 wakaba 1.4 } (Name == 'FIXED') {
3770     ~ (S) { }
3771 wakaba 1.8
3772     lang:Perl {
3773     $at-><AS::ATDef.defaultType> (<C::ATDef.FIXED_DEFAULT>);
3774     }
3775 wakaba 1.4
3776     ~ (LIT) {
3777     my $vals;
3778     lang:Perl {
3779 wakaba 1.8 $vals = {nodes => [], value => ''};
3780 wakaba 1.4 }
3781    
3782     &_AttributeValueSpecification_ ($doc => $doc, $vals => $vals);
3783    
3784 wakaba 1.8 lang:Perl {
3785     for (@{$vals->{nodes}}) {
3786     $at-><M::Node.appendChild> ($_);
3787     }
3788     }
3789    
3790 wakaba 1.4 ~ (LIT) {
3791     ?lexmode AttlistDeclaration;
3792     } else {
3793     ?lexmode AttlistDeclaration;
3794     }
3795     } (LITA) {
3796     my $vals;
3797     lang:Perl {
3798 wakaba 1.8 $vals = {nodes => [], value => ''};
3799 wakaba 1.4 }
3800    
3801     &_AttributeValueSpecificationA_ ($doc => $doc, $vals => $vals);
3802    
3803 wakaba 1.8 lang:Perl {
3804     for (@{$vals->{nodes}}) {
3805     $at-><M::Node.appendChild> ($_);
3806     }
3807     }
3808    
3809     ~ (LITA) {
3810 wakaba 1.4 ?lexmode AttlistDeclaration;
3811     } else {
3812     ?lexmode AttlistDeclaration;
3813     }
3814     }
3815     }
3816    
3817     } (LIT) {
3818     my $vals;
3819     lang:Perl {
3820 wakaba 1.8 $at-><AS::ATDef.defaultType> (<C::ATDef.EXPLICIT_DEFAULT>);
3821     $vals = {nodes => [], value => ''};
3822 wakaba 1.4 }
3823    
3824     &_AttributeValueSpecification_ ($doc => $doc, $vals => $vals);
3825    
3826 wakaba 1.8 lang:Perl {
3827     for (@{$vals->{nodes}}) {
3828     $at-><M::Node.appendChild> ($_);
3829     }
3830     }
3831    
3832 wakaba 1.4 ~ (LIT) {
3833     ?lexmode AttlistDeclaration;
3834     } else {
3835     ?lexmode AttlistDeclaration;
3836     }
3837     } (LITA) {
3838     my $vals;
3839     lang:Perl {
3840 wakaba 1.8 $at-><AS::ATDef.defaultType> (<C::ATDef.EXPLICIT_DEFAULT>);
3841     $vals = {nodes => [], value => ''};
3842 wakaba 1.4 }
3843    
3844     &_AttributeValueSpecificationA_ ($doc => $doc, $vals => $vals);
3845    
3846 wakaba 1.8 lang:Perl {
3847     for (@{$vals->{nodes}}) {
3848     $at-><M::Node.appendChild> ($_);
3849     }
3850     }
3851    
3852 wakaba 1.4 ~ (LITA) {
3853     ?lexmode AttlistDeclaration;
3854     } else {
3855     ?lexmode AttlistDeclaration;
3856     }
3857     }
3858    
3859     } (S) : separator : terminator? {
3860     //
3861     }
3862    
3863     ~ (MDC) {
3864     ?lexmode DTD;
3865     } else {
3866     ?lexmode DTD;
3867     }
3868     } // _AttlistDeclaration
3869    
3870 wakaba 1.11 /*
3871 wakaba 1.26 Entity Declaration
3872 wakaba 1.11 */
3873 wakaba 1.4 rule _EntityDeclaration ($doc) {
3874     // ~ (MDO) { }
3875     // ~ (Name == ENTITY) { }
3876    
3877     ~ (S) { }
3878    
3879 wakaba 1.23 my $is_param_entity;
3880 wakaba 1.6 my $decl;
3881 wakaba 1.27 lang:Perl {
3882     $decl = {
3883     name => '#ILLEGAL',
3884     reptxt => \'',
3885     is_external_entity => false,
3886     document_uri => $self->{location}->{document_uri},
3887     base_uri => $self->{location}->{base_uri},
3888     };
3889     }
3890 wakaba 1.6
3891 wakaba 1.4 ~? (PERO) {
3892     ~ (S) { }
3893 wakaba 1.6 lang:Perl {
3894 wakaba 1.23 $is_param_entity = $decl->{is_param_entity} = true;
3895 wakaba 1.6 }
3896 wakaba 1.4 }
3897    
3898 wakaba 1.19 /*
3899     TODO: Set |$decl->{is_externally_declared}| flag
3900     and |Entity.isExternallyDeclared| attribute
3901     for entity declarations in external subset or
3902     in parameter entity.
3903     */
3904    
3905 wakaba 1.4 ~ (Name) {
3906 wakaba 1.6 lang:Perl ($v => $token.value) {
3907 wakaba 1.26 __CODE{checkNCName:: $name => $v}__;
3908 wakaba 1.6 $decl->{name} = $v;
3909     }
3910 wakaba 1.4 }
3911    
3912 wakaba 1.18 my $node;
3913 wakaba 1.11 lang:Perl {
3914 wakaba 1.18 $node =
3915 wakaba 1.11 $decl->{node} = $self->{docx}-><M::DocumentXDoctype.createGeneralEntity>
3916     ($decl->{name});
3917     ## TODO: Parameter entity...
3918     }
3919    
3920 wakaba 1.4 ~ (S) { }
3921    
3922     ~ (LIT) {
3923 wakaba 1.6 &_EntityValue ($doc => $doc, $decl => $decl);
3924 wakaba 1.4 } (LITA) {
3925 wakaba 1.6 &_EntityValueA ($doc => $doc, $decl => $decl);
3926 wakaba 1.4 } (Name == 'PUBLIC') {
3927     ~ (S) { }
3928    
3929 wakaba 1.18 &PubidLiteral ($decl => $node);
3930 wakaba 1.4
3931     ~ (S) { }
3932    
3933 wakaba 1.18 &SystemLiteral ($decl => $node);
3934    
3935     lang:Perl {
3936     $decl->{is_external_entity} = true;
3937     }
3938 wakaba 1.4 } (Name == 'SYSTEM') {
3939     ~ (S) { }
3940    
3941 wakaba 1.18 &SystemLiteral ($decl => $node);
3942    
3943     lang:Perl {
3944     $decl->{is_external_entity} = true;
3945     }
3946 wakaba 1.4 }
3947    
3948     ~? (S) {
3949     ~? (Name == 'NDATA') {
3950 wakaba 1.23 if-true ($is_param_entity) {
3951     lang:Perl : has-error {
3952     my $location;
3953     __CODE{xp|get-location-from-token::
3954     $token => {$token},
3955     $result => {$location},
3956     }__;
3957     my $continue = __DOMCore:ERROR{xp|wf-syntax-error::
3958     xp|error-token => {$token},
3959     c|location => {$location},
3960     }__;
3961     unless ($continue) {
3962 wakaba 1.27 __CODE{ParseError}__;
3963 wakaba 1.23 }
3964     }
3965     }
3966 wakaba 1.4
3967     ~ (S) { }
3968    
3969     ~ (Name) {
3970 wakaba 1.26 lang:Perl ($v => $token.value) : has-error {
3971     __CODE{checkNCName:: $name => $v}__;
3972 wakaba 1.6 $decl->{notation} = $v;
3973 wakaba 1.35 $decl->{node}-><AG::GE.notationName> ($v);
3974 wakaba 1.6 }
3975 wakaba 1.4 }
3976    
3977     ~? (S) { }
3978     }
3979     }
3980    
3981 wakaba 1.24 lang:Perl : has-error {
3982 wakaba 1.6 if ($self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'}
3983     ->{$decl->{name}}) {
3984 wakaba 1.24 ## Predefined entity
3985     if (not $decl->{is_param_entity} and
3986     {lt => true, gt => true, amp => true,
3987     quot => true, apos => true}->{$decl->{name}}) {
3988     if ($decl->{is_external_entity}) {
3989     my $location;
3990     __CODE{xp|get-location-from-token::
3991     $token => {$token},
3992     $result => {$location},
3993     }__;
3994     my $continue = __c|ERROR{xp|error-internal-predefined-entity::
3995     xp|error-token => {$token},
3996     c|location => {$location},
3997     xp|name => {$decl->{name}},
3998     }__;
3999     unless ($continue) {
4000 wakaba 1.27 __CODE{ParseError}__;
4001 wakaba 1.24 }
4002     } elsif (
4003     not ({gt => true, apos => true, quot => true}->{$decl->{name}} and
4004     ${$decl->{reptxt}} eq {
4005     gt => '>', apos => "'", quot => '"',
4006     }->{$decl->{name}}) and
4007     not (${$decl->{reptxt}} =~ /\A&#0*@{[{
4008     lt => '60', gt => '62', amp => '38',
4009     apos => '39', quot => '34',
4010     }->{$decl->{name}}]};\z/) and
4011     not (${$decl->{reptxt}} =~ /\A&#x0*(?:(?i)@{[{
4012     lt => '3C', gt => '3E', amp => '26',
4013     apos => '27', quot => '22',
4014     }->{$decl->{name}}]});\z/)
4015     ) {
4016     ## NOTE: See "SuikaWiki - Predefined Entities"
4017     ## "http://suika.fam.cx/gate/2005/sw/%E5%AE%9A%E7%BE%A9%E6%B8%88%E5%AE%9F%E4%BD%93".
4018     my $location;
4019     __CODE{xp|get-location-from-token::
4020     $token => {$token},
4021     $result => {$location},
4022     }__;
4023     my $continue = __c|ERROR{xp|error-malformed-predefined-entity::
4024     xp|error-token => {$token},
4025     c|location => {$location},
4026     xp|name => {$decl->{name}},
4027     xp|replacement-text => {${$decl->{reptxt}}},
4028     }__;
4029     unless ($continue) {
4030 wakaba 1.27 __CODE{ParseError}__;
4031 wakaba 1.24 }
4032     }
4033 wakaba 1.44 ${$self->{dtdecl}}->{{
4034 wakaba 1.25 lt => <H::d|hasLtDeclaration>,
4035     gt => <H::d|hasGtDeclaration>,
4036     amp => <H::d|hasAmpDeclaration>,
4037     apos => <H::d|hasAposDeclaration>,
4038     quot => <H::d|hasQuotDeclaration>,
4039     }->{$decl->{name}}} = true;
4040 wakaba 1.24 } else { ## Dupulicating declaration
4041     my $location;
4042     __CODE{xp|get-location-from-token::
4043     $token => {$token},
4044     $result => {$location},
4045     }__;
4046     my $continue = __c|ERROR{xp|warning-entity-declaration-ignored::
4047     xp|error-token => {$token},
4048     c|location => {$location},
4049     xp|name => {$decl->{name}},
4050     }__;
4051     unless ($continue) {
4052 wakaba 1.27 __CODE{ParseError}__;
4053 wakaba 1.24 }
4054     }
4055 wakaba 1.25 } elsif ($self->{dont_process} and not $self->{standalone}) {
4056     ## TODO: |standalone| and parameter entities??
4057     my $location;
4058     __CODE{xp|get-location-from-token::
4059     $token => {$token},
4060     $result => {$location},
4061     }__;
4062     my $continue = __c|ERROR{xp|warning-entity-declaration-not-processed::
4063     xp|error-token => {$token},
4064     c|location => {$location},
4065     xp|name => {$decl->{name}},
4066     }__;
4067     unless ($continue) {
4068 wakaba 1.27 __CODE{ParseError}__;
4069 wakaba 1.25 }
4070 wakaba 1.6 } else {
4071     $self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'}
4072     ->{$decl->{name}} = $decl;
4073 wakaba 1.11 $self->{dtdef}-><M::DTDef.setGeneralEntityNode> ($decl->{node})
4074     unless $decl->{is_param_entity};
4075 wakaba 1.6 }
4076     }
4077    
4078 wakaba 1.4 ~ (MDC) {
4079     ?lexmode DTD;
4080     } else {
4081     ?lexmode DTD;
4082     }
4083     } // _EntityDeclaration
4084    
4085 wakaba 1.26 /*
4086     Notation Declaration
4087     */
4088     rule _NotationDeclaration {
4089 wakaba 1.4 // ~ (MDO) { }
4090     // ~ (Name == NOTATION) { }
4091    
4092     ~ (S) { }
4093    
4094 wakaba 1.26 my $name;
4095 wakaba 1.4 ~ (Name) {
4096 wakaba 1.26 lang:Perl ($v => $token.value) : has-error {
4097     __CODE{checkNCName:: $name => $v}__;
4098     $name = $v;
4099     }
4100     } else {
4101     lang:Perl {
4102     $name = '#INVALID';
4103     }
4104     }
4105 wakaba 1.4
4106     ~ (S) { }
4107    
4108 wakaba 1.17 lang:Perl {
4109 wakaba 1.26 $decl = $self->{docx}-><M::DocumentXDoctype.createNotation> ($name);
4110 wakaba 1.17 }
4111    
4112 wakaba 1.4 ~ (Name == 'PUBLIC') {
4113     ~ (S) { }
4114    
4115 wakaba 1.17 &PubidLiteral ($decl => $decl);
4116 wakaba 1.4
4117     ~? (S) {
4118     ~? (LIT) {
4119     ?lexmode SystemLiteral;
4120 wakaba 1.17 &_SystemLiteral ($decl => $decl);
4121 wakaba 1.4
4122     ~? (S) { }
4123     } (LITA) {
4124     ?lexmode SystemLiteralA;
4125 wakaba 1.17 &_SystemLiteral ($decl => $decl);
4126 wakaba 1.4
4127     ~? (S) { }
4128     }
4129     }
4130     } (Name == 'SYSTEM') {
4131     ~ (S) { }
4132    
4133 wakaba 1.17 &SystemLiteral ($decl => $decl);
4134 wakaba 1.4
4135     ~? (S) { }
4136     }
4137    
4138 wakaba 1.26 lang:Perl : has-error {
4139     if ($self->{dtdef}-><M::DTDef.getNotationNode> ($name)) {
4140     ## Dupulication
4141     my $location;
4142     __CODE{xp|get-location-from-token::
4143     $token => {$token},
4144     $result => {$location},
4145     }__;
4146     my $continue = __c|ERROR{xp|vc-unique-notation-name::
4147     xp|error-token => {$token},
4148     c|location => {$location},
4149     xp|name => {$name},
4150     }__;
4151     unless ($continue) {
4152 wakaba 1.27 __CODE{ParseError}__;
4153 wakaba 1.26 }
4154     } else {
4155     $self->{dtdef}-><M::DTDef.setNotationNode> ($decl);
4156     }
4157     }
4158    
4159 wakaba 1.4 ~ (MDC) {
4160     ?lexmode DTD;
4161     } else {
4162     ?lexmode DTD;
4163     }
4164     } // _NotationDeclaration
4165    
4166 wakaba 1.11 rule _EntityValue ($decl) {
4167 wakaba 1.4 ?lexmode EntityValue;
4168    
4169     my $vals;
4170 wakaba 1.6 my $reptxt;
4171 wakaba 1.4 lang:Perl {
4172     $vals = [];
4173 wakaba 1.6 $reptxt = '';
4174 wakaba 1.4 }
4175    
4176     ~* (STRING) {
4177 wakaba 1.6 lang:Perl ($v => $token.value) {
4178     $reptxt .= $v;
4179     }
4180 wakaba 1.4 } (PERO) {
4181 wakaba 1.25 ?lexmode EntityReference;
4182 wakaba 1.19
4183     lang:Perl {
4184     $self->{has_xref} = true;
4185 wakaba 1.25 $self->{dont_process} = true;
4186 wakaba 1.19 }
4187 wakaba 1.6
4188     // TODO: Expand or wferror if internal subset
4189 wakaba 1.4
4190     ~ (Name) {
4191    
4192 wakaba 1.25 // Note that external subset and parameter entities are not supported
4193     lang:Perl ($name => $token.value) : has-error {
4194 wakaba 1.26 __CODE{checkNCName:: $name => $name}__;
4195 wakaba 1.25 my $location;
4196     __CODE{xp|get-location-from-token::
4197     $token => {$token},
4198     $result => {$location},
4199     }__;
4200     my $continue = __c|ERROR{xp|wf-pes-in-internal-subset::
4201     xp|error-token => {$token},
4202     c|location => {$location},
4203     xp|name => {$name},
4204     }__;
4205     unless ($continue) {
4206 wakaba 1.27 __CODE{ParseError}__;
4207 wakaba 1.25 }
4208     }
4209 wakaba 1.4 }
4210    
4211     ~ (REFC) {
4212     ?lexmode EntityValue;
4213     } else {
4214     ?lexmode EntityValue;
4215     }
4216     } (HCRO) {
4217 wakaba 1.11 &_HexadecimalCharacterReferenceEV_ ($vals => $vals);
4218 wakaba 1.4
4219 wakaba 1.6 lang:Perl {
4220 wakaba 1.11 $reptxt .= $vals->[-1];
4221 wakaba 1.6 }
4222    
4223 wakaba 1.4 ~ (REFC) {
4224     ?lexmode EntityValue;
4225     } else {
4226     ?lexmode EntityValue;
4227     }
4228     } (CRO) {
4229 wakaba 1.11 &_NumericCharacterReferenceEV_ ($vals => $vals);
4230 wakaba 1.6
4231     lang:Perl {
4232 wakaba 1.11 $reptxt .= $vals->[-1];
4233 wakaba 1.6 }
4234 wakaba 1.4
4235     ~ (REFC) {
4236     ?lexmode EntityValue;
4237     } else {
4238     ?lexmode EntityValue;
4239     }
4240     } (ERO) {
4241 wakaba 1.11 &_GeneralEntityReferenceEV_ ($vals => $vals);
4242 wakaba 1.4
4243 wakaba 1.6 lang:Perl {
4244 wakaba 1.11 $reptxt .= '&' . $vals->[-1] . ';';
4245 wakaba 1.6 }
4246    
4247 wakaba 1.4 ~ (REFC) {
4248     ?lexmode EntityValue;
4249     } else {
4250     ?lexmode EntityValue;
4251     }
4252     }
4253    
4254     ~ (LIT) {
4255     ?lexmode MarkupDeclaration;
4256     } (LITA) {
4257     ?lexmode MarkupDeclaration;
4258     } else {
4259     ?lexmode MarkupDeclaration;
4260     }
4261 wakaba 1.6
4262     lang:Perl {
4263     $decl->{reptxt} = \$reptxt;
4264 wakaba 1.19 $decl->{has_replacement_text} = true;
4265 wakaba 1.6 }
4266 wakaba 1.4 } // _EntityValue
4267    
4268 wakaba 1.11 rule _EntityValueA ($decl) {
4269 wakaba 1.4 ?lexmode EntityValueA;
4270    
4271     my $vals;
4272 wakaba 1.6 my $reptxt;
4273 wakaba 1.4 lang:Perl {
4274     $vals = [];
4275 wakaba 1.6 $reptxt = '';
4276 wakaba 1.4 }
4277    
4278     ~* (STRING) {
4279 wakaba 1.6 lang:Perl ($v => $token.value) {
4280     $reptxt .= $v;
4281     }
4282 wakaba 1.4 } (PERO) {
4283 wakaba 1.25 ?lexmode EntityReference;
4284 wakaba 1.4
4285 wakaba 1.19 lang:Perl {
4286     $self->{has_xref} = true;
4287 wakaba 1.25 $self->{dont_process} = true;
4288 wakaba 1.19 }
4289    
4290 wakaba 1.6 // TODO: implement this
4291 wakaba 1.4 ~ (Name) {
4292    
4293 wakaba 1.25 // Note that external subset and parameter entities are not supported
4294     lang:Perl ($name => $token.value) : has-error {
4295 wakaba 1.26 __CODE{checkNCName:: $name => $name}__;
4296 wakaba 1.25 my $location;
4297     __CODE{xp|get-location-from-token::
4298     $token => {$token},
4299     $result => {$location},
4300     }__;
4301     my $continue = __c|ERROR{xp|wf-pes-in-internal-subset::
4302     xp|error-token => {$token},
4303     c|location => {$location},
4304     xp|name => {$name},
4305     }__;
4306     unless ($continue) {
4307 wakaba 1.27 __CODE{ParseError}__;
4308 wakaba 1.25 }
4309     }
4310 wakaba 1.4 }
4311    
4312     ~ (REFC) {
4313     ?lexmode EntityValueA;
4314     } else {
4315     ?lexmode EntityValueA;
4316     }
4317     } (HCRO) {
4318 wakaba 1.11 &_HexadecimalCharacterReferenceEV_ ($vals => $vals);
4319 wakaba 1.4
4320 wakaba 1.6 lang:Perl {
4321 wakaba 1.11 $reptxt .= $vals->[-1];
4322 wakaba 1.6 }
4323    
4324    
4325 wakaba 1.4 ~ (REFC) {
4326     ?lexmode EntityValueA;
4327     } else {
4328     ?lexmode EntityValueA;
4329     }
4330     } (CRO) {
4331 wakaba 1.11 &_NumericCharacterReferenceEV_ ($vals => $vals);
4332 wakaba 1.4
4333 wakaba 1.6 lang:Perl {
4334 wakaba 1.11 $reptxt .= $vals->[-1];
4335 wakaba 1.6 }
4336    
4337 wakaba 1.4 ~ (REFC) {
4338     ?lexmode EntityValueA;
4339     } else {
4340     ?lexmode EntityValueA;
4341     }
4342     } (ERO) {
4343 wakaba 1.11 &_GeneralEntityReferenceEV_ ($vals => $vals);
4344 wakaba 1.4
4345 wakaba 1.6 lang:Perl {
4346 wakaba 1.11 $reptxt .= '&' . $vals->[-1] . ';';
4347 wakaba 1.6 }
4348    
4349 wakaba 1.4 ~ (REFC) {
4350     ?lexmode EntityValueA;
4351     } else {
4352     ?lexmode EntityValueA;
4353     }
4354     }
4355    
4356     ~ (LITA) {
4357     ?lexmode MarkupDeclaration;
4358     } else {
4359     ?lexmode MarkupDeclaration;
4360     }
4361 wakaba 1.6
4362     lang:Perl {
4363     $decl->{reptxt} = \$reptxt;
4364 wakaba 1.19 $decl->{has_replacement_text} = true;
4365 wakaba 1.6 }
4366 wakaba 1.4 } // _EntityValueA
4367    
4368    
4369     /*
4370     XML Name
4371     */
4372     lexmode NameChar {
4373     $NameStartChar10 := [
4374     '_' ':'
4375     // Letter
4376     // BaseChar
4377     U+0041..U+005A U+0061..U+007A U+00C0..U+00D6
4378     U+00D8..U+00F6 U+00F8..U+00FF U+0100..U+0131
4379     U+0134..U+013E U+0141..U+0148 U+014A..U+017E
4380     U+0180..U+01C3 U+01CD..U+01F0 U+01F4..U+01F5
4381     U+01FA..U+0217 U+0250..U+02A8 U+02BB..U+02C1
4382     U+0386 U+0388..U+038A U+038C U+038E..U+03A1
4383     U+03A3..U+03CE U+03D0..U+03D6 U+03DA U+03DC
4384     U+03DE U+03E0 U+03E2..U+03F3 U+0401..U+040C
4385     U+040E..U+044F U+0451..U+045C U+045E..U+0481
4386     U+0490..U+04C4 U+04C7..U+04C8 U+04CB..U+04CC
4387     U+04D0..U+04EB U+04EE..U+04F5 U+04F8..U+04F9
4388     U+0531..U+0556 U+0559 U+0561..U+0586
4389     U+05D0..U+05EA U+05F0..U+05F2 U+0621..U+063A
4390     U+0641..U+064A U+0671..U+06B7 U+06BA..U+06BE
4391     U+06C0..U+06CE U+06D0..U+06D3 U+06D5
4392     U+06E5..U+06E6 U+0905..U+0939 U+093D
4393     U+0958..U+0961 U+0985..U+098C U+098F..U+0990
4394     U+0993..U+09A8 U+09AA..U+09B0 U+09B2
4395     U+09B6..U+09B9 U+09DC..U+09DD U+09DF..U+09E1
4396     U+09F0..U+09F1 U+0A05..U+0A0A U+0A0F..U+0A10
4397     U+0A13..U+0A28 U+0A2A..U+0A30 U+0A32..U+0A33
4398     U+0A35..U+0A36 U+0A38..U+0A39 U+0A59..U+0A5C
4399     U+0A5E U+0A72..U+0A74 U+0A85..U+0A8B U+0A8D
4400     U+0A8F..U+0A91 U+0A93..U+0AA8 U+0AAA..U+0AB0
4401     U+0AB2..U+0AB3 U+0AB5..U+0AB9 U+0ABD U+0AE0
4402     U+0B05..U+0B0C U+0B0F..U+0B10 U+0B13..U+0B28
4403     U+0B2A..U+0B30 U+0B32..U+0B33 U+0B36..U+0B39
4404     U+0B3D U+0B5C..U+0B5D U+0B5F..U+0B61
4405     U+0B85..U+0B8A U+0B8E..U+0B90 U+0B92..U+0B95
4406     U+0B99..U+0B9A U+0B9C U+0B9E..U+0B9F
4407     U+0BA3..U+0BA4 U+0BA8..U+0BAA U+0BAE..U+0BB5
4408     U+0BB7..U+0BB9 U+0C05..U+0C0C U+0C0E..U+0C10
4409     U+0C12..U+0C28 U+0C2A..U+0C33 U+0C35..U+0C39
4410     U+0C60..U+0C61 U+0C85..U+0C8C U+0C8E..U+0C90
4411     U+0C92..U+0CA8 U+0CAA..U+0CB3 U+0CB5..U+0CB9
4412     U+0CDE U+0CE0..U+0CE1 U+0D05..U+0D0C
4413     U+0D0E..U+0D10 U+0D12..U+0D28 U+0D2A..U+0D39
4414     U+0D60..U+0D61 U+0E01..U+0E2E U+0E30
4415     U+0E32..U+0E33 U+0E40..U+0E45 U+0E81..U+0E82
4416     U+0E84 U+0E87..U+0E88 U+0E8A U+0E8D
4417     U+0E94..U+0E97 U+0E99..U+0E9F U+0EA1..U+0EA3
4418     U+0EA5 U+0EA7 U+0EAA..U+0EAB U+0EAD..U+0EAE
4419     U+0EB0 U+0EB2..U+0EB3 U+0EBD U+0EC0..U+0EC4
4420     U+0F40..U+0F47 U+0F49..U+0F69 U+10A0..U+10C5
4421     U+10D0..U+10F6 U+1100 U+1102..U+1103
4422     U+1105..U+1107 U+1109 U+110B..U+110C
4423     U+110E..U+1112 U+113C U+113E U+1140 U+114C
4424     U+114E U+1150 U+1154..U+1155 U+1159
4425     U+115F..U+1161 U+1163 U+1165 U+1167 U+1169
4426     U+116D..U+116E U+1172..U+1173 U+1175 U+119E
4427     U+11A8 U+11AB U+11AE..U+11AF U+11B7..U+11B8
4428     U+11BA U+11BC..U+11C2 U+11EB U+11F0 U+11F9
4429     U+1E00..U+1E9B U+1EA0..U+1EF9 U+1F00..U+1F15
4430     U+1F18..U+1F1D U+1F20..U+1F45 U+1F48..U+1F4D
4431     U+1F50..U+1F57 U+1F59 U+1F5B U+1F5D
4432     U+1F5F..U+1F7D U+1F80..U+1FB4 U+1FB6..U+1FBC
4433     U+1FBE U+1FC2..U+1FC4 U+1FC6..U+1FCC
4434     U+1FD0..U+1FD3 U+1FD6..U+1FDB U+1FE0..U+1FEC
4435     U+1FF2..U+1FF4 U+1FF6..U+1FFC U+2126
4436     U+212A..U+212B U+212E U+2180..U+2182
4437     U+3041..U+3094 U+30A1..U+30FA U+3105..U+312C
4438     U+AC00..U+D7A3
4439     // Ideographic
4440     U+4E00..U+9FA5 U+3007 U+3021..U+3029
4441     ];
4442     $NameChar10 := [
4443     '.' '-' '_' ':'
4444     // Letter
4445     // BaseChar
4446     U+0041..U+005A U+0061..U+007A U+00C0..U+00D6
4447     U+00D8..U+00F6 U+00F8..U+00FF U+0100..U+0131
4448     U+0134..U+013E U+0141..U+0148 U+014A..U+017E
4449     U+0180..U+01C3 U+01CD..U+01F0 U+01F4..U+01F5
4450     U+01FA..U+0217 U+0250..U+02A8 U+02BB..U+02C1
4451     U+0386 U+0388..U+038A U+038C U+038E..U+03A1
4452     U+03A3..U+03CE U+03D0..U+03D6 U+03DA U+03DC
4453     U+03DE U+03E0 U+03E2..U+03F3 U+0401..U+040C
4454     U+040E..U+044F U+0451..U+045C U+045E..U+0481
4455     U+0490..U+04C4 U+04C7..U+04C8 U+04CB..U+04CC
4456     U+04D0..U+04EB U+04EE..U+04F5 U+04F8..U+04F9
4457     U+0531..U+0556 U+0559 U+0561..U+0586
4458     U+05D0..U+05EA U+05F0..U+05F2 U+0621..U+063A
4459     U+0641..U+064A U+0671..U+06B7 U+06BA..U+06BE
4460     U+06C0..U+06CE U+06D0..U+06D3 U+06D5
4461     U+06E5..U+06E6 U+0905..U+0939 U+093D
4462     U+0958..U+0961 U+0985..U+098C U+098F..U+0990
4463     U+0993..U+09A8 U+09AA..U+09B0 U+09B2
4464     U+09B6..U+09B9 U+09DC..U+09DD U+09DF..U+09E1
4465     U+09F0..U+09F1 U+0A05..U+0A0A U+0A0F..U+0A10
4466     U+0A13..U+0A28 U+0A2A..U+0A30 U+0A32..U+0A33
4467     U+0A35..U+0A36 U+0A38..U+0A39 U+0A59..U+0A5C
4468     U+0A5E U+0A72..U+0A74 U+0A85..U+0A8B U+0A8D
4469     U+0A8F..U+0A91 U+0A93..U+0AA8 U+0AAA..U+0AB0
4470     U+0AB2..U+0AB3 U+0AB5..U+0AB9 U+0ABD U+0AE0
4471     U+0B05..U+0B0C U+0B0F..U+0B10 U+0B13..U+0B28
4472     U+0B2A..U+0B30 U+0B32..U+0B33 U+0B36..U+0B39
4473     U+0B3D U+0B5C..U+0B5D U+0B5F..U+0B61
4474     U+0B85..U+0B8A U+0B8E..U+0B90 U+0B92..U+0B95
4475     U+0B99..U+0B9A U+0B9C U+0B9E..U+0B9F
4476     U+0BA3..U+0BA4 U+0BA8..U+0BAA U+0BAE..U+0BB5
4477     U+0BB7..U+0BB9 U+0C05..U+0C0C U+0C0E..U+0C10
4478     U+0C12..U+0C28 U+0C2A..U+0C33 U+0C35..U+0C39
4479     U+0C60..U+0C61 U+0C85..U+0C8C U+0C8E..U+0C90
4480     U+0C92..U+0CA8 U+0CAA..U+0CB3 U+0CB5..U+0CB9
4481     U+0CDE U+0CE0..U+0CE1 U+0D05..U+0D0C
4482     U+0D0E..U+0D10 U+0D12..U+0D28 U+0D2A..U+0D39
4483     U+0D60..U+0D61 U+0E01..U+0E2E U+0E30
4484     U+0E32..U+0E33 U+0E40..U+0E45 U+0E81..U+0E82
4485     U+0E84 U+0E87..U+0E88 U+0E8A U+0E8D
4486     U+0E94..U+0E97 U+0E99..U+0E9F U+0EA1..U+0EA3
4487     U+0EA5 U+0EA7 U+0EAA..U+0EAB U+0EAD..U+0EAE
4488     U+0EB0 U+0EB2..U+0EB3 U+0EBD U+0EC0..U+0EC4
4489     U+0F40..U+0F47 U+0F49..U+0F69 U+10A0..U+10C5
4490     U+10D0..U+10F6 U+1100 U+1102..U+1103
4491     U+1105..U+1107 U+1109 U+110B..U+110C
4492     U+110E..U+1112 U+113C U+113E U+1140 U+114C
4493     U+114E U+1150 U+1154..U+1155 U+1159
4494     U+115F..U+1161 U+1163 U+1165 U+1167 U+1169
4495     U+116D..U+116E U+1172..U+1173 U+1175 U+119E
4496     U+11A8 U+11AB U+11AE..U+11AF U+11B7..U+11B8
4497     U+11BA U+11BC..U+11C2 U+11EB U+11F0 U+11F9
4498     U+1E00..U+1E9B U+1EA0..U+1EF9 U+1F00..U+1F15
4499     U+1F18..U+1F1D U+1F20..U+1F45 U+1F48..U+1F4D
4500     U+1F50..U+1F57 U+1F59 U+1F5B U+1F5D
4501     U+1F5F..U+1F7D U+1F80..U+1FB4 U+1FB6..U+1FBC
4502     U+1FBE U+1FC2..U+1FC4 U+1FC6..U+1FCC
4503     U+1FD0..U+1FD3 U+1FD6..U+1FDB U+1FE0..U+1FEC
4504     U+1FF2..U+1FF4 U+1FF6..U+1FFC U+2126
4505     U+212A..U+212B U+212E U+2180..U+2182
4506     U+3041..U+3094 U+30A1..U+30FA U+3105..U+312C
4507     U+AC00..U+D7A3
4508     // Ideographic
4509     U+4E00..U+9FA5 U+3007 U+3021..U+3029
4510     // Digit
4511     U+0030..U+0039 U+0660..U+0669 U+06F0..U+06F9
4512     U+0966..U+096F U+09E6..U+09EF U+0A66..U+0A6F
4513     U+0AE6..U+0AEF U+0B66..U+0B6F U+0BE7..U+0BEF
4514     U+0C66..U+0C6F U+0CE6..U+0CEF U+0D66..U+0D6F
4515     U+0E50..U+0E59 U+0ED0..U+0ED9 U+0F20..U+0F29
4516     // CombiningChar
4517     U+0300..U+0345 U+0360..U+0361 U+0483..U+0486
4518     U+0591..U+05A1 U+05A3..U+05B9 U+05BB..U+05BD
4519     U+05BF U+05C1..U+05C2 U+05C4 U+064B..U+0652
4520     U+0670 U+06D6..U+06DC U+06DD..U+06DF
4521     U+06E0..U+06E4 U+06E7..U+06E8 U+06EA..U+06ED
4522     U+0901..U+0903 U+093C U+093E..U+094C U+094D
4523     U+0951..U+0954 U+0962..U+0963 U+0981..U+0983
4524     U+09BC U+09BE U+09BF U+09C0..U+09C4
4525     U+09C7..U+09C8 U+09CB..U+09CD U+09D7
4526     U+09E2..U+09E3 U+0A02 U+0A3C U+0A3E U+0A3F
4527     U+0A40..U+0A42 U+0A47..U+0A48 U+0A4B..U+0A4D
4528     U+0A70..U+0A71 U+0A81..U+0A83 U+0ABC
4529     U+0ABE..U+0AC5 U+0AC7..U+0AC9 U+0ACB..U+0ACD
4530     U+0B01..U+0B03 U+0B3C U+0B3E..U+0B43
4531     U+0B47..U+0B48 U+0B4B..U+0B4D U+0B56..U+0B57
4532     U+0B82..U+0B83 U+0BBE..U+0BC2 U+0BC6..U+0BC8
4533     U+0BCA..U+0BCD U+0BD7 U+0C01..U+0C03
4534     U+0C3E..U+0C44 U+0C46..U+0C48 U+0C4A..U+0C4D
4535     U+0C55..U+0C56 U+0C82..U+0C83 U+0CBE..U+0CC4
4536     U+0CC6..U+0CC8 U+0CCA..U+0CCD U+0CD5..U+0CD6
4537     U+0D02..U+0D03 U+0D3E..U+0D43 U+0D46..U+0D48
4538     U+0D4A..U+0D4D U+0D57 U+0E31 U+0E34..U+0E3A
4539     U+0E47..U+0E4E U+0EB1 U+0EB4..U+0EB9
4540     U+0EBB..U+0EBC U+0EC8..U+0ECD U+0F18..U+0F19
4541     U+0F35 U+0F37 U+0F39 U+0F3E U+0F3F
4542     U+0F71..U+0F84 U+0F86..U+0F8B U+0F90..U+0F95
4543     U+0F97 U+0F99..U+0FAD U+0FB1..U+0FB7 U+0FB9
4544     U+20D0..U+20DC U+20E1 U+302A..U+302F U+3099
4545     U+309A
4546     // Extender
4547     U+00B7 U+02D0 U+02D1 U+0387 U+0640 U+0E46
4548     U+0EC6 U+3005 U+3031..U+3035 U+309D..U+309E
4549     U+30FC..U+30FE
4550     ];
4551 wakaba 1.1
4552     $NameStartChar11 := [
4553     ':' '_'
4554     'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M'
4555     'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z'
4556     'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm'
4557     'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z'
4558     U+00C0..U+00D6 U+00D8..U+00F6 U+00F8..U+02FF
4559     U+0370..U+037D U+037F..U+1FFF U+200C..U+200D
4560     U+2070..U+218F U+2C00..U+2FEF U+3001..U+D7FF
4561     U+F900..U+FDCF U+FDF0..U+FFFD U+10000..U+EFFFF
4562     ];
4563     $NameChar11 := [
4564     '-' '.' '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'
4565     U+00B7 U+0300..U+036F U+203F..U+2040
4566     // NameStartChar
4567     ':' '_'
4568     'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M'
4569     'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z'
4570     'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm'
4571     'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z'
4572     U+00C0..U+00D6 U+00D8..U+00F6 U+00F8..U+02FF
4573     U+0370..U+037D U+037F..U+1FFF U+200C..U+200D
4574     U+2070..U+218F U+2C00..U+2FEF U+3001..U+D7FF
4575     U+F900..U+FDCF U+FDF0..U+FFFD U+10000..U+EFFFF
4576     ];
4577 wakaba 1.4 } // NameChar
4578    
4579     lexmode Name
4580     : extends => 'NameChar'
4581     {
4582 wakaba 1.1 Name : value := $NameStartChar11 $NameChar11*;
4583     } // Name
4584 wakaba 1.4
4585     lexmode Nmtoken
4586     : extends => 'NameChar'
4587     {
4588     Nmtoken : value := $NameChar11*;
4589     } // Nmtoken
4590 wakaba 1.1
4591     /*
4592 wakaba 1.14 S
4593 wakaba 1.1 */
4594     lexmode S {
4595 wakaba 1.14 $s := [U+0009 U+000A U+000D U+0020];
4596     S := $s+;
4597 wakaba 1.1 } // S
4598    
4599     /*
4600     Document end scanning mode
4601     */
4602     lexmode DocumentEnd
4603     : standalone
4604     : extends => 'S'
4605     {
4606     /*
4607     Processing instruction
4608     */
4609     PIO := ['<'] ['?'];
4610    
4611     /*
4612     Comment declaration
4613     */
4614     CDO := ['<'] ['!'] ['-'] ['-'];
4615     } // DocumentEnd
4616    
4617     /*
4618     Document misc scanning mode
4619    
4620     This mode scans |Misc| constructions as well
4621     as document element's start tag.
4622     */
4623     lexmode DocumentMisc
4624     : standalone
4625     : extends => 'DocumentEnd'
4626     {
4627     /*
4628     Document element start tag
4629     */
4630     STAGO := ['<'];
4631     } // DocumentMisc
4632    
4633     /*
4634     Document prolog scanning mode
4635     */
4636     lexmode DocumentProlog
4637     : standalone
4638     : extends => 'DocumentMisc'
4639     {
4640     /*
4641     |DOCTYPE| declaration
4642     */
4643     MDO := ['<'] ['!'];
4644     } // DocumentProlog
4645 wakaba 1.16
4646 wakaba 1.1 /*
4647 wakaba 1.16 Document Start Scanning Mode
4648 wakaba 1.1 */
4649     lexmode DocumentStart
4650     : standalone
4651     : extends => 'DocumentProlog'
4652     {
4653     /*
4654     XML declaration
4655     */
4656 wakaba 1.16 XDO := ['<'] ['?'] ['x'] ['m'] ['l'];
4657 wakaba 1.1 } // DocumentStart
4658    
4659     /*
4660     Comment declaration scanning mode
4661     */
4662     lexmode CommentDeclaration
4663     : standalone
4664     {
4665     /*
4666     Comment close
4667     */
4668     COM := ['-'] ['-'];
4669    
4670     /*
4671     Comment data
4672     */
4673 wakaba 1.15 ?default-token STRING : value;
4674 wakaba 1.1 } // CommentDeclaration
4675    
4676     /*
4677     Processing instruction name and |S| scanning mode
4678     */
4679     lexmode PIName
4680     : standalone
4681     : extends => 'Name'
4682     : extends => 'S'
4683     {
4684     /*
4685     Processing instruction close
4686     */
4687     PIC := ['?'] ['>'];
4688     } // PIName
4689    
4690     /*
4691 wakaba 1.16 Processing instruction name and |S| scanning mode
4692     */
4693     lexmode PINmtoken
4694     : standalone
4695     : extends => 'Nmtoken'
4696     : extends => 'S'
4697     {
4698     /*
4699     Processing instruction close
4700     */
4701     PIC := ['?'] ['>'];
4702     } // PINmtoken
4703    
4704     /*
4705 wakaba 1.1 Processing instruction data scanning mode
4706     */
4707     lexmode PIData
4708     : standalone
4709     {
4710     /*
4711     Processing instruction close
4712     */
4713     PIC := ['?'] ['>'];
4714    
4715     /*
4716     Processing instruction target data
4717     */
4718 wakaba 1.2 ?default-token DATA : value;
4719 wakaba 1.1 } // PIData
4720    
4721     /*
4722     Content of element scanning mode
4723     */
4724     lexmode ElementContent
4725     : standalone
4726     {
4727     /*
4728     Start tag open
4729     */
4730     STAGO := ['<'];
4731    
4732     /*
4733     End tag open
4734     */
4735     ETAGO := ['<'] ['/'];
4736    
4737     /*
4738     Hexadecimal character reference open
4739     */
4740     HCRO := ['&'] ['#'] ['x'];
4741    
4742     /*
4743     Numeric character reference open
4744     */
4745     CRO := ['&'] ['#'];
4746    
4747     /*
4748     General entity reference open
4749     */
4750     ERO := ['&'];
4751    
4752     /*
4753     Comment declaration open
4754     */
4755     CDO := ['<'] ['!'] ['-'] ['-'];
4756    
4757     /*
4758     CDATA section open
4759     */
4760     CDSO := ['<'] ['!'] ['[']
4761     ['C'] ['D'] ['A'] ['T'] ['A'] ['['];
4762    
4763     /*
4764     Processing instruction open
4765     */
4766     PIO := ['<'] ['?'];
4767 wakaba 1.2
4768     /*
4769     Markup section end
4770     */
4771     MSE := [']'] [']'] ['>'];
4772    
4773     /*
4774     Character data
4775     */
4776     /*
4777     Character data and/or |MSE|
4778     */
4779     ?default-token CharData : value;
4780 wakaba 1.1 } // ElementContent
4781    
4782     /*
4783     CDATA section content scanning mode
4784     */
4785     lexmode CDATASectionContent
4786     : standalone
4787     {
4788     /*
4789     Markup section end
4790     */
4791     MSE := [']'] [']'] ['>'];
4792    
4793     /*
4794     Character data
4795 wakaba 1.2 */
4796     ?default-token CData : value;
4797 wakaba 1.1 } // CDATASectionContent
4798    
4799     lexmode EntityReference
4800     : standalone
4801     : extends => 'Name'
4802     {
4803     /*
4804     Reference close
4805     */
4806     REFC := [';'];
4807     } // EntityReference
4808    
4809     lexmode NumericCharacterReference
4810     : standalone
4811     {
4812     /*
4813     Decimal number
4814     */
4815     $digit := ['0' '1' '2' '3' '4' '5' '6' '7' '8' '9'];
4816     NUMBER : value := $digit+;
4817    
4818     /*
4819     Reference close
4820     */
4821     REFC := [';'];
4822     } // NumericCharacterReference
4823    
4824     lexmode HexadecimalCharacterReference
4825     : standalone
4826     {
4827     /*
4828     Hexadecimal number
4829     */
4830     $hexdigit := ['0' '1' '2' '3' '4' '5' '6' '7' '8' '9'
4831     'A' 'B' 'C' 'D' 'E' 'F'
4832     'a' 'b' 'c' 'd' 'e' 'f'];
4833     Hex : value := $hexdigit+;
4834    
4835     /*
4836     Reference close
4837     */
4838     REFC := [';'];
4839     } // HexadecimalCharacterReference
4840    
4841 wakaba 1.16 /*
4842     The XML Declaration and Text Declaration Scanning Mode
4843     */
4844 wakaba 1.3 lexmode XMLDeclaration
4845     : standalone
4846     : extends => 'Name'
4847     : extends => 'S'
4848     {
4849    
4850     /*
4851     Value indicator
4852     */
4853     VI := ['='];
4854    
4855     /*
4856     Literal open
4857     */
4858     LIT := ['"'];
4859     LITA := [U+0027];
4860    
4861     /*
4862     Processing instruction close
4863 wakaba 1.16
4864     The |PIC|, i.e. |?>|, is split into two tokens |PIC1| and |PIC2|
4865     in this scanning mode to set |no_xml11_eol| flag in the
4866     |_XMLDeclaration_| |rule|.
4867 wakaba 1.3 */
4868 wakaba 1.16 PIC1 := ['?'];
4869     PIC2 := ['>'];
4870 wakaba 1.3 } // XMLDeclaration
4871 wakaba 1.16
4872     /*
4873     The XML Declaration or Processing Instruction Scanning Mode
4874    
4875     '<?xml' S ...
4876     (DocumentStart) (XMLDeclarationOrPI) (XMLDeclaration)
4877     '<?xml' '1' S ...
4878     (DocumentStart) (XMLDeclarationOrPI) (PINmtoken)(PIName) (PITarget)
4879     '<?xml' '-' 'stylesheet' S ...
4880     (DocumentStart) (XMLDeclarationOrPI) (PINmtoken) (PIName) (PITarget)
4881     */
4882     lexmode XMLDeclarationOrPI
4883     : standalone
4884     : extends => 'NameChar'
4885     : extends => 'S'
4886     {
4887     NameChar : value := $NameChar11;
4888     } // XMLDeclarationOrPI
4889 wakaba 1.3
4890 wakaba 1.1 lexmode StartTag
4891     : standalone
4892     : extends => 'Name'
4893     : extends => 'S'
4894     {
4895    
4896     /*
4897     Value indicator
4898     */
4899     VI := ['='];
4900    
4901     /*
4902     Literal open
4903     */
4904     LIT := ['"'];
4905     LITA := [U+0027];
4906    
4907     /*
4908     Tag close
4909     */
4910     TAGC := ['>'];
4911    
4912     /*
4913 wakaba 1.6 Null end-tag enabled start-tag close
4914 wakaba 1.1 */
4915 wakaba 1.6 NESTC := ['/'];
4916 wakaba 1.1 } // StartTag
4917    
4918     lexmode EndTag
4919     : standalone
4920     : extends => 'Name'
4921     : extends => 'S'
4922     {
4923     /*
4924     Tag close
4925     */
4926     TAGC := ['>'];
4927     } // EndTag
4928    
4929     lexmode AttributeValueLiteral_ {
4930     ERO := ['&'];
4931     CRO := ['&'] ['#'];
4932     HCRO := ['&'] ['#'] ['x'];
4933     } // AttributeValueLiteral_
4934    
4935     lexmode AttributeValueLiteral
4936     : standalone
4937     : extends => 'AttributeValueLiteral_'
4938     {
4939     LIT := ['"'];
4940 wakaba 1.3 STRING : value := [^'"' '&' '<']+;
4941 wakaba 1.1 } // AttributeValueLiteral
4942    
4943     lexmode AttributeValueLiteralA
4944     : standalone
4945     : extends => 'AttributeValueLiteral_'
4946     {
4947 wakaba 1.4 LITA := [U+0027];
4948 wakaba 1.3 STRING : value := [^U+0027 '&' '<']+;
4949 wakaba 1.1 } // AttributeValueLiteralA
4950 wakaba 1.11
4951     lexmode AttributeValueLiteralE
4952     : standalone
4953     : extends => 'AttributeValueLiteral_'
4954     {
4955     STRING : value := [^'&' '<']+;
4956     } // AttributeValueLiteralE
4957 wakaba 1.4
4958     lexmode EntityValue_ {
4959     PERO := ['%'];
4960     ERO := ['&'];
4961     CRO := ['&'] ['#'];
4962     HCRO := ['&'] ['#'] ['x'];
4963     } // EntityValue_
4964    
4965     lexmode EntityValue
4966     : standalone
4967     : extends => 'EntityValue_'
4968     {
4969     LIT := ['"'];
4970     STRING : value := [^'"' '&' '%']+;
4971     } // EntityValue
4972    
4973     lexmode EntityValueA
4974     : standalone
4975     : extends => 'EntityValue_'
4976     {
4977     LITA := [U+0027];
4978     STRING : value := [^U+0027 '&' '%']+;
4979     } // EntityValueA
4980    
4981     lexmode SystemLiteral
4982     : standalone
4983     {
4984     LIT := ['"'];
4985     ?default-token STRING : value;
4986     } // SystemLiteral
4987    
4988     lexmode SystemLiteralA
4989     : standalone
4990     {
4991     LITA := [U+0027];
4992     ?default-token STRING : value;
4993     } // SystemLiteralA
4994    
4995     lexmode DTD
4996     : standalone
4997     : extends => 'S'
4998     {
4999     /*
5000     Markup declaration open
5001     */
5002     MDO := ['<'] ['!'];
5003    
5004     /*
5005     Comment declaration open
5006     */
5007     CDO := ['<'] ['!'] ['-'] ['-'];
5008    
5009     /*
5010     Processing instruction open
5011     */
5012     PIO := ['<'] ['?'];
5013    
5014     /*
5015     Parameter entity reference open
5016     */
5017     PERO := ['%'];
5018    
5019     /*
5020     Declaration subset close
5021     */
5022     DSC := [']'];
5023    
5024     /*
5025     Contition section open
5026     */
5027     CSO := ['<'] ['!'] ['['];
5028     } // DTD
5029    
5030     /*
5031     Markup declaration scanning mode
5032    
5033     This mode is used to recognize |MDC| that terminates
5034     a comment declaration as well as the base |lexmode|
5035     for e.g. document type declaration scanning mode.
5036     */
5037     lexmode MarkupDeclaration
5038     : standalone
5039     : extends => 'Name'
5040     : extends => 'S'
5041     {
5042     /*
5043     Markup declaration close
5044     */
5045     MDC := ['>'];
5046    
5047     /*
5048     Literal open
5049     */
5050     LIT := ['"'];
5051    
5052     /*
5053     Alternative literal open
5054     */
5055     LITA := [U+0027];
5056    
5057     /*
5058     Parameter entity reference open
5059     */
5060     PERO := ['%'];
5061    
5062     /*
5063     Declaration subset open
5064     */
5065     DSO := ['['];
5066     } // MarkupDeclaration
5067    
5068     lexmode ElementDeclaration
5069     : standalone
5070     : extends => 'MarkupDeclaration'
5071     {
5072     /*
5073     Model group open
5074     */
5075     MGO := ['('];
5076    
5077     /*
5078     Model group close
5079     */
5080     MGC := [')'];
5081    
5082     /*
5083     Reserved name indicator
5084     */
5085     RNI := ['#'];
5086    
5087     /*
5088     Occurence indicators
5089     */
5090     OPT := ['?'];
5091     REP := ['*'];
5092     PLUS := ['+'];
5093    
5094     /*
5095     Connectors
5096     */
5097     OR := ['|'];
5098     SEQ := [','];
5099     } // ElementDeclaration
5100    
5101     lexmode AttlistDeclaration
5102     : standalone
5103     : extends => 'MarkupDeclaration'
5104     {
5105     /*
5106     Enumeration group open
5107     */
5108     EGO := ['('];
5109    
5110     /*
5111     Enumeration group close
5112     */
5113     EGC := [')'];
5114    
5115     /*
5116     Enumeration choice delimiter
5117     */
5118     OR := ['|'];
5119    
5120     /*
5121     Reserved name indicator
5122     */
5123     RNI := ['#'];
5124     } // AttlistDeclaration
5125    
5126     lexmode Enumeration
5127     : standalone
5128     : extends => 'Nmtoken'
5129     : extends => 'S'
5130     {
5131     /*
5132     Enumeration group close
5133     */
5134     EGC := [')'];
5135    
5136     /*
5137     Enumeration choice delimiter
5138     */
5139     OR := ['|'];
5140     } // Enumeration
5141    
5142 wakaba 1.1
5143     token-error default : default {
5144     lang:Perl {
5145 wakaba 1.3 my $location;
5146     __CODE{xp|get-location-from-token::
5147     $token => {$token},
5148     $result => {$location},
5149     }__;
5150     my $continue = __DOMCore:ERROR{xp|wf-syntax-error::
5151 wakaba 1.1 xp|error-token => {$token},
5152     DOMCore|location => {$location},
5153     }__;
5154     unless ($continue) {
5155 wakaba 1.27 __CODE{ParseError}__;
5156 wakaba 1.1 }
5157     }
5158     } // default
5159 wakaba 1.5
5160 wakaba 1.26 @ResourceDef:
5161     @@ForCheck: ManakaiDOM|ForClass
5162 wakaba 1.27 @@QName: ParseError
5163     @@rdf:type: DISPerl|BlockCode
5164     @@PerlDef:
5165     __DEEP{
5166     for (@{$self->{entity}}) {
5167     $_->{close_file}->();
5168     }
5169     }__;
5170     __EXCEPTION{DOMLS|PARSE_ERR}__;
5171    
5172     @ResourceDef:
5173     @@ForCheck: ManakaiDOM|ForClass
5174 wakaba 1.26 @@QName: checkNCName
5175     @@rdf:type: DISPerl|BlockCode
5176     @@PerlDef:
5177     if (($self->{xml_version} eq '1.0' and
5178     not <Code::DOMMain|testXML10Name:: $INPUT = $name>) or
5179     ($self->{xml_version} eq '1.1' and
5180     not <Code::DOMMain|testXML11Name:: $INPUT = $name>)) {
5181     my $__location;
5182     __CODE{xp|get-location-from-token::
5183     $token => {$token},
5184     $result => {$__location},
5185     }__;
5186     my $__continue = __c|ERROR{xp|wf-invalid-character-in-node-name::
5187     xp|error-token => {$token},
5188     c|location => {$__location},
5189     xp|name => {$name},
5190     infoset|version => {$self->{xml_version}},
5191     }__;
5192     unless ($__continue) {
5193 wakaba 1.27 __CODE{ParseError}__;
5194 wakaba 1.26 }
5195     } elsif (index ($name, ':') > -1) {
5196     my $__location;
5197     __CODE{xp|get-location-from-token::
5198     $token => {$token},
5199     $result => {$__location},
5200     }__;
5201     my $__continue = __c|ERROR{xp|nswf-legal-ncname::
5202     xp|error-token => {$token},
5203     c|location => {$__location},
5204     xp|name => {$name},
5205     infoset|version => {$self->{xml_version}},
5206     }__;
5207     unless ($__continue) {
5208 wakaba 1.27 __CODE{ParseError}__;
5209 wakaba 1.26 }
5210     }
5211    
5212     @ResourceDef:
5213     @@ForCheck: ManakaiDOM|ForClass
5214     @@QName: checkQName
5215     @@rdf:type: DISPerl|BlockCode
5216     @@PerlDef:
5217     if (($self->{xml_version} eq '1.0' and
5218     not <Code::DOMMain|testXML10Name:: $INPUT = $name>) or
5219     ($self->{xml_version} eq '1.1' and
5220     not <Code::DOMMain|testXML11Name:: $INPUT = $name>)) {
5221     my $__location;
5222     __CODE{xp|get-location-from-token::
5223     $token => {$token},
5224     $result => {$__location},
5225     }__;
5226     my $__continue = __c|ERROR{xp|wf-invalid-character-in-node-name::
5227     xp|error-token => {$token},
5228     c|location => {$__location},
5229     xp|name => {$name},
5230     infoset|version => {$self->{xml_version}},
5231     }__;
5232     unless ($__continue) {
5233 wakaba 1.27 __CODE{ParseError}__;
5234 wakaba 1.26 }
5235     } elsif (($self->{xml_version} eq '1.0' and
5236     not <Code::DOMMain|testXML10QName:: $INPUT = $name>) or
5237     ($self->{xml_version} eq '1.1' and
5238     not <Code::DOMMain|testXML11QName:: $INPUT = $name>)) {
5239     my $__location;
5240     __CODE{xp|get-location-from-token::
5241     $token => {$token},
5242     $result => {$__location},
5243     }__;
5244     my $__continue = __c|ERROR{xp|nswf-legal-qname::
5245     xp|error-token => {$token},
5246     c|location => {$__location},
5247     xp|name => {$name},
5248     infoset|version => {$self->{xml_version}},
5249     }__;
5250     unless ($__continue) {
5251 wakaba 1.27 __CODE{ParseError}__;
5252 wakaba 1.26 }
5253     }
5254    
5255    
5256 wakaba 1.5 @XMLTests:
5257     @@XMLTest:
5258 wakaba 1.15 @@@QName: xp.char.xml10.test
5259     @@@DEnt:
5260     @@@@test:value:
5261     <?xml version="1.0"?>
5262     <p>$u0009$u000A$u000D$u0020$uD7FF$uE000$uFFFD$U00010000$U0010FFFF</p>
5263     @@@test:domTree:
5264     document {
5265     xml-version: '1.0';
5266     element {
5267     text-content: U+0009 U+000A U+000A U+0020 U+D7FF
5268     U+E000 U+FFFD U+10000 U+10FFFF;
5269     }
5270     }
5271     @@XMLTest:
5272     @@@QName: xp.char.xml11.test
5273     @@@DEnt:
5274     @@@@test:value:
5275     <?xml version="1.1"?>
5276     <p>$u0009$u000A$u000D$u0020$uD7FF$uE000$uFFFD$U00010000$U0010FFFF</p>
5277     @@@test:domTree:
5278     document {
5279     xml-version: '1.1';
5280     element {
5281     text-content: U+0009 U+000A U+000A U+0020 U+D7FF
5282     U+E000 U+FFFD U+10000 U+10FFFF;
5283     }
5284     }
5285     @@XMLTest:
5286     @@@QName: xp.char.xml10.c0.test
5287     @@@DEnt:
5288     @@@@test:value:
5289     <?xml version="1.0"?>
5290     <p>$u0000$u0001$u0002$u0003$u0004$u0005$u0006$u0007$u0008$u000B$
5291     $u000C$u000E$u000F$u0010$u0011$u0012$u0013$u0014$u0015$u0016$
5292     $u0017$u0018$u0019$u001A$u001B$u001C$u001D$u001E$u001F</p>
5293     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 4); } /* U+0000 */
5294     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 5); } /* U+0001 */
5295     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 6); } /* U+0002 */
5296     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 7); } /* U+0003 */
5297     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 8); } /* U+0004 */
5298     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 9); } /* U+0005 */
5299     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 10); } /* U+0006 */
5300     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 11); } /* U+0007 */
5301     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 12); } /* U+0008 */
5302     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 13); } /* U+000B */
5303     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 14); } /* U+000C */
5304     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 15); } /* U+000E */
5305     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 16); } /* U+000F */
5306     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 17); } /* U+0010 */
5307     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 18); } /* U+0011 */
5308     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 19); } /* U+0012 */
5309     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 20); } /* U+0013 */
5310     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 21); } /* U+0014 */
5311     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 22); } /* U+0015 */
5312     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 23); } /* U+0016 */
5313     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 24); } /* U+0017 */
5314     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 25); } /* U+0018 */
5315     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 26); } /* U+0019 */
5316     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 27); } /* U+001A */
5317     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 28); } /* U+001B */
5318     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 29); } /* U+001C */
5319     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 30); } /* U+001D */
5320     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 31); } /* U+001E */
5321     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 32); } /* U+001F */
5322     @@XMLTest:
5323     @@@QName: xp.char.xml11.c0.test
5324     @@@DEnt:
5325     @@@@test:value:
5326     <?xml version="1.1"?>
5327     <p>$u0000$u0001$u0002$u0003$u0004$u0005$u0006$u0007$u0008$u000B$
5328     $u000C$u000E$u000F$u0010$u0011$u0012$u0013$u0014$u0015$u0016$
5329     $u0017$u0018$u0019$u001A$u001B$u001C$u001D$u001E$u001F</p>
5330     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 4); } /* U+0000 */
5331     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 5); } /* U+0001 */
5332     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 6); } /* U+0002 */
5333     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 7); } /* U+0003 */
5334     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 8); } /* U+0004 */
5335     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 9); } /* U+0005 */
5336     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 10); } /* U+0006 */
5337     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 11); } /* U+0007 */
5338     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 12); } /* U+0008 */
5339     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 13); } /* U+000B */
5340     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 14); } /* U+000C */
5341     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 15); } /* U+000E */
5342     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 16); } /* U+000F */
5343     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 17); } /* U+0010 */
5344     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 18); } /* U+0011 */
5345     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 19); } /* U+0012 */
5346     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 20); } /* U+0013 */
5347     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 21); } /* U+0014 */
5348     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 22); } /* U+0015 */
5349     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 23); } /* U+0016 */
5350     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 24); } /* U+0017 */
5351     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 25); } /* U+0018 */
5352     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 26); } /* U+0019 */
5353     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 27); } /* U+001A */
5354     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 28); } /* U+001B */
5355     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 29); } /* U+001C */
5356     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 30); } /* U+001D */
5357     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 31); } /* U+001E */
5358     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 32); } /* U+001F */
5359     @@XMLTest:
5360     @@@QName: xp.char.xml10.c1.test
5361     @@@DEnt:
5362     @@@@test:value:
5363     <?xml version="1.0"?>
5364     <p>$u007F$u0080$u0081$u0082$u0083$u0084$u0086$u0087$u0088$
5365     $u0089$u008A$u008B$u008C$
5366     $u008D$u008E$u008F$u0090$u0091$u0092$u0093$u0094$u0095$u0096$
5367     $u0097$u0098$u0099$u009A$u009B$u009C$u009D$u009E$u009F$u0085</p>
5368     @@@test:domTree:
5369     document {
5370     xml-version: '1.0';
5371     element {
5372     text-content: U+007F U+0080 U+0081 U+0082 U+0083 U+0084 U+0086
5373     U+0087 U+0088 U+0089 U+008A U+008B U+008C U+008D
5374     U+008E U+008F U+0090 U+0091 U+0092 U+0093 U+0094
5375     U+0095 U+0096 U+0097 U+0098 U+0099 U+009A U+009B
5376     U+009C U+009D U+009E U+009F U+0085;
5377     }
5378     }
5379     @@XMLTest:
5380     @@@QName: xp.char.xml11.c1.test
5381     @@@DEnt:
5382     @@@@test:value:
5383     <?xml version="1.1"?>
5384     <p>$u007F$u0080$u0081$u0082$u0083$u0084$u0086$u0087$u0088$
5385     $u0089$u008A$u008B$u008C$
5386     $u008D$u008E$u008F$u0090$u0091$u0092$u0093$u0094$u0095$u0096$
5387     $u0097$u0098$u0099$u009A$u009B$u009C$u009D$u009E$u009F$u0085</p>
5388     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 4); } /* U+007F */
5389     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 5); } /* U+0080 */
5390     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 6); } /* U+0081 */
5391     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 7); } /* U+0082 */
5392     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 8); } /* U+0083 */
5393     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 9); } /* U+0084 */
5394     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 10); } /* U+0086 */
5395     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 11); } /* U+0087 */
5396     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 12); } /* U+0088 */
5397     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 13); } /* U+0089 */
5398     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 14); } /* U+008A */
5399     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 15); } /* U+008B */
5400     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 16); } /* U+008C */
5401     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 17); } /* U+008D */
5402     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 18); } /* U+008E */
5403     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 19); } /* U+008F */
5404     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 20); } /* U+0090 */
5405     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 21); } /* U+0091 */
5406     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 22); } /* U+0092 */
5407     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 23); } /* U+0093 */
5408     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 24); } /* U+0094 */
5409     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 25); } /* U+0095 */
5410     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 26); } /* U+0096 */
5411     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 27); } /* U+0097 */
5412     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 28); } /* U+0098 */
5413     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 29); } /* U+0099 */
5414     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 30); } /* U+009A */
5415     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 31); } /* U+009B */
5416     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 32); } /* U+009C */
5417     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 33); } /* U+009D */
5418     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 34); } /* U+009E */
5419     @@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 35); } /* U+009F */
5420    
5421     @@XMLTest:
5422 wakaba 1.27 @@@QName: xp.c0.internal.entity.xml11.1.test
5423     @@@DEnt:
5424     @@@@test:value:
5425     <?xml version="1.1"?>
5426     <!DOCTYPE a [
5427     <!ENTITY e "&#x01;&#x02;&#x03;&#x04;&#x05;&#x06;&#x07;$
5428     &#x08;&#x09;&#x0A;&#x0B;&#x0C;&#x0D;&#x0E;&#x0F;$
5429     &#x10;&#x11;&#x12;&#x13;&#x14;&#x15;&#x16;&#x17;$
5430     &#x18;&#x19;&#x1A;&#x1B;&#x1C;&#x1D;&#x1E;&#x1F;">
5431     ]><a/>
5432 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
5433 wakaba 1.27 @@@test:domTree:
5434     document {
5435     document-type {
5436     general-entity {
5437     node-name: 'e';
5438     text-content: U+0001 U+0002 U+0003 U+0004 U+0005
5439     U+0006 U+0007 U+0008 U+0009 U+000A U+000B
5440     U+000C U+000D U+000E U+000F
5441     U+0010 U+0011 U+0012 U+0013 U+0014 U+0015
5442     U+0016 U+0017 U+0018 U+0019 U+001A U+001B
5443     U+001C U+001D U+001E U+001F;
5444     }
5445     }
5446     element { }
5447     }
5448     @@XMLTest:
5449     @@@QName: xp.c1.internal.entity.xml11.1.test
5450     @@@DEnt:
5451     @@@@test:value:
5452     <?xml version="1.1"?>
5453     <!DOCTYPE a [
5454     <!ENTITY e "&#x80;&#x81;&#x82;&#x83;&#x84;&#x85;&#x86;&#x87;$
5455     &#x88;&#x89;&#x8A;&#x8B;&#x8C;&#x8D;&#x8E;&#x8F;$
5456     &#x90;&#x91;&#x92;&#x93;&#x94;&#x95;&#x96;&#x97;$
5457     &#x98;&#x99;&#x9A;&#x9B;&#x9C;&#x9D;&#x9E;&#x9F;&#x7F;">
5458     ]><a/>
5459 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
5460 wakaba 1.27 @@@test:domTree:
5461     document {
5462     document-type {
5463     general-entity {
5464     node-name: 'e';
5465     text-content: U+0080 U+0081 U+0082 U+0083 U+0084 U+0085
5466     U+0086 U+0087 U+0088 U+0089 U+008A U+008B
5467     U+008C U+008D U+008E U+008F
5468     U+0090 U+0091 U+0092 U+0093 U+0094 U+0095
5469     U+0096 U+0097 U+0098 U+0099 U+009A U+009B
5470     U+009C U+009D U+009E U+009F U+007F;
5471     }
5472     }
5473     element { }
5474     }
5475    
5476     @@XMLTest:
5477 wakaba 1.12 @@@QName: xp.syntax.empty.test
5478     @@@DEnt:
5479     @@@@test:value: \
5480     @@@c:erred:
5481     <[[xp:wf-syntax-error]]> { (1, 1); }
5482     @@XMLTest:
5483     @@@QName: xp.syntax.space.test
5484     @@@DEnt:
5485 wakaba 1.13 @@@@test:value: \
5486 wakaba 1.12 @@@c:erred:
5487     <[[xp:wf-syntax-error]]> { (1, 4); }
5488     @@XMLTest:
5489     @@@QName: xp.syntax.newlines.test
5490     @@@DEnt:
5491     @@@@test:value:
5492     \
5493     \
5494     \
5495     @@@c:erred:
5496     <[[xp:wf-syntax-error]]> { (3, 1); }
5497    
5498     @@XMLTest:
5499 wakaba 1.6 @@@QName: xp.only.docel.test
5500 wakaba 1.5 @@@DEnt:
5501     @@@@test:value:
5502     <p></p>
5503     @@@test:domTree:
5504     document {
5505     xml-version: '1.0';
5506 wakaba 1.6 xml-encoding: null;
5507     xml-standalone: false;
5508     element {
5509     namespace-uri: null;
5510     prefix: null;
5511     local-name: 'p';
5512     text-content: '';
5513     }
5514     }
5515     @@XMLTest:
5516     @@@QName: xp.only.docel.emptyelemtag.test
5517     @@@DEnt:
5518     @@@@test:value:
5519     <p/>
5520     @@@test:domTree:
5521     document {
5522     xml-version: '1.0';
5523     xml-encoding: null;
5524     xml-standalone: false;
5525 wakaba 1.5 element {
5526     namespace-uri: null;
5527     prefix: null;
5528     local-name: 'p';
5529     text-content: '';
5530     }
5531     }
5532 wakaba 1.15 @@XMLTest:
5533     @@@QName: xp.root.s.1.test
5534     @@@DEnt:
5535     @@@@test:value:
5536     <?xml version="1.0"?>$u0020$u000D$u000A$u0009
5537     <p></p>
5538     @@@test:domTree:
5539     document {
5540     element { }
5541     }
5542    
5543     @@XMLTest:
5544     @@@QName: xp.Name.1.test
5545     @@@DEnt:
5546     @@@@test:value: <name/>
5547     @@@test:domTree:
5548     document {
5549     element {
5550     node-name: 'name';
5551     }
5552     }
5553     @@XMLTest:
5554     @@@QName: xp.Name.2.test
5555     @@@DEnt:
5556     @@@@test:value: <name0/>
5557     @@@test:domTree:
5558     document {
5559     element {
5560     node-name: 'name0';
5561     }
5562     }
5563     @@enImplNote:
5564     @@@ddid: xml11name
5565     @@@@:
5566     {TODO:: XML 1.1 Name tests required
5567     }
5568    
5569     @@XMLTest:
5570     @@@QName: xp.content.mse.1.test
5571     @@@DEnt:
5572     @@@@test:value:
5573     <p>]]></p>
5574     @@@c:erred:
5575     <[[xp|wf-syntax-error]]> { (1, 4)..(1, 6); }
5576     @@XMLTest:
5577     @@@QName: xp.content.mse.2.test
5578     @@@DEnt:
5579     @@@@test:value:
5580     <p>aaa]]>bbb</p>
5581     @@@c:erred:
5582     <[[xp|wf-syntax-error]]> { (1, 7)..(1, 9); }
5583    
5584     @@XMLTest:
5585     @@@QName: xp.root.comment.1.test
5586     @@@DEnt:
5587     @@@@test:value:
5588     <!--comment data-->
5589     <p/>
5590     @@@test:domTree:
5591     document {
5592     comment {
5593     data: 'comment data';
5594     }
5595     element { }
5596     }
5597     @@XMLTest:
5598     @@@QName: xp.root.comment.2.test
5599     @@@DEnt:
5600     @@@@test:value:
5601     <!---->
5602     <p/>
5603     @@@test:domTree:
5604     document {
5605     comment {
5606     data: '';
5607     }
5608     element { }
5609     }
5610     @@XMLTest:
5611     @@@QName: xp.root.after.pi.comment.1.test
5612     @@@DEnt:
5613     @@@@test:value:
5614     <?pi?>
5615     <!--comment data-->
5616     <p/>
5617     @@@test:domTree:
5618     document {
5619     pi { }
5620     comment {
5621     data: 'comment data';
5622     }
5623     element { }
5624     }
5625     @@XMLTest:
5626     @@@QName: xp.root.after.pi.comment.2.test
5627     @@@DEnt:
5628     @@@@test:value:
5629     <?pi?>
5630     <!---->
5631     <p/>
5632     @@@test:domTree:
5633     document {
5634     pi { }
5635     comment {
5636     data: '';
5637     }
5638     element { }
5639     }
5640     @@XMLTest:
5641     @@@QName: xp.root.after.element.comment.1.test
5642     @@@DEnt:
5643     @@@@test:value:
5644     <p/>
5645     <!--comment data-->
5646     @@@test:domTree:
5647     document {
5648     element { }
5649     comment {
5650     data: 'comment data';
5651     }
5652     }
5653     @@XMLTest:
5654     @@@QName: xp.root.after.element.comment.2.test
5655     @@@DEnt:
5656     @@@@test:value:
5657     <p/>
5658     <!---->
5659     @@@test:domTree:
5660     document {
5661     element { }
5662     comment {
5663     data: '';
5664     }
5665     }
5666     @@XMLTest:
5667     @@@QName: xp.doctype.intsubset.comment.1.test
5668     @@@DEnt:
5669     @@@@test:value:
5670     <!DOCTYPE a [
5671     <!--comment data-->
5672     ]>
5673     <p/>
5674     @@@test:domTree:
5675     document {
5676     document-type { }
5677     element { }
5678     }
5679     @@XMLTest:
5680     @@@QName: xp.doctype.intsubset.comment.2.test
5681     @@@DEnt:
5682     @@@@test:value:
5683     <!DOCTYPE a [
5684     <!---->
5685     ]>
5686     <p/>
5687     @@@test:domTree:
5688     document {
5689     document-type { }
5690     element { }
5691     }
5692     @@XMLTest:
5693     @@@QName: xp.doctype.intsubset.comment.3.test
5694     @@@DEnt:
5695     @@@@test:value:
5696     <!DOCTYPE a [
5697     <?pi?>
5698     <!---->
5699     ]>
5700     <p/>
5701     @@@test:domTree:
5702     document {
5703     document-type {
5704     pi { }
5705     }
5706     element { }
5707     }
5708     @@XMLTest:
5709     @@@QName: xp.content.comment.1.test
5710     @@@DEnt:
5711     @@@@test:value:
5712     <p><!--comment data--></p>
5713     @@@test:domTree:
5714     document {
5715     element {
5716     comment {
5717     data: 'comment data';
5718     }
5719     }
5720     }
5721     @@XMLTest:
5722     @@@QName: xp.content.comment.2.test
5723     @@@DEnt:
5724     @@@@test:value:
5725     <p><!----></p>
5726     @@@test:domTree:
5727     document {
5728     element {
5729     comment {
5730     data: '';
5731     }
5732     }
5733     }
5734     @@XMLTest:
5735     @@@QName: xp.content.comment.3.test
5736     @@@DEnt:
5737     @@@@test:value:
5738     <p>aaaaa<!---->bbbbb</p>
5739     @@@test:domTree:
5740     document {
5741     element {
5742     text {
5743     data: 'aaaaa';
5744     }
5745     comment {
5746     data: '';
5747     }
5748     text {
5749     data: 'bbbbb';
5750     }
5751     }
5752     }
5753     @@XMLTest:
5754     @@@QName: xp.content.comment.--.1.test
5755     @@@DEnt:
5756     @@@@test:value:
5757     <p><!--data--data--></p>
5758     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 12)..(1, 17); }
5759     @@XMLTest:
5760     @@@QName: xp.content.comment.---gt.test
5761     @@@DEnt:
5762     @@@@test:value:
5763     <p><!--data---></p>
5764     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 12)..(1, 15); }
5765 wakaba 1.13
5766     @@XMLTest:
5767     @@@QName: xp.xmldecl.version.1.0.test
5768     @@@DEnt:
5769     @@@@test:value:
5770     <?xml version="1.0"?>
5771     <p></p>
5772     @@@test:domTree:
5773     document {
5774     xml-version: '1.0';
5775     xml-encoding: null;
5776     xml-standalone: false;
5777     element { }
5778     }
5779     @@XMLTest:
5780     @@@QName: xp.xmldecl.version.1.0.lita.test
5781     @@@DEnt:
5782     @@@@test:value:
5783     <?xml version='1.0'?>
5784     <p></p>
5785     @@@test:domTree:
5786     document {
5787     xml-version: '1.0';
5788     xml-encoding: null;
5789     xml-standalone: false;
5790     element { }
5791     }
5792     @@XMLTest:
5793     @@@QName: xp.xmldecl.version.1.0.s.test
5794     @@@DEnt:
5795     @@@@test:value:
5796     <?xml version = "1.0" ?>
5797     <p></p>
5798     @@@test:domTree:
5799     document {
5800     xml-version: '1.0';
5801     xml-encoding: null;
5802     xml-standalone: false;
5803     element { }
5804     }
5805     @@XMLTest:
5806     @@@QName: xp.xmldecl.version.1.1.test
5807     @@@DEnt:
5808     @@@@test:value:
5809     <?xml version="1.1"?>
5810     <p></p>
5811     @@@test:domTree:
5812     document {
5813     xml-version: '1.1';
5814     xml-encoding: null;
5815     xml-standalone: false;
5816     element { }
5817     }
5818    
5819     @@XMLTest:
5820     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.test
5821     @@@DEnt:
5822     @@@@test:value:
5823     <?xml version="1.0" encoding="US-ascii"?>
5824     <p></p>
5825     @@@test:domTree:
5826     document {
5827     xml-version: '1.0';
5828     xml-encoding: 'US-ascii';
5829     xml-standalone: false;
5830     element { }
5831     }
5832     @@XMLTest:
5833     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.lita.test
5834     @@@DEnt:
5835     @@@@test:value:
5836     <?xml version="1.0" encoding='US-ascii'?>
5837     <p></p>
5838     @@@test:domTree:
5839     document {
5840     xml-version: '1.0';
5841     xml-encoding: 'US-ascii';
5842     xml-standalone: false;
5843     element { }
5844     }
5845     @@XMLTest:
5846     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.s.test
5847     @@@DEnt:
5848     @@@@test:value:
5849     <?xml version="1.0" encoding = "US-ascii" ?>
5850     <p></p>
5851     @@@test:domTree:
5852     document {
5853     xml-version: '1.0';
5854     xml-encoding: 'US-ascii';
5855     xml-standalone: false;
5856     element { }
5857     }
5858    
5859     @@XMLTest:
5860     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.standalone.yes.test
5861     @@@DEnt:
5862     @@@@test:value:
5863     <?xml version="1.0" encoding="us-ascii" standalone="yes"?>
5864     <p></p>
5865     @@@test:domTree:
5866     document {
5867     xml-version: '1.0';
5868     xml-encoding: 'us-ascii';
5869     xml-standalone: true;
5870     element { }
5871     }
5872     @@XMLTest:
5873     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.standalone.no.test
5874     @@@DEnt:
5875     @@@@test:value:
5876     <?xml version="1.0" encoding="us-ascii" standalone="no"?>
5877     <p></p>
5878     @@@test:domTree:
5879     document {
5880     xml-version: '1.0';
5881     xml-encoding: 'us-ascii';
5882     xml-standalone: false;
5883     element { }
5884     }
5885     @@XMLTest:
5886     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.standalone.yes.lita.test
5887     @@@DEnt:
5888     @@@@test:value:
5889     <?xml version="1.0" encoding="us-ascii" standalone='yes'?>
5890     <p></p>
5891     @@@test:domTree:
5892     document {
5893     xml-version: '1.0';
5894     xml-encoding: 'us-ascii';
5895     xml-standalone: true;
5896     element { }
5897     }
5898     @@XMLTest:
5899     @@@QName: xp.xmldecl.version.1.0.encoding.usascii.standalone.yes.s.test
5900     @@@DEnt:
5901     @@@@test:value:
5902     <?xml version="1.0" encoding="us-ascii" standalone = "yes" ?>
5903     <p></p>
5904     @@@test:domTree:
5905     document {
5906     xml-version: '1.0';
5907     xml-encoding: 'us-ascii';
5908     xml-standalone: true;
5909     element { }
5910     }
5911 wakaba 1.14 @@XMLTest:
5912     @@@QName: xp.xmldecl.no.encoding.but.standalone.attr.test
5913     @@@DEnt:
5914     @@@@test:value:
5915     <?xml version="1.0" standalone="yes"?>
5916     <p></p>
5917     @@@test:domTree:
5918     document {
5919     xml-version: '1.0';
5920     xml-encoding: null;
5921     xml-standalone: true;
5922     element { }
5923     }
5924     @@XMLTest:
5925     @@@QName: xp.xmldecl.encoding.encname.test
5926     @@@DEnt:
5927     @@@@test:value:
5928     <?xml version="1.0" encoding="a-._01-"?>
5929     <p></p>
5930     @@@test:domTree:
5931     document {
5932     xml-version: '1.0';
5933     xml-encoding: 'a-._01-';
5934     xml-standalone: false;
5935     element { }
5936     }
5937    
5938     @@XMLTest:
5939     @@@QName: xp.xmldecl.no.s.no.attr.test
5940     @@@DEnt:
5941     @@@@test:value:
5942     <?xml?>
5943     <p></p>
5944     @@@c:erred:
5945 wakaba 1.16 <[[xp:wf-syntax-error]]> { (1, 1)..(1, 7); }
5946 wakaba 1.14 @@XMLTest:
5947     @@@QName: xp.xmldecl.s.no.attr.test
5948     @@@DEnt:
5949     @@@@test:value:
5950     <?xml ?>
5951     <p></p>
5952     @@@c:erred:
5953     <[[xp:wf-syntax-error]]> { (1, 8)..(1, 9); }
5954     @@XMLTest:
5955     @@@QName: xp.xmldecl.unknown.attr.test
5956     @@@DEnt:
5957     @@@@test:value:
5958     <?xml unknown="value"?>
5959     <p></p>
5960     @@@c:erred:
5961     <[[xp:wf-syntax-error]]> { (1, 8)..(1, 22); }
5962     @@XMLTest:
5963     @@@QName: xp.xmldecl.version.unknown.attr.test
5964     @@@DEnt:
5965     @@@@test:value:
5966     <?xml version="1.0" unknown="value"?>
5967     <p></p>
5968     @@@c:erred:
5969     <[[xp:wf-syntax-error]]> { (1, 21)..(1, 35); }
5970     @@XMLTest:
5971     @@@QName: xp.xmldecl.version.encoding.unknown.attr.test
5972     @@@DEnt:
5973     @@@@test:value:
5974     <?xml version="1.0" encoding="us-ascii" unknown="value"?>
5975     <p></p>
5976     @@@c:erred:
5977     <[[xp:wf-syntax-error]]> { (1, 41)..(1, 55); }
5978     @@XMLTest:
5979     @@@QName: xp.xmldecl.version.encoding.standalone.unknown.attr.test
5980     @@@DEnt:
5981     @@@@test:value:
5982     <?xml version="1.0" encoding="us-ascii" standalone="yes"
5983     unknown="value"?>
5984     <p></p>
5985     @@@c:erred:
5986     <[[xp:wf-syntax-error]]> { (2, 1)..(2, 15); }
5987     @@XMLTest:
5988     @@@QName: xp.xmldecl.no.version.but.encoding.attr.test
5989     @@@DEnt:
5990     @@@@test:value:
5991     <?xml encoding="us-ascii"?>
5992     <p></p>
5993     @@@c:erred:
5994     <[[xp:wf-syntax-error]]> { (1, 7)..(1, 25); }
5995     @@XMLTest:
5996     @@@QName: xp.xmldecl.no.version.but.standalone.attr.test
5997     @@@DEnt:
5998     @@@@test:value:
5999     <?xml standalone="yes"?>
6000     <p></p>
6001     @@@c:erred:
6002     <[[xp:wf-syntax-error]]> { (1, 7)..(1, 24); }
6003     @@XMLTest:
6004     @@@QName: xp.xmldecl.version.unsupported.test
6005     @@@DEnt:
6006     @@@@test:value:
6007     <?xml version="1.2"?>
6008     <p></p>
6009     @@@c:erred:
6010     <[[xp:wf-unsupported-xml-version]]> { (1, 7)..(1, 19); }
6011     @@XMLTest:
6012     @@@QName: xp.xmldecl.version.unsupported.2.test
6013     @@@DEnt:
6014     @@@@test:value:
6015     <?xml version=" 1.0 "?>
6016     <p></p>
6017     @@@c:erred:
6018     <[[xp:wf-unsupported-xml-version]]> { (1, 7)..(1, 21); }
6019     @@XMLTest:
6020     @@@QName: xp.xmldecl.version.unsupported.3.test
6021     @@@DEnt:
6022     @@@@test:value:
6023     <?xml version="01.00"?>
6024     <p></p>
6025     @@@c:erred:
6026     <[[xp:wf-unsupported-xml-version]]> { (1, 7)..(1, 21); }
6027     @@XMLTest:
6028     @@@QName: xp.xmldecl.encoding.malformed.1.test
6029     @@@DEnt:
6030     @@@@test:value:
6031     <?xml version="1.0" encoding="0088"?>
6032     <p></p>
6033     @@@c:erred:
6034     <[[xp:wf-malformed-enc-name]]> { (1, 21)..(1, 35); }
6035     @@XMLTest:
6036     @@@QName: xp.xmldecl.encoding.malformed.2.test
6037     @@@DEnt:
6038     @@@@test:value:
6039     <?xml version="1.0" encoding="D.V.D!"?>
6040     <p></p>
6041     @@@c:erred:
6042     <[[xp:wf-malformed-enc-name]]> { (1, 21)..(1, 38); }
6043     @@XMLTest:
6044     @@@QName: xp.xmldecl.standalone.malformed.1.test
6045     @@@DEnt:
6046     @@@@test:value:
6047     <?xml version="1.0" standalone="true"?>
6048     <p></p>
6049     @@@c:erred:
6050     <[[xp:wf-malformed-xml-standalone]]> { (1, 21)..(1, 38); }
6051     @@XMLTest:
6052     @@@QName: xp.xmldecl.standalone.malformed.2.test
6053     @@@DEnt:
6054     @@@@test:value:
6055     <?xml version="1.0" standalone="YES"?>
6056     <p></p>
6057     @@@c:erred:
6058     <[[xp:wf-malformed-xml-standalone]]> { (1, 21)..(1, 37); }
6059     @@XMLTest:
6060     @@@QName: xp.xmldecl.standalone.malformed.3.test
6061     @@@DEnt:
6062     @@@@test:value:
6063     <?xml version="1.0" standalone="no "?>
6064     <p></p>
6065     @@@c:erred:
6066     <[[xp:wf-malformed-xml-standalone]]> { (1, 21)..(1, 38); }
6067 wakaba 1.6
6068     @@XMLTest:
6069 wakaba 1.14 @@@QName: xp.no-xmldecl.xml...-pi.test
6070     @@@DEnt:
6071     @@@@test:value:
6072     <?xmldeclaration?>
6073     <a></a>
6074     @@@test:domTree:
6075     document {
6076     pi {
6077     node-name: 'xmldeclaration';
6078     node-value: '';
6079     }
6080     element { }
6081     }
6082     @@XMLTest:
6083     @@@QName: xp.no-xmldecl.xml...-pi.after.document.element.test
6084     @@@DEnt:
6085     @@@@test:value:
6086     <a></a>
6087     <?xmldeclaration?>
6088     @@@test:domTree:
6089     document {
6090     element { }
6091     pi {
6092     node-name: 'xmldeclaration';
6093     node-value: '';
6094     }
6095     }
6096     @@XMLTest:
6097     @@@QName: xp.no-xmldecl.xml...-pi.in.document.element.test
6098     @@@DEnt:
6099     @@@@test:value:
6100     <a>
6101     <?xmldeclaration?>
6102     </a>
6103     @@@test:domTree:
6104     document {
6105     element {
6106     text { }
6107     pi {
6108     node-name: 'xmldeclaration';
6109     node-value: '';
6110     }
6111     text { }
6112     }
6113     }
6114     @@XMLTest:
6115     @@@QName: xp.no-xmldecl.xml...-pi.in.doctype.test
6116     @@@DEnt:
6117     @@@@test:value:
6118     <!DOCTYPE a [
6119     <?xmldeclaration?>
6120     ]>
6121     <a></a>
6122     @@@test:domTree:
6123     document {
6124     document-type {
6125     pi {
6126     node-name: 'xmldeclaration';
6127     node-value: '';
6128     }
6129     }
6130     element { }
6131     }
6132    
6133     @@XMLTest:
6134     @@@QName: xp.XMLdecl.test
6135     @@@DEnt:
6136     @@@@test:value:
6137     <?XML version="1.0"?>
6138     <p></p>
6139     @@@c:erred:
6140     <[[xp:wf-pi-target-is-xml]]> { (1, 1)..(1, 5); }
6141     @@XMLTest:
6142     @@@QName: xp.Xmldecl.test
6143     @@@DEnt:
6144     @@@@test:value:
6145     <?Xml version="1.0"?>
6146     <p></p>
6147     @@@c:erred:
6148     <[[xp:wf-pi-target-is-xml]]> { (1, 1)..(1, 5); }
6149     @@XMLTest:
6150     @@@QName: xp.xmldecl.after.document.element.empty.test
6151     @@@DEnt:
6152     @@@@test:value:
6153     <p></p>
6154     <?xml?>
6155     @@@c:erred:
6156     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6157     @@XMLTest:
6158     @@@QName: xp.xmldecl.after.document.element.test
6159     @@@DEnt:
6160     @@@@test:value:
6161     <p></p>
6162     <?xml version="1.0"?>
6163     @@@c:erred:
6164     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6165     @@XMLTest:
6166     @@@QName: xp.xmldecl.in.element.empty.test
6167     @@@DEnt:
6168     @@@@test:value:
6169     <p>
6170     <?xml?>
6171     </p>
6172     @@@c:erred:
6173     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6174     @@XMLTest:
6175     @@@QName: xp.xmldecl.in.element.test
6176     @@@DEnt:
6177     @@@@test:value:
6178     <p>
6179     <?xml version="1.0"?>
6180     </p>
6181     @@@c:erred:
6182     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6183     @@XMLTest:
6184     @@@QName: xp.xmldecl.after.comment.test
6185     @@@DEnt:
6186     @@@@test:value:
6187     <!---->
6188     <?xml version="1.0"?>
6189     <p></p>
6190     @@@c:erred:
6191     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6192     @@XMLTest:
6193     @@@QName: xp.xmldecl.after.comment.empty.test
6194     @@@DEnt:
6195     @@@@test:value:
6196     <!---->
6197     <?xml?>
6198     <p></p>
6199     @@@c:erred:
6200     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6201     @@XMLTest:
6202     @@@QName: xp.xmldecl.after.pi.test
6203     @@@DEnt:
6204     @@@@test:value:
6205     <?xml-declaration?>
6206     <?xml version="1.0"?>
6207     <p></p>
6208     @@@c:erred:
6209     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6210     @@XMLTest:
6211     @@@QName: xp.xmldecl.after.pi.empty.test
6212     @@@DEnt:
6213     @@@@test:value:
6214     <?xml-declaration?>
6215     <?xml?>
6216     <p></p>
6217     @@@c:erred:
6218     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6219     @@XMLTest:
6220 wakaba 1.16 @@@QName: xp.xmldecl.after.pi.2.test
6221     @@@DEnt:
6222     @@@@test:value:
6223     <?declaration?>
6224     <?xml version="1.0"?>
6225     <p></p>
6226     @@@c:erred:
6227     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6228     @@XMLTest:
6229     @@@QName: xp.xmldecl.after.pi.empty.2.test
6230     @@@DEnt:
6231     @@@@test:value:
6232     <?declaration?>
6233     <?xml?>
6234     <p></p>
6235     @@@c:erred:
6236     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6237     @@XMLTest:
6238 wakaba 1.14 @@@QName: xp.xmldecl.after.doctype.test
6239     @@@DEnt:
6240     @@@@test:value:
6241     <!DOCTYPE a>
6242     <?xml version="1.0"?>
6243     <p></p>
6244     @@@c:erred:
6245     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6246     @@XMLTest:
6247     @@@QName: xp.xmldecl.after.doctype.empty.test
6248     @@@DEnt:
6249     @@@@test:value:
6250     <!DOCTYPE a>
6251     <?xml?>
6252     <p></p>
6253     @@@c:erred:
6254     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6255     @@XMLTest:
6256     @@@QName: xp.xmldecl.in.doctype.test
6257     @@@DEnt:
6258     @@@@test:value:
6259     <!DOCTYPE a [
6260     <?xml version="1.0"?>
6261     ]>
6262     <p></p>
6263     @@@c:erred:
6264     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6265     @@XMLTest:
6266     @@@QName: xp.xmldecl.in.doctype.empty.test
6267     @@@DEnt:
6268     @@@@test:value:
6269     <!DOCTYPE a [
6270     <?xml?>
6271     ]>
6272     <p></p>
6273     @@@c:erred:
6274     <[[xp:wf-pi-target-is-xml]]> { (2, 1)..(2, 5); }
6275    
6276     @@XMLTest:
6277     @@@QName: xp.pi.before.element.empty.test
6278     @@@DEnt:
6279     @@@@test:value:
6280     <?target?>
6281     <a></a>
6282     @@@test:domTree:
6283     document {
6284     pi {
6285     node-name: 'target';
6286     node-value: '';
6287     }
6288     element { }
6289     }
6290     @@XMLTest:
6291     @@@QName: xp.pi.before.element.s.test
6292     @@@DEnt:
6293     @@@@test:value:
6294     <?target ?>
6295     <a></a>
6296     @@@test:domTree:
6297     document {
6298     pi {
6299     node-name: 'target';
6300     node-value: '';
6301     }
6302     element { }
6303     }
6304     @@XMLTest:
6305     @@@QName: xp.pi.before.element.string.test
6306     @@@DEnt:
6307     @@@@test:value:
6308     <?target string?>
6309     <a></a>
6310     @@@test:domTree:
6311     document {
6312     pi {
6313     node-name: 'target';
6314     node-value: 'string';
6315     }
6316     element { }
6317     }
6318     @@XMLTest:
6319     @@@QName: xp.pi.before.element.string.s.test
6320     @@@DEnt:
6321     @@@@test:value:
6322     <?target string ?>
6323     <a></a>
6324     @@@test:domTree:
6325     document {
6326     pi {
6327     node-name: 'target';
6328     node-value: 'string ';
6329     }
6330     element { }
6331     }
6332     @@XMLTest:
6333     @@@QName: xp.pi.before.element.gt.test
6334     @@@DEnt:
6335     @@@@test:value:
6336     <?target string>string?>
6337     <a></a>
6338     @@@test:domTree:
6339     document {
6340     pi {
6341     node-name: 'target';
6342     node-value: 'string>string';
6343     }
6344     element { }
6345     }
6346     @@XMLTest:
6347     @@@QName: xp.pi.doctype.empty.test
6348     @@@DEnt:
6349     @@@@test:value:
6350     <!DOCTYPE a [
6351     <?target?>
6352     ]>
6353     <a></a>
6354     @@@test:domTree:
6355     document {
6356     document-type {
6357     pi {
6358     node-name: 'target';
6359     node-value: '';
6360     }
6361     }
6362     element { }
6363     }
6364    
6365     @@XMLTest:
6366     @@@QName: xp.pi.no.target.test
6367     @@@DEnt:
6368     @@@@test:value:
6369     <??>
6370     <p></p>
6371     @@@c:erred:
6372     <[[xp:wf-syntax-error]]> { (1, 3)..(1, 4); }
6373     @@XMLTest:
6374     @@@QName: xp.pi.no.target.2.test
6375     @@@DEnt:
6376     @@@@test:value:
6377     <? ?>
6378     <p></p>
6379     @@@c:erred:
6380     <[[xp:wf-syntax-error]]> { (1, 3)..(1, 4); }
6381     @@XMLTest:
6382     @@@QName: xp.pi.bad.target.1.test
6383     @@@DEnt:
6384     @@@@test:value:
6385     <?target! ?>
6386     <p></p>
6387     @@@c:erred:
6388     <[[xp:wf-syntax-error]]> { (1, 9)..(1, 9); }
6389     @@XMLTest:
6390     @@@QName: xp.pi.bad.target.2.test
6391     @@@DEnt:
6392     @@@@test:value:
6393     <?0target ?>
6394     <p></p>
6395     @@@c:erred:
6396     <[[xp:wf-syntax-error]]> { (1, 3)..(1, 3); }
6397    
6398     @@XMLTest:
6399 wakaba 1.15 @@@QName: xp.cdatasection.empty.1.test
6400     @@@DEnt:
6401     @@@@test:value:
6402     <p><![CDATA[]]></p>
6403     @@@test:domTree:
6404     document {
6405     element {
6406     cdata-section {
6407     data: '';
6408     }
6409     }
6410     }
6411     @@XMLTest:
6412     @@@QName: xp.cdatasection.empty.2.test
6413     @@@DEnt:
6414     @@@@test:value:
6415     <p>aa<![CDATA[]]>bb</p>
6416     @@@test:domTree:
6417     document {
6418     element {
6419     text { data: 'aa'; }
6420     cdata-section {
6421     data: '';
6422     }
6423     text { data: 'bb'; }
6424     }
6425     }
6426     @@XMLTest:
6427     @@@QName: xp.cdatasection.1.test
6428     @@@DEnt:
6429     @@@@test:value:
6430     <p><![CDATA[abcdefg]]></p>
6431     @@@test:domTree:
6432     document {
6433     element {
6434     cdata-section {
6435     data: 'abcdefg';
6436     }
6437     }
6438     }
6439     @@XMLTest:
6440     @@@QName: xp.cdatasection.2.test
6441     @@@DEnt:
6442     @@@@test:value:
6443     <p>aa<![CDATA[abcdefg]]>bb</p>
6444     @@@test:domTree:
6445     document {
6446     element {
6447     text { data: 'aa'; }
6448     cdata-section {
6449     data: 'abcdefg';
6450     }
6451     text { data: 'bb'; }
6452     }
6453     }
6454     @@XMLTest:
6455     @@@QName: xp.cdatasection.ref.1.test
6456     @@@DEnt:
6457     @@@@test:value:
6458     <p><![CDATA[a&amp;&#x32;&#32;%abc;&def;]]&gt;b]]></p>
6459     @@@test:domTree:
6460     document {
6461     element {
6462     cdata-section {
6463     data: 'a&amp;&#x32;&#32;%abc;&def;]]&gt;b';
6464     }
6465     }
6466     }
6467     @@XMLTest:
6468     @@@QName: xp.cdatasection.in.general.entity.test
6469     @@@DEnt:
6470     @@@@test:value:
6471     <!DOCTYPE p [
6472     <!ENTITY cdata "<![CDATA[text]]>">
6473     ]>
6474     <p>&cdata;</p>
6475 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
6476 wakaba 1.15 @@@test:domTree:
6477     document {
6478     document-type {
6479     general-entity {
6480     node-name: 'cdata';
6481     cdata-section {
6482     data: 'text';
6483     }
6484     }
6485     }
6486     element {
6487     general-entity-reference {
6488 wakaba 1.23 node-name: 'cdata';
6489 wakaba 1.34 manakai-expanded: true;
6490 wakaba 1.15 cdata-section {
6491     data: 'text';
6492     }
6493     }
6494     }
6495     }
6496     @@XMLTest:
6497     @@@QName: xp.cdatasection.no.mse.test
6498     @@@DEnt:
6499     @@@@test:value:
6500     <p><![CDATA[text</p>
6501     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 21); }
6502     @@XMLTest:
6503     @@@QName: xp.cdatasection.nest.test
6504     @@@DEnt:
6505     @@@@test:value:
6506     <p><![CDATA[text01<![CDATA[txt2]]>text3]]></p>
6507     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 40)..(1, 42); }
6508    
6509     @@XMLTest:
6510 wakaba 1.6 @@@QName: xp.doctype.empty.test
6511     @@@DEnt:
6512     @@@@test:value:
6513     <!DOCTYPE a>
6514     <a></a>
6515     @@@test:domTree:
6516     document {
6517     xml-version: '1.0';
6518     xml-encoding: null;
6519     xml-standalone: false;
6520     document-type {
6521     node-name: 'a';
6522 wakaba 1.17 public-id: null;
6523     system-id: null;
6524 wakaba 1.6 }
6525     element {
6526     namespace-uri: null;
6527     prefix: null;
6528     local-name: 'a';
6529     text-content: '';
6530     }
6531     }
6532 wakaba 1.15 @@XMLTest:
6533     @@@QName: xp.doctype.empty.after.document.element.test
6534     @@@DEnt:
6535     @@@@test:value:
6536     <a></a>
6537     <!DOCTYPE a>
6538     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1)..(2, 12); }
6539     @@XMLTest:
6540     @@@QName: xp.doctype.empty.in.element.test
6541     @@@DEnt:
6542     @@@@test:value:
6543     <a>
6544     <!DOCTYPE a>
6545     </a>
6546     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1)..(2, 12); }
6547     @@XMLTest:
6548     @@@QName: xp.doctype.empty.dup.test
6549     @@@DEnt:
6550     @@@@test:value:
6551     <!DOCTYPE a>
6552     <!DOCTYPE a>
6553     <a></a>
6554     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1)..(2, 12); }
6555     @@XMLTest:
6556     @@@QName: xp.doctype.empty.in.intsubset.test
6557     @@@DEnt:
6558     @@@@test:value:
6559     <!DOCTYPE a [
6560     <!DOCTYPE a>
6561     ]>
6562     <a></a>
6563     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1)..(2, 12); }
6564 wakaba 1.16 @@XMLTest:
6565     @@@QName: xp.doctype.no.s.no.name.test
6566     @@@DEnt:
6567     @@@@test:value:
6568     <!DOCTYPE>
6569     <a></a>
6570     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 10); }
6571     @@XMLTest:
6572     @@@QName: xp.doctype.no.name.test
6573     @@@DEnt:
6574     @@@@test:value:
6575     <!DOCTYPE >
6576     <a></a>
6577     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 11); }
6578     @@XMLTest:
6579     @@@QName: xp.doctype.name.s.test
6580     @@@DEnt:
6581     @@@@test:value:
6582     <!DOCTYPE aa >
6583     <aa></aa>
6584     @@@test:domTree:
6585     document {
6586     document-type {
6587     node-name: 'aa';
6588 wakaba 1.17 public-id: null;
6589     system-id: null;
6590 wakaba 1.16 }
6591     element { }
6592     }
6593     @@XMLTest:
6594     @@@QName: xp.doctype.no.mdc.test
6595     @@@DEnt:
6596     @@@@test:value:
6597     <!DOCTYPE aa
6598     <aa></aa>
6599     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1); }
6600 wakaba 1.6
6601     @@XMLTest:
6602 wakaba 1.16 @@@QName: xp.doctype.intsubset.empty.1.test
6603 wakaba 1.6 @@@DEnt:
6604     @@@@test:value:
6605 wakaba 1.16 <!DOCTYPE a []>
6606 wakaba 1.6 <a></a>
6607     @@@test:domTree:
6608     document {
6609     xml-version: '1.0';
6610     xml-encoding: null;
6611     xml-standalone: false;
6612     document-type {
6613     node-name: 'a';
6614 wakaba 1.17 public-id: null;
6615     system-id: null;
6616 wakaba 1.6 }
6617     element {
6618     namespace-uri: null;
6619     prefix: null;
6620     local-name: 'a';
6621     text-content: '';
6622     }
6623     }
6624     @@XMLTest:
6625 wakaba 1.16 @@@QName: xp.doctype.intsubset.empty.2.test
6626 wakaba 1.6 @@@DEnt:
6627     @@@@test:value:
6628     <!DOCTYPE a [
6629 wakaba 1.16
6630 wakaba 1.6 ]>
6631     <a></a>
6632     @@@test:domTree:
6633     document {
6634     xml-version: '1.0';
6635     xml-encoding: null;
6636     xml-standalone: false;
6637     document-type {
6638     node-name: 'a';
6639 wakaba 1.17 public-id: null;
6640     system-id: null;
6641 wakaba 1.6 }
6642     element {
6643     namespace-uri: null;
6644     prefix: null;
6645     local-name: 'a';
6646     text-content: '';
6647     }
6648     }
6649     @@XMLTest:
6650 wakaba 1.16 @@@QName: xp.doctype.intsubset.empty.3.test
6651 wakaba 1.6 @@@DEnt:
6652     @@@@test:value:
6653 wakaba 1.16 <!DOCTYPE a[]>
6654 wakaba 1.6 <a></a>
6655     @@@test:domTree:
6656     document {
6657     document-type {
6658     node-name: 'a';
6659 wakaba 1.17 public-id: null;
6660     system-id: null;
6661 wakaba 1.6 }
6662 wakaba 1.16 element { }
6663     }
6664     @@XMLTest:
6665     @@@QName: xp.doctype.intsubset.empty.4.test
6666     @@@DEnt:
6667     @@@@test:value:
6668     <!DOCTYPE a[] >
6669     <a></a>
6670     @@@test:domTree:
6671     document {
6672     document-type {
6673     node-name: 'a';
6674 wakaba 1.17 public-id: null;
6675     system-id: null;
6676 wakaba 1.6 }
6677 wakaba 1.16 element { }
6678 wakaba 1.6 }
6679     @@XMLTest:
6680 wakaba 1.16 @@@QName: xp.doctype.intsubset.no.dsc.1.test
6681     @@@DEnt:
6682     @@@@test:value:
6683     <!DOCTYPE a [>
6684     <a></a>
6685     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 14); }
6686     @@XMLTest:
6687     @@@QName: xp.doctype.intsubset.no.dsc.2.test
6688 wakaba 1.6 @@@DEnt:
6689     @@@@test:value:
6690     <!DOCTYPE a [
6691     <a></a>
6692 wakaba 1.16 @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1); }
6693     @@XMLTest:
6694     @@@QName: xp.doctype.intsubset.no.dsc.3.test
6695     @@@DEnt:
6696     @@@@test:value:
6697     <!DOCTYPE a [
6698     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 14); }
6699     @@XMLTest:
6700     @@@QName: xp.doctype.intsubset.no.mdc.1.test
6701     @@@DEnt:
6702     @@@@test:value:
6703     <!DOCTYPE a []
6704     <a/>
6705     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 1); }
6706     @@XMLTest:
6707     @@@QName: xp.doctype.intsubset.no.mdc.2.test
6708     @@@DEnt:
6709     @@@@test:value:
6710     <!DOCTYPE a []]>
6711     <a/>
6712     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 15); }
6713 wakaba 1.17 @@XMLTest:
6714     @@@QName: xp.doctype.pubid.sysid.1.test
6715     @@@DEnt:
6716     @@@@test:value:
6717     <!DOCTYPE a PUBLIC "pubid" "sysid">
6718     <a/>
6719     @@@test:domTree:
6720     document {
6721     document-type {
6722     node-name: 'a';
6723     public-id: 'pubid';
6724     system-id: 'sysid';
6725     }
6726     element { }
6727     }
6728     @@XMLTest:
6729     @@@QName: xp.doctype.pubid.sysid.2.test
6730     @@@DEnt:
6731     @@@@test:value:
6732     <!DOCTYPE a PUBLIC 'pubid' "sysid">
6733     <a/>
6734     @@@test:domTree:
6735     document {
6736     document-type {
6737     node-name: 'a';
6738     public-id: 'pubid';
6739     system-id: 'sysid';
6740     }
6741     element { }
6742     }
6743     @@XMLTest:
6744     @@@QName: xp.doctype.pubid.sysid.3.test
6745     @@@DEnt:
6746     @@@@test:value:
6747     <!DOCTYPE a PUBLIC "pubid" 'sysid'>
6748     <a/>
6749     @@@test:domTree:
6750     document {
6751     document-type {
6752     node-name: 'a';
6753     public-id: 'pubid';
6754     system-id: 'sysid';
6755     }
6756     element { }
6757     }
6758     @@XMLTest:
6759     @@@QName: xp.doctype.pubid.sysid.4.test
6760     @@@DEnt:
6761     @@@@test:value:
6762     <!DOCTYPE a PUBLIC 'pubid' 'sysid'>
6763     <a/>
6764     @@@test:domTree:
6765     document {
6766     document-type {
6767     node-name: 'a';
6768     public-id: 'pubid';
6769     system-id: 'sysid';
6770     }
6771     element { }
6772     }
6773     @@XMLTest:
6774     @@@QName: xp.doctype.pubid.sysid.5.test
6775     @@@DEnt:
6776     @@@@test:value:
6777     <!DOCTYPE a PUBLIC "pubid" "sysid" >
6778     <a/>
6779     @@@test:domTree:
6780     document {
6781     document-type {
6782     node-name: 'a';
6783     public-id: 'pubid';
6784     system-id: 'sysid';
6785     }
6786     element { }
6787     }
6788     @@XMLTest:
6789     @@@QName: xp.doctype.pubid.sysid.6.test
6790     @@@DEnt:
6791     @@@@test:value:
6792     <!DOCTYPE a PUBLIC 'pubid' 'sysid' >
6793     <a/>
6794     @@@test:domTree:
6795     document {
6796     document-type {
6797     node-name: 'a';
6798     public-id: 'pubid';
6799     system-id: 'sysid';
6800     }
6801     element { }
6802     }
6803     @@XMLTest:
6804     @@@QName: xp.doctype.pubid.sysid.intsubset.1.test
6805     @@@DEnt:
6806     @@@@test:value:
6807     <!DOCTYPE a PUBLIC "pubid" "sysid"[]>
6808     <a/>
6809     @@@test:domTree:
6810     document {
6811     document-type {
6812     node-name: 'a';
6813     public-id: 'pubid';
6814     system-id: 'sysid';
6815     }
6816     element { }
6817     }
6818     @@XMLTest:
6819     @@@QName: xp.doctype.pubid.sysid.intsubset.2.test
6820     @@@DEnt:
6821     @@@@test:value:
6822     <!DOCTYPE a PUBLIC "pubid" "sysid" []>
6823     <a/>
6824     @@@test:domTree:
6825     document {
6826     document-type {
6827     node-name: 'a';
6828     public-id: 'pubid';
6829     system-id: 'sysid';
6830     }
6831     element { }
6832     }
6833     @@XMLTest:
6834     @@@QName: xp.doctype.pubid.sysid.intsubset.3.test
6835     @@@DEnt:
6836     @@@@test:value:
6837     <!DOCTYPE a PUBLIC 'pubid' 'sysid'[]>
6838     <a/>
6839     @@@test:domTree:
6840     document {
6841     document-type {
6842     node-name: 'a';
6843     public-id: 'pubid';
6844     system-id: 'sysid';
6845     }
6846     element { }
6847     }
6848     @@XMLTest:
6849     @@@QName: xp.doctype.pubid.sysid.intsubset.4.test
6850     @@@DEnt:
6851     @@@@test:value:
6852     <!DOCTYPE a PUBLIC 'pubid' 'sysid' []>
6853     <a/>
6854     @@@test:domTree:
6855     document {
6856     document-type {
6857     node-name: 'a';
6858     public-id: 'pubid';
6859     system-id: 'sysid';
6860     }
6861     element { }
6862     }
6863     @@XMLTest:
6864     @@@QName: xp.doctype.sysid.1.test
6865     @@@DEnt:
6866     @@@@test:value:
6867     <!DOCTYPE a SYSTEM "sysid">
6868     <a/>
6869     @@@test:domTree:
6870     document {
6871     document-type {
6872     node-name: 'a';
6873     public-id: null;
6874     system-id: 'sysid';
6875     }
6876     element { }
6877     }
6878     @@XMLTest:
6879     @@@QName: xp.doctype.sysid.2.test
6880     @@@DEnt:
6881     @@@@test:value:
6882     <!DOCTYPE a SYSTEM 'sysid'>
6883     <a/>
6884     @@@test:domTree:
6885     document {
6886     document-type {
6887     node-name: 'a';
6888     public-id: null;
6889     system-id: 'sysid';
6890     }
6891     element { }
6892     }
6893     @@XMLTest:
6894     @@@QName: xp.doctype.sysid.3.test
6895     @@@DEnt:
6896     @@@@test:value:
6897     <!DOCTYPE a SYSTEM "sysid" >
6898     <a/>
6899     @@@test:domTree:
6900     document {
6901     document-type {
6902     node-name: 'a';
6903     public-id: null;
6904     system-id: 'sysid';
6905     }
6906     element { }
6907     }
6908     @@XMLTest:
6909     @@@QName: xp.doctype.sysid.4.test
6910     @@@DEnt:
6911     @@@@test:value:
6912     <!DOCTYPE a SYSTEM 'sysid' >
6913     <a/>
6914     @@@test:domTree:
6915     document {
6916     document-type {
6917     node-name: 'a';
6918     public-id: null;
6919     system-id: 'sysid';
6920     }
6921     element { }
6922     }
6923     @@XMLTest:
6924     @@@QName: xp.doctype.sysid.intsubset.1.test
6925     @@@DEnt:
6926     @@@@test:value:
6927     <!DOCTYPE a SYSTEM "sysid"[]>
6928     <a/>
6929     @@@test:domTree:
6930     document {
6931     document-type {
6932     node-name: 'a';
6933     public-id: null;
6934     system-id: 'sysid';
6935     }
6936     element { }
6937     }
6938     @@XMLTest:
6939     @@@QName: xp.doctype.sysid.intsubset.2.test
6940     @@@DEnt:
6941     @@@@test:value:
6942     <!DOCTYPE a SYSTEM "sysid" []>
6943     <a/>
6944     @@@test:domTree:
6945     document {
6946     document-type {
6947     node-name: 'a';
6948     public-id: null;
6949     system-id: 'sysid';
6950     }
6951     element { }
6952     }
6953     @@XMLTest:
6954     @@@QName: xp.doctype.sysid.intsubset.3.test
6955     @@@DEnt:
6956     @@@@test:value:
6957     <!DOCTYPE a SYSTEM 'sysid'[]>
6958     <a/>
6959     @@@test:domTree:
6960     document {
6961     document-type {
6962     node-name: 'a';
6963     public-id: null;
6964     system-id: 'sysid';
6965     }
6966     element { }
6967     }
6968     @@XMLTest:
6969     @@@QName: xp.doctype.sysid.intsubset.4.test
6970     @@@DEnt:
6971     @@@@test:value:
6972     <!DOCTYPE a SYSTEM 'sysid' []>
6973     <a/>
6974     @@@test:domTree:
6975     document {
6976     document-type {
6977     node-name: 'a';
6978     public-id: null;
6979     system-id: 'sysid';
6980     }
6981     element { }
6982     }
6983     @@XMLTest:
6984     @@@QName: xp.doctype.public.stago.test
6985     @@@DEnt:
6986     @@@@test:value:
6987     <!DOCTYPE a PUBLIC<a/>
6988     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 19); }
6989     @@XMLTest:
6990     @@@QName: xp.doctype.public.mdc.test
6991     @@@DEnt:
6992     @@@@test:value:
6993     <!DOCTYPE a PUBLIC>
6994     <a/>
6995     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 19); }
6996     @@XMLTest:
6997     @@@QName: xp.doctype.public.s.stago.test
6998     @@@DEnt:
6999     @@@@test:value:
7000     <!DOCTYPE a PUBLIC <a/>
7001     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 20); }
7002     @@XMLTest:
7003     @@@QName: xp.doctype.public.s.mdc.test
7004     @@@DEnt:
7005     @@@@test:value:
7006     <!DOCTYPE a PUBLIC >
7007     <a/>
7008     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 20); }
7009     @@XMLTest:
7010     @@@QName: xp.doctype.public.lit.test
7011     @@@DEnt:
7012     @@@@test:value:
7013     <!DOCTYPE a PUBLIC"p" "s">
7014     <a/>
7015     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 19); }
7016     @@XMLTest:
7017     @@@QName: xp.doctype.public.lita.test
7018     @@@DEnt:
7019     @@@@test:value:
7020     <!DOCTYPE a PUBLIC'p' "s">
7021     <a/>
7022     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 19); }
7023     @@XMLTest:
7024     @@@QName: xp.doctype.pubid.lit.lita.unmatched.1.test
7025     @@@DEnt:
7026     @@@@test:value:
7027     <!DOCTYPE a PUBLIC "p' "s">
7028     <a/>
7029     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 25); }
7030     @@XMLTest:
7031     @@@QName: xp.doctype.pubid.lit.lita.unmatched.2.test
7032     @@@DEnt:
7033     @@@@test:value:
7034     <!DOCTYPE a PUBLIC "p' 's'><a/>
7035     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 32); }
7036     @@XMLTest:
7037     @@@QName: xp.doctype.pubid.lita.lit.unmatched.1.test
7038     @@@DEnt:
7039     @@@@test:value:
7040     <!DOCTYPE a PUBLIC 'p" "s"><a/>
7041     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 32); }
7042     @@XMLTest:
7043     @@@QName: xp.doctype.pubid.lita.lit.unmatched.2.test
7044     @@@DEnt:
7045     @@@@test:value:
7046     <!DOCTYPE a PUBLIC 'p" 's'>
7047     <a/>
7048     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 21)..(1, 25); }
7049     @@XMLTest:
7050     @@@QName: xp.doctype.public.s.lit.mdc.test
7051     @@@DEnt:
7052     @@@@test:value:
7053     <!DOCTYPE a PUBLIC "><a/>
7054     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 26); }
7055     @@XMLTest:
7056     @@@QName: xp.doctype.public.s.lita.mdc.test
7057     @@@DEnt:
7058     @@@@test:value:
7059     <!DOCTYPE a PUBLIC '><a/>
7060     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 26); }
7061     @@XMLTest:
7062     @@@QName: xp.doctype.public.lit.pubid.lit.mdc.test
7063     @@@DEnt:
7064     @@@@test:value:
7065     <!DOCTYPE a PUBLIC "p">
7066     <a/>
7067     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 23); }
7068     @@XMLTest:
7069     @@@QName: xp.doctype.public.lita.pubid.lita.mdc.test
7070     @@@DEnt:
7071     @@@@test:value:
7072     <!DOCTYPE a PUBLIC 'p'>
7073     <a/>
7074     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 23); }
7075     @@XMLTest:
7076     @@@QName: xp.doctype.public.lit.pubid.lit.s.mdc.test
7077     @@@DEnt:
7078     @@@@test:value:
7079     <!DOCTYPE a PUBLIC "p" >
7080     <a/>
7081     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 24); }
7082     @@XMLTest:
7083     @@@QName: xp.doctype.public.lita.pubid.lita.s.mdc.test
7084     @@@DEnt:
7085     @@@@test:value:
7086     <!DOCTYPE a PUBLIC 'p' >
7087     <a/>
7088     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 24); }
7089     @@XMLTest:
7090     @@@QName: xp.doctype.public.lit.pubid.lit.s.lit.mdc.test
7091     @@@DEnt:
7092     @@@@test:value:
7093     <!DOCTYPE a PUBLIC "p" "><a/>
7094     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 30); }
7095     @@XMLTest:
7096     @@@QName: xp.doctype.public.lit.pubid.lit.s.lita.mdc.test
7097     @@@DEnt:
7098     @@@@test:value:
7099     <!DOCTYPE a PUBLIC "p" '><a/>
7100     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 30); }
7101     @@XMLTest:
7102     @@@QName: xp.doctype.public.lita.pubid.lita.s.lit.mdc.test
7103     @@@DEnt:
7104     @@@@test:value:
7105     <!DOCTYPE a PUBLIC 'p' "><a/>
7106     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 30); }
7107     @@XMLTest:
7108     @@@QName: xp.doctype.public.lita.pubid.lita.s.lita.mdc.test
7109     @@@DEnt:
7110     @@@@test:value:
7111     <!DOCTYPE a PUBLIC 'p' '><a/>
7112     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 30); }
7113     @@XMLTest:
7114     @@@QName: xp.doctype.public.lit.pubid.lit.lit.lita.unmatched.mdc.test
7115     @@@DEnt:
7116     @@@@test:value:
7117     <!DOCTYPE a PUBLIC "p" "s'><a/>
7118     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 32); }
7119     @@XMLTest:
7120     @@@QName: xp.doctype.public.lita.pubid.lita.lita.lit.unmatched.mdc.test
7121     @@@DEnt:
7122     @@@@test:value:
7123     <!DOCTYPE a PUBLIC 'p' 's"><a/>
7124     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 32); }
7125     @@XMLTest:
7126     @@@QName: xp.doctype.pubid.sysid.stago.1.test
7127     @@@DEnt:
7128     @@@@test:value:
7129     <!DOCTYPE a PUBLIC "p" "s"<a/>
7130     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 27); }
7131     @@XMLTest:
7132     @@@QName: xp.doctype.pubid.sysid.stago.2.test
7133     @@@DEnt:
7134     @@@@test:value:
7135     <!DOCTYPE a PUBLIC "p" 's'<a/>
7136     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 27); }
7137     @@XMLTest:
7138     @@@QName: xp.doctype.pubid.sysid.stago.s.1.test
7139     @@@DEnt:
7140     @@@@test:value:
7141     <!DOCTYPE a PUBLIC "p" "s" <a/>
7142     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 28); }
7143     @@XMLTest:
7144     @@@QName: xp.doctype.pubid.sysid.stago.s.2.test
7145     @@@DEnt:
7146     @@@@test:value:
7147     <!DOCTYPE a PUBLIC "p" 's' <a/>
7148     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 28); }
7149 wakaba 1.16
7150     @@XMLTest:
7151     @@@QName: xp.endofline.1.0.crlf.test
7152     @@@DEnt:
7153     @@@@test:value:
7154     <?xml version="1.0"?>
7155     <p>aaa$u000D$u000Abbb</p>
7156 wakaba 1.6 @@@test:domTree:
7157     document {
7158     xml-version: '1.0';
7159 wakaba 1.16 element {
7160     text-content: 'aaa' U+000A 'bbb';
7161 wakaba 1.6 }
7162 wakaba 1.16 }
7163     @@XMLTest:
7164     @@@QName: xp.endofline.1.1.crlf.test
7165     @@@DEnt:
7166     @@@@test:value:
7167     <?xml version="1.1"?>
7168     <p>aaa$u000D$u000Abbb</p>
7169     @@@test:domTree:
7170     document {
7171     xml-version: '1.1';
7172 wakaba 1.6 element {
7173 wakaba 1.16 text-content: 'aaa' U+000A 'bbb';
7174 wakaba 1.6 }
7175     }
7176     @@XMLTest:
7177 wakaba 1.16 @@@QName: xp.endofline.1.0.crnl.test
7178 wakaba 1.6 @@@DEnt:
7179     @@@@test:value:
7180 wakaba 1.16 <?xml version="1.0"?>
7181     <p>aaa$u000D$u0085bbb</p>
7182 wakaba 1.6 @@@test:domTree:
7183     document {
7184     xml-version: '1.0';
7185 wakaba 1.16 element {
7186     text-content: 'aaa' U+000A U+0085 'bbb';
7187 wakaba 1.6 }
7188 wakaba 1.16 }
7189     @@XMLTest:
7190     @@@QName: xp.endofline.1.1.crnl.test
7191     @@@DEnt:
7192     @@@@test:value:
7193     <?xml version="1.1"?>
7194     <p>aaa$u000D$u0085bbb</p>
7195     @@@test:domTree:
7196     document {
7197     xml-version: '1.1';
7198 wakaba 1.6 element {
7199 wakaba 1.16 text-content: 'aaa' U+000A 'bbb';
7200 wakaba 1.6 }
7201     }
7202     @@XMLTest:
7203 wakaba 1.16 @@@QName: xp.endofline.1.0.nl.test
7204 wakaba 1.6 @@@DEnt:
7205     @@@@test:value:
7206 wakaba 1.16 <?xml version="1.0"?>
7207     <p>aaa$u0085bbb</p>
7208 wakaba 1.6 @@@test:domTree:
7209     document {
7210     xml-version: '1.0';
7211     element {
7212 wakaba 1.16 text-content: 'aaa' U+0085 'bbb';
7213 wakaba 1.6 }
7214     }
7215     @@XMLTest:
7216 wakaba 1.16 @@@QName: xp.endofline.1.1.nl.test
7217 wakaba 1.6 @@@DEnt:
7218     @@@@test:value:
7219 wakaba 1.16 <?xml version="1.1"?>
7220     <p>aaa$u0085bbb</p>
7221     @@@test:domTree:
7222     document {
7223     xml-version: '1.1';
7224     element {
7225     text-content: 'aaa' U+000A 'bbb';
7226     }
7227     }
7228     @@XMLTest:
7229     @@@QName: xp.endofline.1.0.ls.test
7230     @@@DEnt:
7231     @@@@test:value:
7232     <?xml version="1.0"?>
7233     <p>aaa$u2028bbb</p>
7234     @@@test:domTree:
7235     document {
7236     xml-version: '1.0';
7237     element {
7238     text-content: 'aaa' U+2028 'bbb';
7239     }
7240     }
7241     @@XMLTest:
7242     @@@QName: xp.endofline.1.1.ls.test
7243     @@@DEnt:
7244     @@@@test:value:
7245     <?xml version="1.1"?>
7246     <p>aaa$u2028bbb</p>
7247     @@@test:domTree:
7248     document {
7249     xml-version: '1.1';
7250     element {
7251     text-content: 'aaa' U+000A 'bbb';
7252     }
7253     }
7254     @@XMLTest:
7255     @@@QName: xp.endofline.1.0.cr.test
7256     @@@DEnt:
7257     @@@@test:value:
7258     <?xml version="1.0"?>
7259     <p>aaa$u000Dbbb</p>
7260     @@@test:domTree:
7261     document {
7262     xml-version: '1.0';
7263     element {
7264     text-content: 'aaa' U+000A 'bbb';
7265     }
7266     }
7267     @@XMLTest:
7268     @@@QName: xp.endofline.1.1.cr.test
7269     @@@DEnt:
7270     @@@@test:value:
7271     <?xml version="1.1"?>
7272     <p>aaa$u000Dbbb</p>
7273     @@@test:domTree:
7274     document {
7275     xml-version: '1.1';
7276     element {
7277     text-content: 'aaa' U+000A 'bbb';
7278     }
7279     }
7280     @@XMLTest:
7281     @@@QName: xp.endofline.1.0.lf.test
7282     @@@DEnt:
7283     @@@@test:value:
7284     <?xml version="1.0"?>
7285     <p>aaa$u000Abbb</p>
7286     @@@test:domTree:
7287     document {
7288     xml-version: '1.0';
7289     element {
7290     text-content: 'aaa' U+000A 'bbb';
7291     }
7292     }
7293     @@XMLTest:
7294     @@@QName: xp.endofline.1.1.lf.test
7295     @@@DEnt:
7296     @@@@test:value:
7297     <?xml version="1.1"?>
7298     <p>aaa$u000Abbb</p>
7299     @@@test:domTree:
7300     document {
7301     xml-version: '1.1';
7302     element {
7303     text-content: 'aaa' U+000A 'bbb';
7304     }
7305     }
7306     @@XMLTest:
7307     @@@QName: xp.xml10.endofline.nl.in.xmldecl.1.test
7308     @@@DEnt:
7309     @@@@test:value:
7310     <?xml$u0085version="1.0"?>
7311     <p/>
7312     @@@c:erred:
7313     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
7314     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7315     @@XMLTest:
7316     @@@QName: xp.xml11.endofline.nl.in.xmldecl.1.test
7317     @@@DEnt:
7318     @@@@test:value:
7319     <?xml$u0085version="1.1"?>
7320     (err)<p/>
7321     @@@c:erred:
7322     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
7323     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7324     @@XMLTest:
7325     @@@QName: xp.xml10.endofline.crnl.in.xmldecl.1.test
7326     @@@DEnt:
7327     @@@@test:value:
7328     <?xml$u000D$u0085version="1.0"?>
7329     <p/>
7330     @@@c:erred:
7331     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
7332     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7333     @@XMLTest:
7334     @@@QName: xp.xml11.endofline.crnl.in.xmldecl.1.test
7335     @@@DEnt:
7336     @@@@test:value:
7337     <?xml$u000D$u0085version="1.1"?>
7338     (err)<p/>
7339     @@@c:erred:
7340     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
7341     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7342     @@XMLTest:
7343     @@@QName: xp.xml10.endofline.ls.in.xmldecl.1.test
7344     @@@DEnt:
7345     @@@@test:value:
7346     <?xml$u2028version="1.0"?>
7347     <p/>
7348     @@@c:erred:
7349     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
7350     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7351     @@XMLTest:
7352     @@@QName: xp.xml11.endofline.ls.in.xmldecl.1.test
7353     @@@DEnt:
7354     @@@@test:value:
7355     <?xml$u2028version="1.1"?>
7356     (err)<p/>
7357     @@@c:erred:
7358     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 6)..(2, 0); }
7359     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7360     @@XMLTest:
7361     @@@QName: xp.xml10.endofline.nl.in.xmldecl.2.test
7362     @@@DEnt:
7363     @@@@test:value:
7364     <?xml version="1.0"$u0085?>
7365     <p/>
7366     @@@c:erred:
7367     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
7368     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7369     @@XMLTest:
7370     @@@QName: xp.xml11.endofline.nl.in.xmldecl.2.test
7371     @@@DEnt:
7372     @@@@test:value:
7373     <?xml version="1.1"$u0085?>
7374     (err)<p/>
7375     @@@c:erred:
7376     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
7377     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7378     @@XMLTest:
7379     @@@QName: xp.xml10.endofline.crnl.in.xmldecl.2.test
7380     @@@DEnt:
7381     @@@@test:value:
7382     <?xml version="1.0"$u000D$u0085?>
7383     <p/>
7384     @@@c:erred:
7385     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
7386     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7387     @@XMLTest:
7388     @@@QName: xp.xml11.endofline.crnl.in.xmldecl.2.test
7389     @@@DEnt:
7390     @@@@test:value:
7391     <?xml version="1.1"$u000D$u0085?>
7392     (err)<p/>
7393     @@@c:erred:
7394     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
7395     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7396     @@XMLTest:
7397     @@@QName: xp.xml10.endofline.ls.in.xmldecl.2.test
7398     @@@DEnt:
7399     @@@@test:value:
7400     <?xml version="1.0"$u2028?>
7401     <p/>
7402     @@@c:erred:
7403     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
7404     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7405     @@XMLTest:
7406     @@@QName: xp.xml11.endofline.ls.in.xmldecl.2.test
7407     @@@DEnt:
7408     @@@@test:value:
7409     <?xml version="1.1"$u2028?>
7410     (err)<p/>
7411     @@@c:erred:
7412     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 20)..(2, 0); }
7413     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7414     @@XMLTest:
7415     @@@QName: xp.xml10.endofline.nl.in.xmldecl.3.test
7416     @@@DEnt:
7417     @@@@test:value:
7418     <?xml $u0085version="1.0"?>
7419     <p/>
7420     @@@c:erred:
7421     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
7422     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7423     @@XMLTest:
7424     @@@QName: xp.xml11.endofline.nl.in.xmldecl.3.test
7425     @@@DEnt:
7426     @@@@test:value:
7427     <?xml $u0085version="1.1"?>
7428     (err)<p/>
7429     @@@c:erred:
7430     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
7431     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7432     @@XMLTest:
7433     @@@QName: xp.xml10.endofline.crnl.in.xmldecl.3.test
7434     @@@DEnt:
7435     @@@@test:value:
7436     <?xml $u000D$u0085version="1.0"?>
7437     <p/>
7438     @@@c:erred:
7439     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
7440     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7441     @@XMLTest:
7442     @@@QName: xp.xml11.endofline.crnl.in.xmldecl.3.test
7443     @@@DEnt:
7444     @@@@test:value:
7445     <?xml $u000D$u0085version="1.1"?>
7446     (err)<p/>
7447     @@@c:erred:
7448     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
7449     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7450     @@XMLTest:
7451     @@@QName: xp.xml10.endofline.ls.in.xmldecl.3.test
7452     @@@DEnt:
7453     @@@@test:value:
7454     <?xml $u2028version="1.0"?>
7455     <p/>
7456     @@@c:erred:
7457     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
7458     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7459     @@XMLTest:
7460     @@@QName: xp.xml11.endofline.ls.in.xmldecl.3.test
7461     @@@DEnt:
7462     @@@@test:value:
7463     <?xml $u2028version="1.1"?>
7464     (err)<p/>
7465     @@@c:erred:
7466     <[[xp|fatal-xml11-end-of-line-in-xml-declaration]]> { (1, 7)..(2, 0); }
7467     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7468     @@XMLTest:
7469     @@@QName: xp.xml10implied.endofline.nl.in.pi.1.test
7470     @@@DEnt:
7471     @@@@test:value:
7472     <?xml-$u0085?>
7473     <p/>
7474     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 7)..(2, 0); }
7475     @@XMLTest:
7476     @@@QName: xp.xml10.endofline.nl.in.pi.1.test
7477     @@@DEnt:
7478     @@@@test:value:
7479     <?xml version="1.0"?>
7480     <?xml-$u0085?>
7481     <p/>
7482     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 7)..(3, 0); }
7483     @@XMLTest:
7484     @@@QName: xp.xml11.endofline.nl.in.pi.1.test
7485     @@@DEnt:
7486     @@@@test:value:
7487     <?xml version="1.1"?>
7488     <?xml-$u0085?>
7489     <p/>
7490     @@@test:domTree:
7491     document {
7492     xml-version: '1.1';
7493     pi {
7494     node-name: 'xml-';
7495     node-value: '';
7496     }
7497     element { }
7498     }
7499     @@XMLTest:
7500     @@@QName: xp.xml10implied.endofline.crnl.in.pi.1.test
7501     @@@DEnt:
7502     @@@@test:value:
7503     <?xml-$u000D$u0085?>
7504     <p/>
7505     @@@test:domTree:
7506     document {
7507     xml-version: '1.0';
7508     pi {
7509     node-name: 'xml-';
7510     node-value: U+0085;
7511     }
7512     element { }
7513     }
7514     @@XMLTest:
7515     @@@QName: xp.xml10.endofline.crnl.in.pi.1.test
7516     @@@DEnt:
7517     @@@@test:value:
7518     <?xml version="1.0"?>
7519     <?xml-$u000D$u0085?>
7520     <p/>
7521     @@@test:domTree:
7522     document {
7523     xml-version: '1.0';
7524     pi {
7525     node-name: 'xml-';
7526     node-value: U+0085;
7527     }
7528     element { }
7529     }
7530     @@XMLTest:
7531     @@@QName: xp.xml11.endofline.crnl.in.pi.1.test
7532     @@@DEnt:
7533     @@@@test:value:
7534     <?xml version="1.1"?>
7535     <?xml-$u000D$u0085?>
7536     <p/>
7537     @@@test:domTree:
7538     document {
7539     xml-version: '1.1';
7540     pi {
7541     node-name: 'xml-';
7542     node-value: '';
7543     }
7544     element { }
7545     }
7546     @@XMLTest:
7547     @@@QName: xp.xml10implied.endofline.ls.in.pi.1.test
7548     @@@DEnt:
7549     @@@@test:value:
7550     <?xml-$u2028?>
7551     <p/>
7552     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 7)..(2, 0); }
7553     @@XMLTest:
7554     @@@QName: xp.xml10.endofline.ls.in.pi.1.test
7555     @@@DEnt:
7556     @@@@test:value:
7557     <?xml version="1.0"?>
7558     <?xml-$u2028?>
7559     <p/>
7560     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 7)..(3, 0); }
7561     @@XMLTest:
7562     @@@QName: xp.xml11.endofline.ls.in.pi.1.test
7563     @@@DEnt:
7564     @@@@test:value:
7565     <?xml version="1.1"?>
7566     <?xml-$u2028?>
7567     <p/>
7568     @@@test:domTree:
7569     document {
7570     xml-version: '1.1';
7571     pi {
7572     node-name: 'xml-';
7573     node-value: '';
7574     }
7575     element { }
7576     }
7577 wakaba 1.27
7578     @@XMLTest:
7579     @@@QName: xp.xml10.endofline.internal.1.test
7580     @@@DEnt:
7581     @@@@test:value:
7582     <?xml version="1.0"?>
7583     <!DOCTYPE a [
7584     <!ENTITY e "&#x000D; &#x000A; &#x0085; &#x000D;&#x000A; $
7585     &#x000D;&#x0085; &#x2028;">
7586     ]><a>&e;</a>
7587 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
7588 wakaba 1.27 @@@test:domTree:
7589     document {
7590     xml-version: '1.0';
7591     document-type {
7592     general-entity {
7593     node-name: 'e';
7594     text-content: U+000D ' ' U+000A ' ' U+0085 ' '
7595     U+000D U+000A ' ' U+000D U+0085 ' ' U+2028;
7596     }
7597     }
7598     element {
7599     text-content: U+000D ' ' U+000A ' ' U+0085 ' '
7600     U+000D U+000A ' ' U+000D U+0085 ' ' U+2028;
7601     }
7602     }
7603     @@XMLTest:
7604     @@@QName: xp.xml11.endofline.internal.1.test
7605     @@@DEnt:
7606     @@@@test:value:
7607     <?xml version="1.1"?>
7608     <!DOCTYPE a [
7609     <!ENTITY e "&#x000D; &#x000A; &#x0085; &#x000D;&#x000A; $
7610     &#x000D;&#x0085; &#x2028;">
7611     ]><a>&e;</a>
7612 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
7613 wakaba 1.27 @@@test:domTree:
7614     document {
7615     xml-version: '1.1';
7616     document-type {
7617     general-entity {
7618     node-name: 'e';
7619     text-content: U+000D ' ' U+000A ' ' U+0085 ' '
7620     U+000D U+000A ' ' U+000D U+0085 ' ' U+2028;
7621     }
7622     }
7623     element {
7624     text-content: U+000D ' ' U+000A ' ' U+0085 ' '
7625     U+000D U+000A ' ' U+000D U+0085 ' ' U+2028;
7626     }
7627     }
7628    
7629 wakaba 1.16 @@XMLTest:
7630     @@@QName: xp.noxmldecl.pi.pi.test
7631     @@@DEnt:
7632     @@@@test:value:
7633     <?noxml 1?><?noxml 2?><p/>
7634     @@@test:domTree:
7635     document {
7636     xml-version: '1.0';
7637     pi {
7638     node-name: 'noxml';
7639     node-value: '1';
7640     }
7641     pi {
7642     node-name: 'noxml';
7643     node-value: '2';
7644     }
7645     element { }
7646     }
7647     @@XMLTest:
7648     @@@QName: xp.noxmldecl.pi.pi.2.test
7649     @@@DEnt:
7650     @@@@test:value:
7651     <?xmlno 1?><?xmlno 2?><p/>
7652     @@@test:domTree:
7653     document {
7654     xml-version: '1.0';
7655     pi {
7656     node-name: 'xmlno';
7657     node-value: '1';
7658     }
7659     pi {
7660     node-name: 'xmlno';
7661     node-value: '2';
7662     }
7663     element { }
7664     }
7665     @@XMLTest:
7666     @@@QName: xp.noxmldecl.pi.pi.3.test
7667     @@@DEnt:
7668     @@@@test:value:
7669     <?xmln 1?><?xmln 2?><p/>
7670     @@@test:domTree:
7671     document {
7672     xml-version: '1.0';
7673     pi {
7674     node-name: 'xmln';
7675     node-value: '1';
7676     }
7677     pi {
7678     node-name: 'xmln';
7679     node-value: '2';
7680     }
7681     element { }
7682     }
7683     @@XMLTest:
7684     @@@QName: xp.noxml.s.nl.test
7685     @@@DEnt:
7686     @@@@test:value:
7687     $u0085<p/>
7688     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 1)..(2, 0); }
7689     @@XMLTest:
7690     @@@QName: xp.noxml.s.crnl.test
7691     @@@DEnt:
7692     @@@@test:value:
7693     $u000D$u0085<p/>
7694     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 1)..(2, 0); }
7695     @@XMLTest:
7696     @@@QName: xp.noxml.s.ls.test
7697     @@@DEnt:
7698     @@@@test:value:
7699     $u2028<p/>
7700     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 1)..(2, 0); }
7701     @@XMLTest:
7702     @@@QName: xp.xml10.decl.s.nl.test
7703     @@@DEnt:
7704     @@@@test:value:
7705     <?xml version="1.0"?>$u0085<p/>
7706     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 22)..(2, 0); }
7707     @@XMLTest:
7708     @@@QName: xp.xml10.decl.s.crnl.test
7709     @@@DEnt:
7710     @@@@test:value:
7711     <?xml version="1.0"?>$u000D$u0085<p/>
7712     @@@c:erred: <[[xp|wf-syntax-error]]> { (2, 0)..(3, 0); }
7713     @@XMLTest:
7714     @@@QName: xp.xml10.decl.s.ls.test
7715     @@@DEnt:
7716     @@@@test:value:
7717     <?xml version="1.0"?>$u2028<p/>
7718     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 22)..(2, 0); }
7719     @@XMLTest:
7720     @@@QName: xp.xml11.decl.s.nl.test
7721     @@@DEnt:
7722     @@@@test:value:
7723     <?xml version="1.1"?>$u0085<p/>
7724     @@@test:domTree:
7725     document {
7726     xml-version: '1.1';
7727     element { }
7728     }
7729     @@XMLTest:
7730     @@@QName: xp.xml11.decl.s.crnl.test
7731     @@@DEnt:
7732     @@@@test:value:
7733     <?xml version="1.1"?>$u000D$u0085<p/>
7734     @@@test:domTree:
7735     document {
7736     xml-version: '1.1';
7737     element { }
7738     }
7739     @@XMLTest:
7740     @@@QName: xp.xml11.decl.s.ls.test
7741     @@@DEnt:
7742     @@@@test:value:
7743     <?xml version="1.1"?>$u2028<p/>
7744     @@@test:domTree:
7745     document {
7746     xml-version: '1.1';
7747     element { }
7748     }
7749    
7750     @@XMLTest:
7751 wakaba 1.18 @@@QName: xp.element.type.match.1.test
7752     @@@DEnt:
7753     @@@@test:value:
7754     <p></pa>(err)
7755     @@@c:erred: <[[xp|wf-element-type-match]]> { (1, 4)..(1, 8); }
7756     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7757     @@XMLTest:
7758     @@@QName: xp.element.type.match.2.test
7759     @@@DEnt:
7760     @@@@test:value:
7761     <p><pa></pa></pa>(err)
7762     @@@c:erred: <[[xp|wf-element-type-match]]> { (1, 13)..(1, 17); }
7763     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7764     @@XMLTest:
7765     @@@QName: xp.element.type.match.3.test
7766     @@@DEnt:
7767     @@@@test:value:
7768     <p><pa></p></p>(err)
7769     @@@c:erred: <[[xp|wf-element-type-match]]> { (1, 8)..(1, 11); }
7770     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7771     @@XMLTest:
7772     @@@QName: xp.element.type.match.4.test
7773     @@@DEnt:
7774     @@@@test:value:
7775     <a:p xmlns:a="about:1"></p>(err)
7776     @@@c:erred: <[[xp|wf-element-type-match]]> { (1, 24)..(1, 27); }
7777     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7778     @@XMLTest:
7779     @@@QName: xp.element.type.match.5.test
7780     @@@DEnt:
7781     @@@@test:value:
7782     <a:p xmlns:a="about:1" xmlns:b="about:1"></b:p>(err)
7783     @@@c:erred: <[[xp|wf-element-type-match]]> { (1, 42)..(1, 47); }
7784     @@@c:erred: <[[xp|wf-syntax-error]]> { }
7785    
7786     @@XMLTest:
7787     @@@QName: xp.stag.stago.name.etago.test
7788     @@@DEnt:
7789     @@@@test:value:
7790     <a</a>
7791     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 3); }
7792     @@XMLTest:
7793     @@@QName: xp.stag.stago.name.s.etago.test
7794     @@@DEnt:
7795     @@@@test:value:
7796     <a </a>
7797     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 4); }
7798     @@XMLTest:
7799     @@@QName: xp.stag.stago.name.s.attr.etago.test
7800     @@@DEnt:
7801     @@@@test:value:
7802     <a a="b"</a>
7803     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9); }
7804     @@XMLTest:
7805     @@@QName: xp.stag.stago.name.s.attr.s.attr.etago.test
7806     @@@DEnt:
7807     @@@@test:value:
7808     <a a="b" c="d"</a>
7809     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 15); }
7810     @@XMLTest:
7811     @@@QName: xp.stag.stago.name.s.attr.s.etago.test
7812     @@@DEnt:
7813     @@@@test:value:
7814     <a a="b" </a>
7815     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 10); }
7816     @@XMLTest:
7817     @@@QName: xp.stag.etag.1.test
7818 wakaba 1.16 @@@DEnt:
7819     @@@@test:value:
7820 wakaba 1.18 <root><a></a></root>
7821 wakaba 1.16 @@@test:domTree:
7822     document {
7823 wakaba 1.18 element {
7824     element {
7825     node-name: 'a';
7826 wakaba 1.16 }
7827     }
7828 wakaba 1.18 }
7829     @@XMLTest:
7830     @@@QName: xp.stag.etag.2.test
7831     @@@DEnt:
7832     @@@@test:value:
7833     <root><ab></ab></root>
7834     @@@test:domTree:
7835     document {
7836 wakaba 1.16 element {
7837 wakaba 1.18 element {
7838     node-name: 'ab';
7839     }
7840 wakaba 1.16 }
7841 wakaba 1.18 }
7842 wakaba 1.16 @@XMLTest:
7843 wakaba 1.18 @@@QName: xp.stag.etag.s.1.test
7844 wakaba 1.16 @@@DEnt:
7845     @@@@test:value:
7846 wakaba 1.18 <root><a ></a ></root>
7847 wakaba 1.16 @@@test:domTree:
7848     document {
7849 wakaba 1.18 element {
7850     element {
7851     node-name: 'a';
7852 wakaba 1.16 }
7853     }
7854 wakaba 1.18 }
7855     @@XMLTest:
7856     @@@QName: xp.etag.1.test
7857     @@@DEnt:
7858     @@@@test:value:
7859     <root><a/></root>
7860     @@@test:domTree:
7861     document {
7862 wakaba 1.16 element {
7863 wakaba 1.18 element {
7864     node-name: 'a';
7865     }
7866 wakaba 1.16 }
7867 wakaba 1.18 }
7868 wakaba 1.16 @@XMLTest:
7869 wakaba 1.18 @@@QName: xp.etag.2.test
7870 wakaba 1.16 @@@DEnt:
7871     @@@@test:value:
7872 wakaba 1.18 <root><a /></root>
7873 wakaba 1.16 @@@test:domTree:
7874     document {
7875     element {
7876 wakaba 1.18 element {
7877     node-name: 'a';
7878     }
7879 wakaba 1.16 }
7880 wakaba 1.18 }
7881 wakaba 1.16 @@XMLTest:
7882 wakaba 1.18 @@@QName: xp.stag.etag.attr.1.test
7883 wakaba 1.16 @@@DEnt:
7884     @@@@test:value:
7885 wakaba 1.18 <root><a at="v"></a></root>
7886 wakaba 1.16 @@@test:domTree:
7887     document {
7888 wakaba 1.18 element {
7889     element {
7890     node-name: 'a';
7891     attribute {
7892     node-name: 'at';
7893     value: 'v';
7894     }
7895 wakaba 1.16 }
7896     }
7897 wakaba 1.18 }
7898     @@XMLTest:
7899     @@@QName: xp.stag.etag.attr.2.test
7900     @@@DEnt:
7901     @@@@test:value:
7902     <root><a at="v" ></a></root>
7903     @@@test:domTree:
7904     document {
7905 wakaba 1.16 element {
7906 wakaba 1.18 element {
7907     node-name: 'a';
7908     attribute {
7909     node-name: 'at';
7910     value: 'v';
7911 wakaba 1.16 }
7912     }
7913     }
7914 wakaba 1.18 }
7915 wakaba 1.16 @@XMLTest:
7916 wakaba 1.18 @@@QName: xp.stag.etag.attr.3.test
7917 wakaba 1.16 @@@DEnt:
7918     @@@@test:value:
7919 wakaba 1.18 <root><a at ="v"></a></root>
7920 wakaba 1.16 @@@test:domTree:
7921     document {
7922 wakaba 1.18 element {
7923     element {
7924     node-name: 'a';
7925     attribute {
7926     node-name: 'at';
7927     value: 'v';
7928     }
7929 wakaba 1.16 }
7930     }
7931 wakaba 1.18 }
7932     @@XMLTest:
7933     @@@QName: xp.stag.etag.attr.4.test
7934     @@@DEnt:
7935     @@@@test:value:
7936     <root><a at= "v"></a></root>
7937     @@@test:domTree:
7938     document {
7939 wakaba 1.16 element {
7940 wakaba 1.18 element {
7941     node-name: 'a';
7942     attribute {
7943     node-name: 'at';
7944     value: 'v';
7945 wakaba 1.16 }
7946     }
7947 wakaba 1.18 }
7948     }
7949     @@XMLTest:
7950     @@@QName: xp.stag.etag.attr.5.test
7951     @@@DEnt:
7952     @@@@test:value:
7953     <root><a at='v'></a></root>
7954     @@@test:domTree:
7955     document {
7956     element {
7957     element {
7958     node-name: 'a';
7959     attribute {
7960     node-name: 'at';
7961     value: 'v';
7962 wakaba 1.16 }
7963     }
7964     }
7965 wakaba 1.18 }
7966 wakaba 1.16 @@XMLTest:
7967 wakaba 1.18 @@@QName: xp.stag.etag.attr.6.test
7968 wakaba 1.16 @@@DEnt:
7969     @@@@test:value:
7970 wakaba 1.18 <root><a at= 'v' ></a></root>
7971 wakaba 1.6 @@@test:domTree:
7972     document {
7973 wakaba 1.18 element {
7974     element {
7975     node-name: 'a';
7976     attribute {
7977     node-name: 'at';
7978     value: 'v';
7979     }
7980 wakaba 1.11 }
7981 wakaba 1.6 }
7982 wakaba 1.18 }
7983     @@XMLTest:
7984     @@@QName: xp.stag.etag.attr.attr.1.test
7985     @@@DEnt:
7986     @@@@test:value:
7987     <root><a at="v" tr="w"></a></root>
7988     @@@test:domTree:
7989     document {
7990 wakaba 1.6 element {
7991 wakaba 1.18 element {
7992     node-name: 'a';
7993     attribute {
7994     node-name: 'at';
7995     value: 'v';
7996 wakaba 1.6 }
7997 wakaba 1.18 attribute {
7998     node-name: 'tr';
7999     value: 'w';
8000 wakaba 1.6 }
8001     }
8002     }
8003 wakaba 1.18 }
8004 wakaba 1.6 @@XMLTest:
8005 wakaba 1.18 @@@QName: xp.stag.etag.attr.attr.2.test
8006 wakaba 1.6 @@@DEnt:
8007     @@@@test:value:
8008 wakaba 1.18 <root><a tr="w" at="v"></a></root>
8009 wakaba 1.6 @@@test:domTree:
8010     document {
8011 wakaba 1.18 element {
8012     element {
8013     node-name: 'a';
8014     attribute {
8015     node-name: 'at';
8016     value: 'v';
8017     }
8018     attribute {
8019     node-name: 'tr';
8020     value: 'w';
8021 wakaba 1.11 }
8022     }
8023 wakaba 1.6 }
8024 wakaba 1.18 }
8025     @@XMLTest:
8026     @@@QName: xp.stag.etag.attr.no.s.attr.test
8027     @@@DEnt:
8028     @@@@test:value:
8029     <root><a at="v"tr="w"></a></root>
8030     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 16)..(1, 17); }
8031     @@XMLTest:
8032     @@@QName: xp.etag.attr.1.test
8033     @@@DEnt:
8034     @@@@test:value:
8035     <root><a at="v" tr="w"></a b="c"></root>
8036     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 28); }
8037     @@XMLTest:
8038     @@@QName: xp.etag.no.etagc.1.test
8039     @@@DEnt:
8040     @@@@test:value:
8041     <root><a at="v" tr="w"></a</root>
8042     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 27)..(1, 28); }
8043     @@XMLTest:
8044     @@@QName: xp.etag.no.etagc.2.test
8045     @@@DEnt:
8046     @@@@test:value:
8047     <root><a at="v" tr="w"></a </root>
8048     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 29)..(1, 30); }
8049     @@XMLTest:
8050     @@@QName: xp.mtag.attr.1.test
8051     @@@DEnt:
8052     @@@@test:value:
8053     <root><a b="c"/></root>
8054     @@@test:domTree:
8055     document {
8056 wakaba 1.6 element {
8057 wakaba 1.18 element {
8058     node-name: 'a';
8059     attribute {
8060     node-name: 'b';
8061     value: 'c';
8062 wakaba 1.6 }
8063     }
8064 wakaba 1.8 }
8065 wakaba 1.18 }
8066 wakaba 1.11 @@XMLTest:
8067 wakaba 1.18 @@@QName: xp.mtag.attr.2.test
8068 wakaba 1.11 @@@DEnt:
8069     @@@@test:value:
8070 wakaba 1.18 <root><a b="c" /></root>
8071 wakaba 1.11 @@@test:domTree:
8072     document {
8073 wakaba 1.18 element {
8074     element {
8075     node-name: 'a';
8076     attribute {
8077     node-name: 'b';
8078     value: 'c';
8079     }
8080 wakaba 1.11 }
8081     }
8082 wakaba 1.18 }
8083 wakaba 1.11 @@XMLTest:
8084 wakaba 1.18 @@@QName: xp.mtag.attr.3.test
8085 wakaba 1.11 @@@DEnt:
8086     @@@@test:value:
8087 wakaba 1.18 <root><a b='c'/></root>
8088 wakaba 1.11 @@@test:domTree:
8089     document {
8090     element {
8091 wakaba 1.18 element {
8092     node-name: 'a';
8093     attribute {
8094     node-name: 'b';
8095     value: 'c';
8096     }
8097     }
8098 wakaba 1.11 }
8099 wakaba 1.18 }
8100 wakaba 1.11 @@XMLTest:
8101 wakaba 1.18 @@@QName: xp.mtag.attr.4.test
8102 wakaba 1.11 @@@DEnt:
8103     @@@@test:value:
8104 wakaba 1.18 <root><a b="c" d="e"/></root>
8105 wakaba 1.11 @@@test:domTree:
8106     document {
8107     element {
8108 wakaba 1.18 element {
8109     node-name: 'a';
8110     attribute {
8111     node-name: 'b';
8112     value: 'c';
8113     }
8114     attribute {
8115     node-name: 'd';
8116     value: 'e';
8117     }
8118 wakaba 1.11 }
8119     }
8120 wakaba 1.18 }
8121    
8122     @@XMLTest:
8123     @@@QName: xp.attvalue.lt.1.test
8124     @@@DEnt:
8125     @@@@test:value:
8126     <a b="aa<dd"/>
8127     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9); }
8128     @@XMLTest:
8129     @@@QName: xp.attvalue.lt.2.test
8130     @@@DEnt:
8131     @@@@test:value:
8132     <a b='aa<dd'/>
8133     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9); }
8134     @@XMLTest:
8135     @@@QName: xp.attvalue.amp.1.test
8136     @@@DEnt:
8137     @@@@test:value:
8138     <a b="aa& dd"/>
8139     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9)..(1, 12); }
8140     @@XMLTest:
8141     @@@QName: xp.attvalue.amp.2.test
8142     @@@DEnt:
8143     @@@@test:value:
8144     <a b='aa& dd'/>
8145     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9)..(1, 12); }
8146     @@XMLTest:
8147     @@@QName: xp.attvalue.amp.3.test
8148     @@@DEnt:
8149     @@@@test:value:
8150     <a b="aa&# dd"/>
8151     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9)..(1, 13); }
8152     @@XMLTest:
8153     @@@QName: xp.attvalue.amp.4.test
8154     @@@DEnt:
8155     @@@@test:value:
8156     <a b="aa&#x dd"/>
8157     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 9)..(1, 14); }
8158    
8159     @@XMLTest:
8160     @@@QName: xp.unique.att.spec.1.test
8161     @@@DEnt:
8162     @@@@test:value:
8163     <a b="c" b="d"/>
8164     @@@c:erred: <[[xp|wf-unique-att-spec]]> { (1, 4)..(1, 14); }
8165     @@XMLTest:
8166     @@@QName: xp.unique.att.spec.2.test
8167     @@@DEnt:
8168     @@@@test:value:
8169     <a d:b="c" d:b="d" xmlns:d="about:2"/>
8170     @@@c:erred: <[[xp|wf-unique-att-spec]]> { (1, 4)..(1, 18); }
8171    
8172     @@XMLTest:
8173     @@@QName: xp.no.external.entity.references.1.test
8174     @@@DEnt:
8175     @@@@test:value:
8176     <!DOCTYPE a [
8177     <!ENTITY ent SYSTEM "something">
8178     ]>
8179     <a b="c&ent;"/>
8180     @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (4, 8)..(4, 12); }
8181     @@XMLTest:
8182     @@@QName: xp.no.external.entity.references.2.test
8183     @@@DEnt:
8184     @@@@test:value:
8185     <!DOCTYPE a [
8186     <!NOTATION n SYSTEM "notation">
8187     <!ENTITY ent SYSTEM "something" NDATA n>
8188     ]>
8189     <a b="c&ent;"/>
8190     @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (5, 8)..(5, 12); }
8191     @@XMLTest:
8192     @@@QName: xp.no.external.entity.references.3.test
8193     @@@DEnt:
8194     @@@@test:value:
8195     <!DOCTYPE a [
8196     <!ENTITY ent SYSTEM "something">
8197     <!ENTITY ent2 "ddd&ent;">
8198     ]>
8199     <a b="c&ent2;"/>
8200     @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (1, 4)..(1, 8); }
8201     @@XMLTest:
8202     @@@QName: xp.no.external.entity.references.4.test
8203     @@@DEnt:
8204     @@@@test:value:
8205     <!DOCTYPE a [
8206     <!NOTATION n SYSTEM "notation">
8207     <!ENTITY ent SYSTEM "something" NDATA n>
8208     <!ENTITY ent2 "ddd&ent;">
8209     ]>
8210     <a b="c&ent2;"/>
8211 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8212 wakaba 1.18 @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (1, 4)..(1, 8); }
8213 wakaba 1.23 @@@c:erred: <[[xp|wf-parsed-entity]]> { }
8214 wakaba 1.18 @@XMLTest:
8215     @@@QName: xp.no.lt.in.attr.value.1.test
8216     @@@DEnt:
8217     @@@@test:value:
8218     <!DOCTYPE a [
8219     <!ENTITY ent "aa<bb">
8220     ]>
8221     <a b="c&ent;"/>
8222 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8223 wakaba 1.18 @@@c:erred: <[[xp|wf-no-lt-in-attribute-values]]> { (1, 3); }
8224 wakaba 1.20 @@@c:erred:
8225     @@@@@: <[[xp|wf-syntax-error]]> { (1, 3)..(1, 6); }
8226     @@@@enImplNote: When entity node is created.
8227 wakaba 1.18 @@XMLTest:
8228 wakaba 1.34 @@@QName: xp.no.lt.in.attr.value.1.2.test
8229     @@@DEnt:
8230     @@@@test:value:
8231     <!DOCTYPE a [
8232     <!ENTITY ent "aa<bb">
8233     ]>
8234     <a b="c&ent;"/>
8235     @@@cfg:entity-replacement-tree: 0
8236     @@@c:erred: <[[xp|wf-no-lt-in-attribute-values]]> { (1, 3); }
8237     @@XMLTest:
8238 wakaba 1.18 @@@QName: xp.no.lt.in.attr.value.2.test
8239     @@@DEnt:
8240     @@@@test:value:
8241     <!DOCTYPE a [
8242     <!ENTITY ent "aa<bb">
8243     <!ENTITY ent2 "ccc&ent;">
8244     ]>
8245     <a b="c&ent2;"/>
8246 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8247 wakaba 1.18 @@@c:erred: <[[xp|wf-no-lt-in-attribute-values]]> { (1, 3); }
8248 wakaba 1.20 @@@c:erred:
8249     @@@@@: <[[xp|wf-syntax-error]]> { (1, 3)..(1, 6); }
8250     @@@@enImplNote: When entity node is created.
8251 wakaba 1.18 @@XMLTest:
8252     @@@QName: xp.no.lt.in.attr.value.3.test
8253     @@@DEnt:
8254     @@@@test:value:
8255     <!DOCTYPE a [
8256     <!ENTITY ent "aa&#x3C;bb">
8257     ]>
8258     <a b="c&ent;"/>
8259 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8260 wakaba 1.18 @@@c:erred: <[[xp|wf-no-lt-in-attribute-values]]> { (1, 3); }
8261 wakaba 1.20 @@@c:erred:
8262     @@@@@: <[[xp|wf-syntax-error]]> { (1, 3)..(1, 6); }
8263     @@@@enImplNote: When entity node is created.
8264 wakaba 1.18 @@XMLTest:
8265     @@@QName: xp.no.lt.in.attr.value.4.test
8266     @@@DEnt:
8267     @@@@test:value:
8268     <!DOCTYPE a [
8269     <!ENTITY ent "aa&#x3C;bb">
8270     <!ENTITY ent2 "ccc&ent;">
8271     ]>
8272     <a b="c&ent2;"/>
8273 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8274 wakaba 1.18 @@@c:erred: <[[xp|wf-no-lt-in-attribute-values]]> { (1, 3); }
8275 wakaba 1.20 @@@c:erred:
8276     @@@@@: <[[xp|wf-syntax-error]]> { (1, 3)..(1, 6); }
8277     @@@@enImplNote: When entity node is created.
8278 wakaba 1.11 @@XMLTest:
8279 wakaba 1.18 @@@QName: xp.ger.lt.in.attr.value.1.test
8280 wakaba 1.11 @@@DEnt:
8281     @@@@test:value:
8282     <!DOCTYPE a [
8283 wakaba 1.18 <!ENTITY ent "aa&lt;bb">
8284 wakaba 1.11 ]>
8285 wakaba 1.18 <a b="c&ent;"/>
8286 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8287 wakaba 1.11 @@@test:domTree:
8288     document {
8289     document-type {
8290     general-entity {
8291     node-name: 'ent';
8292 wakaba 1.18 text-content: 'aa<bb';
8293 wakaba 1.11 }
8294     }
8295     element {
8296 wakaba 1.18 attribute {
8297     node-name: 'b';
8298     text { data: 'c'; }
8299     general-entity-reference {
8300 wakaba 1.34 manakai-expanded: true;
8301 wakaba 1.18 node-name: 'ent';
8302     text-content: 'aa<bb';
8303     }
8304     }
8305 wakaba 1.11 }
8306     }
8307     @@XMLTest:
8308 wakaba 1.18 @@@QName: xp.ger.lt.in.attr.value.2.test
8309 wakaba 1.11 @@@DEnt:
8310     @@@@test:value:
8311     <!DOCTYPE a [
8312 wakaba 1.18 <!ENTITY ent "aa&lt;bb">
8313     <!ENTITY ent2 "ccc&ent;">
8314 wakaba 1.11 ]>
8315 wakaba 1.18 <a b="c&ent2;"/>
8316 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8317 wakaba 1.11 @@@test:domTree:
8318     document {
8319     document-type {
8320     general-entity {
8321 wakaba 1.18 node-name: 'ent';
8322     text-content: 'aa<bb';
8323     }
8324     general-entity {
8325     node-name: 'ent2';
8326     text { data: 'ccc'; }
8327     general-entity-reference {
8328     node-name: 'ent';
8329     text-content: 'aa<bb';
8330 wakaba 1.34 manakai-expanded: true;
8331 wakaba 1.18 }
8332 wakaba 1.11 }
8333     }
8334     element {
8335 wakaba 1.18 attribute {
8336     node-name: 'b';
8337     text { data: 'c'; }
8338     general-entity-reference {
8339     node-name: 'ent2';
8340     text { data: 'ccc'; }
8341     general-entity-reference {
8342     node-name: 'ent';
8343     text-content: 'aa<bb';
8344 wakaba 1.34 manakai-expanded: true;
8345 wakaba 1.18 }
8346 wakaba 1.34 manakai-expanded: true;
8347 wakaba 1.18 }
8348     }
8349 wakaba 1.11 }
8350     }
8351    
8352 wakaba 1.8 @@XMLTest:
8353 wakaba 1.18 @@@QName: xp.doctype.intsubset.pi.test
8354 wakaba 1.8 @@@DEnt:
8355     @@@@test:value:
8356     <!DOCTYPE a [
8357 wakaba 1.18 <?pi data ?>
8358 wakaba 1.8 ]>
8359     <a></a>
8360     @@@test:domTree:
8361     document {
8362     xml-version: '1.0';
8363     xml-encoding: null;
8364     xml-standalone: false;
8365     document-type {
8366     node-name: 'a';
8367 wakaba 1.18 pi {
8368     target: 'pi';
8369     data: 'data ';
8370 wakaba 1.8 }
8371     }
8372     element {
8373     namespace-uri: null;
8374 wakaba 1.18 prefix: null;
8375 wakaba 1.8 local-name: 'a';
8376 wakaba 1.18 text-content: '';
8377 wakaba 1.8 }
8378     }
8379 wakaba 1.18 @@@enImplNote:
8380     A DOM PI node in doctype node is a manakai extension.
8381    
8382    
8383 wakaba 1.8 @@XMLTest:
8384 wakaba 1.18 @@@QName: xp.doctype.intsubset.entity.general.internal.test
8385 wakaba 1.8 @@@DEnt:
8386     @@@@test:value:
8387     <!DOCTYPE a [
8388 wakaba 1.18 <!ENTITY entity "entity value">
8389 wakaba 1.8 ]>
8390     <a></a>
8391 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8392 wakaba 1.8 @@@test:domTree:
8393     document {
8394     xml-version: '1.0';
8395     xml-encoding: null;
8396     xml-standalone: false;
8397     document-type {
8398     node-name: 'a';
8399 wakaba 1.18 general-entity {
8400     node-name: 'entity';
8401     text-content: 'entity value';
8402     has-replacement-tree: true;
8403 wakaba 1.8 }
8404     }
8405     element {
8406     namespace-uri: null;
8407 wakaba 1.18 prefix: null;
8408 wakaba 1.8 local-name: 'a';
8409 wakaba 1.18 text-content: '';
8410 wakaba 1.8 }
8411     }
8412     @@XMLTest:
8413 wakaba 1.18 @@@QName: xp.doctype.intsubset.entity.parameter.internal.test
8414 wakaba 1.8 @@@DEnt:
8415     @@@@test:value:
8416     <!DOCTYPE a [
8417 wakaba 1.18 <!ENTITY % entity "entity value">
8418 wakaba 1.8 ]>
8419     <a></a>
8420     @@@test:domTree:
8421     document {
8422     xml-version: '1.0';
8423     xml-encoding: null;
8424     xml-standalone: false;
8425     document-type {
8426     node-name: 'a';
8427     }
8428     element {
8429     namespace-uri: null;
8430 wakaba 1.18 prefix: null;
8431 wakaba 1.8 local-name: 'a';
8432 wakaba 1.18 text-content: '';
8433 wakaba 1.8 }
8434     }
8435 wakaba 1.18
8436 wakaba 1.8 @@XMLTest:
8437 wakaba 1.18 @@@QName: xp.doctype.internal.entity.root.element.text.only.test
8438 wakaba 1.8 @@@DEnt:
8439     @@@@test:value:
8440     <!DOCTYPE a [
8441 wakaba 1.18 <!ENTITY entity "entity value">
8442 wakaba 1.8 ]>
8443 wakaba 1.18 <a>&entity;</a>
8444 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8445 wakaba 1.8 @@@test:domTree:
8446     document {
8447     xml-version: '1.0';
8448     xml-encoding: null;
8449     xml-standalone: false;
8450     document-type {
8451     node-name: 'a';
8452 wakaba 1.18 general-entity {
8453     node-name: 'entity';
8454     text-content: 'entity value';
8455     has-replacement-tree: true;
8456 wakaba 1.8 }
8457     }
8458     element {
8459     namespace-uri: null;
8460 wakaba 1.18 prefix: null;
8461 wakaba 1.8 local-name: 'a';
8462 wakaba 1.18 general-entity-reference {
8463     node-name: 'entity';
8464     text {
8465     data: 'entity value';
8466     }
8467 wakaba 1.34 manakai-expanded: true;
8468 wakaba 1.10 }
8469 wakaba 1.9 }
8470     }
8471     @@XMLTest:
8472 wakaba 1.18 @@@QName: xp.doctype.internal.entity.root.element.text.mult.test
8473 wakaba 1.9 @@@DEnt:
8474     @@@@test:value:
8475     <!DOCTYPE a [
8476 wakaba 1.18 <!ENTITY entity "entity value">
8477 wakaba 1.9 ]>
8478 wakaba 1.18 <a>&entity; and &entity;</a>
8479 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8480 wakaba 1.9 @@@test:domTree:
8481     document {
8482     xml-version: '1.0';
8483     xml-encoding: null;
8484     xml-standalone: false;
8485     document-type {
8486     node-name: 'a';
8487 wakaba 1.18 general-entity {
8488     node-name: 'entity';
8489     text-content: 'entity value';
8490     has-replacement-tree: true;
8491 wakaba 1.9 }
8492     }
8493     element {
8494     namespace-uri: null;
8495 wakaba 1.18 prefix: null;
8496 wakaba 1.9 local-name: 'a';
8497 wakaba 1.18 general-entity-reference {
8498     node-name: 'entity';
8499     text {
8500     data: 'entity value';
8501     }
8502 wakaba 1.34 manakai-expanded: true;
8503 wakaba 1.18 }
8504     text { data: ' and '; }
8505     general-entity-reference {
8506     node-name: 'entity';
8507     text {
8508     data: 'entity value';
8509     }
8510 wakaba 1.34 manakai-expanded: true;
8511 wakaba 1.10 }
8512 wakaba 1.9 }
8513     }
8514     @@XMLTest:
8515 wakaba 1.18 @@@QName: xp.doctype.internal.entity.root.element.text.element.test
8516 wakaba 1.9 @@@DEnt:
8517     @@@@test:value:
8518     <!DOCTYPE a [
8519 wakaba 1.18 <!ENTITY entity "entity <p>value</p> with <e>element</e> ">
8520 wakaba 1.9 ]>
8521 wakaba 1.18 <a>&entity;</a>
8522 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8523 wakaba 1.18 @@@test:domTree:
8524     document {
8525     xml-version: '1.0';
8526     xml-encoding: null;
8527     xml-standalone: false;
8528     document-type {
8529     node-name: 'a';
8530     general-entity {
8531     node-name: 'entity';
8532     has-replacement-tree: true;
8533     text { data: 'entity '; }
8534     element {
8535     node-name: 'p';
8536     text-content: 'value';
8537     }
8538     text { data: ' with '; }
8539     element {
8540     node-name: 'e';
8541     text-content: 'element';
8542     }
8543 wakaba 1.20 text { data: ' '; }
8544 wakaba 1.18 }
8545     }
8546     element {
8547     namespace-uri: null;
8548     prefix: null;
8549     local-name: 'a';
8550     general-entity-reference {
8551     node-name: 'entity';
8552 wakaba 1.34 manakai-expanded: true;
8553 wakaba 1.18 text {
8554     data: 'entity ';
8555     }
8556     element {
8557     namespace-uri: null;
8558     prefix: null;
8559     local-name: 'p';
8560     text {
8561     data: 'value';
8562     }
8563     }
8564     text {
8565     data: ' with ';
8566     }
8567     element {
8568     namespace-uri: null;
8569     prefix: null;
8570     local-name: 'e';
8571     text {
8572     data: 'element';
8573     }
8574     }
8575     text {
8576     data: ' ';
8577     }
8578     }
8579     }
8580     }
8581     @@XMLTest:
8582     @@@QName: xp.doctype.internal.entity.root.element.text.in.ent.test
8583     @@@DEnt:
8584     @@@@test:value:
8585     <!DOCTYPE a [
8586     <!ENTITY entity1 "entity value">
8587     <!ENTITY entity2 "e&entity1;n">
8588     ]>
8589     <a>&entity2;</a>
8590 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8591 wakaba 1.18 @@@test:domTree:
8592     document {
8593     xml-version: '1.0';
8594     xml-encoding: null;
8595     xml-standalone: false;
8596     document-type {
8597     node-name: 'a';
8598     general-entity {
8599     node-name: 'entity1';
8600     text-content: 'entity value';
8601     }
8602     general-entity {
8603     node-name: 'entity2';
8604     text { data: 'e'; }
8605     general-entity-reference {
8606     node-name: 'entity1';
8607     text-content: 'entity value';
8608 wakaba 1.34 manakai-expanded: true;
8609 wakaba 1.18 }
8610     text { data: 'n'; }
8611     }
8612     }
8613     element {
8614     namespace-uri: null;
8615     prefix: null;
8616     local-name: 'a';
8617     general-entity-reference {
8618     node-name: 'entity2';
8619     text { data: 'e'; }
8620 wakaba 1.34 manakai-expanded: true;
8621 wakaba 1.18 general-entity-reference {
8622     node-name: 'entity1';
8623     text {
8624     data: 'entity value';
8625     }
8626 wakaba 1.34 manakai-expanded: true;
8627 wakaba 1.18 }
8628     text { data: 'n'; }
8629     }
8630     }
8631     }
8632    
8633     @@XMLTest:
8634     @@@QName: xp.doctype.entity.value.charref.test
8635     @@@DEnt:
8636     @@@@test:value:
8637     <!DOCTYPE a [
8638     <!ENTITY entity1 "entity &#x21;value&#35;">
8639     <!ENTITY entity2 '&#x21;value&#35;'>
8640     ]>
8641     <a></a>
8642 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8643 wakaba 1.18 @@@test:domTree:
8644     document {
8645     document-type {
8646     general-entity {
8647     node-name: 'entity1';
8648     text-content: 'entity !value#';
8649     has-replacement-tree: true;
8650     }
8651     general-entity {
8652     node-name: 'entity2';
8653     text-content: '!value#';
8654     has-replacement-tree: true;
8655     }
8656     }
8657     element { }
8658     }
8659    
8660     @@XMLTest:
8661     @@@QName: xp.predefined.in.content.test
8662     @@@DEnt:
8663     @@@@test:value:
8664     <a>_&lt;_&gt;_&quot;_&apos;_&amp;_</a>
8665     @@@test:domTree:
8666     document {
8667     element {
8668     text-content: '_<_>_"_' U+0027 '_&_';
8669     }
8670     }
8671     @@XMLTest:
8672     @@@QName: xp.predefined.in.attr.test
8673     @@@DEnt:
8674     @@@@test:value:
8675     <a at="_&lt;_&gt;_&quot;_&apos;_&amp;_"></a>
8676     @@@test:domTree:
8677     document {
8678     element {
8679     attribute {
8680     node-name: 'at';
8681     text-content: '_<_>_"_' U+0027 '_&_';
8682     }
8683     }
8684     }
8685     @@XMLTest:
8686     @@@QName: xp.predefined.in.content.in.entity.test
8687     @@@DEnt:
8688     @@@@test:value:
8689     <!DOCTYPE a [
8690     <!ENTITY ent "_&lt;_&gt;_&quot;_&apos;_&amp;_">
8691     ]>
8692     <a>&ent;</a>
8693 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8694 wakaba 1.18 @@@test:domTree:
8695     document {
8696     document-type {
8697     general-entity {
8698     node-name: 'ent';
8699     text-content: '_<_>_"_' U+0027 '_&_';
8700     }
8701     }
8702     element {
8703     text-content: '_<_>_"_' U+0027 '_&_';
8704     }
8705     }
8706     @@XMLTest:
8707     @@@QName: xp.predefined.decl.ignore.test
8708     @@@DEnt:
8709     @@@@test:value:
8710     <!DOCTYPE a [
8711     <!ENTITY lt "&#x26;#x3C;">
8712     <!ENTITY gt "&#x3E;">
8713     <!ENTITY amp "&#x26;#x26;">
8714     <!ENTITY quot "&#x22;">
8715     <!ENTITY apos "&#x27;">
8716     <!ENTITY other "other">
8717     ]>
8718     <a>_&lt;_&gt;_&quot;_&apos;_&amp;_&other;_</a>
8719 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
8720 wakaba 1.18 @@@test:domTree:
8721     document {
8722     document-type {
8723     general-entity {
8724     node-name: 'other';
8725     text-content: 'other';
8726     }
8727     }
8728     element {
8729     text-content: '_<_>_"_' U+0027 '_&_other_';
8730     }
8731     }
8732    
8733     @@XMLTest:
8734     @@@QName: xp.doctype.internal.attr.empty.test
8735     @@@DEnt:
8736     @@@@test:value:
8737     <!DOCTYPE a [
8738     <!ATTLIST a>
8739     ]>
8740     <a></a>
8741     @@@test:domTree:
8742     document {
8743     xml-version: '1.0';
8744     xml-encoding: null;
8745     xml-standalone: false;
8746     document-type {
8747     node-name: 'a';
8748     element-type-definition {
8749     node-name: 'a';
8750     }
8751     }
8752     element {
8753     namespace-uri: null;
8754     local-name: 'a';
8755     }
8756     }
8757     @@XMLTest:
8758     @@@QName: xp.doctype.internal.attr.cdata.implied.test
8759     @@@DEnt:
8760     @@@@test:value:
8761     <!DOCTYPE a [
8762     <!ATTLIST a
8763     at CDATA #IMPLIED
8764     >
8765     ]>
8766     <a></a>
8767 wakaba 1.9 @@@test:domTree:
8768     document {
8769     xml-version: '1.0';
8770     xml-encoding: null;
8771     xml-standalone: false;
8772     document-type {
8773     node-name: 'a';
8774     element-type-definition {
8775     node-name: 'a';
8776     attribute-definition {
8777     node-name: 'at';
8778 wakaba 1.18 declared-type: const (CDATA_ATTR);
8779 wakaba 1.9 allowed-tokens: DOMStringList ();
8780 wakaba 1.18 default-type: const (IMPLIED_DEFAULT);
8781     text-content: '';
8782 wakaba 1.9 }
8783     }
8784     }
8785     element {
8786     namespace-uri: null;
8787     local-name: 'a';
8788 wakaba 1.18 }
8789     }
8790     @@XMLTest:
8791     @@@QName: xp.doctype.internal.attr.types.implied.test
8792     @@@DEnt:
8793     @@@@test:value:
8794     <!DOCTYPE a [
8795     <!ATTLIST a
8796     at1 ID #IMPLIED
8797     at2 IDREF #IMPLIED
8798     at3 IDREFS #IMPLIED
8799     at4 ENTITY #IMPLIED
8800     at5 ENTITIES #IMPLIED
8801     at6 NMTOKEN #IMPLIED
8802     at7 NMTOKENS #IMPLIED
8803     at8 NOTATION (n1 | n2|n3) #IMPLIED
8804     at9 (e1| e2| e3 ) #IMPLIED
8805     >
8806     ]>
8807     <a></a>
8808     @@@test:domTree:
8809     document {
8810     xml-version: '1.0';
8811     xml-encoding: null;
8812     xml-standalone: false;
8813     document-type {
8814     node-name: 'a';
8815     element-type-definition {
8816     node-name: 'a';
8817     attribute-definition {
8818     node-name: 'at1';
8819     declared-type: const (ID_ATTR);
8820     allowed-tokens: DOMStringList ();
8821     default-type: const (IMPLIED_DEFAULT);
8822     text-content: '';
8823     }
8824     attribute-definition {
8825     node-name: 'at2';
8826     declared-type: const (IDREF_ATTR);
8827     allowed-tokens: DOMStringList ();
8828     default-type: const (IMPLIED_DEFAULT);
8829     text-content: '';
8830     }
8831     attribute-definition {
8832     node-name: 'at3';
8833     declared-type: const (IDREFS_ATTR);
8834     allowed-tokens: DOMStringList ();
8835     default-type: const (IMPLIED_DEFAULT);
8836     text-content: '';
8837     }
8838     attribute-definition {
8839     node-name: 'at4';
8840     declared-type: const (ENTITY_ATTR);
8841     allowed-tokens: DOMStringList ();
8842     default-type: const (IMPLIED_DEFAULT);
8843     text-content: '';
8844     }
8845     attribute-definition {
8846     node-name: 'at5';
8847     declared-type: const (ENTITIES_ATTR);
8848     allowed-tokens: DOMStringList ();
8849     default-type: const (IMPLIED_DEFAULT);
8850     text-content: '';
8851     }
8852     attribute-definition {
8853     node-name: 'at6';
8854     declared-type: const (NMTOKEN_ATTR);
8855     allowed-tokens: DOMStringList ();
8856     default-type: const (IMPLIED_DEFAULT);
8857     text-content: '';
8858     }
8859     attribute-definition {
8860     node-name: 'at7';
8861     declared-type: const (NMTOKENS_ATTR);
8862     allowed-tokens: DOMStringList ();
8863     default-type: const (IMPLIED_DEFAULT);
8864     text-content: '';
8865     }
8866     attribute-definition {
8867     node-name: 'at8';
8868     declared-type: const (NOTATION_ATTR);
8869     allowed-tokens: DOMStringList ('n1', 'n2', 'n3');
8870     default-type: const (IMPLIED_DEFAULT);
8871     text-content: '';
8872     }
8873     attribute-definition {
8874     node-name: 'at9';
8875     declared-type: const (ENUMERATION_ATTR);
8876     allowed-tokens: DOMStringList ('e1', 'e2', 'e3');
8877     default-type: const (IMPLIED_DEFAULT);
8878     text-content: '';
8879     }
8880     }
8881     }
8882     element {
8883     namespace-uri: null;
8884     local-name: 'a';
8885     }
8886     }
8887     @@XMLTest:
8888     @@@QName: xp.doctype.internal.attr.cdata.defaults.test
8889     @@@DEnt:
8890     @@@@test:value:
8891     <!DOCTYPE a [
8892     <!ATTLIST a
8893     at1 CDATA #IMPLIED
8894     at2 CDATA #REQUIRED
8895     at3 CDATA #FIXED "value3"
8896     at4 CDATA "value4"
8897     at5 CDATA #FIXED 'value5'
8898     at6 CDATA 'value6'
8899     >
8900     ]>
8901     <a></a>
8902     @@@test:domTree:
8903     document {
8904     xml-version: '1.0';
8905     xml-encoding: null;
8906     xml-standalone: false;
8907     document-type {
8908     node-name: 'a';
8909     element-type-definition {
8910     node-name: 'a';
8911     attribute-definition {
8912     node-name: 'at1';
8913     declared-type: const (CDATA_ATTR);
8914     allowed-tokens: DOMStringList ();
8915     default-type: const (IMPLIED_DEFAULT);
8916     text-content: '';
8917     }
8918     attribute-definition {
8919     node-name: 'at2';
8920     declared-type: const (CDATA_ATTR);
8921     allowed-tokens: DOMStringList ();
8922     default-type: const (REQUIRED_DEFAULT);
8923     text-content: '';
8924     }
8925     attribute-definition {
8926     node-name: 'at3';
8927     declared-type: const (CDATA_ATTR);
8928     allowed-tokens: DOMStringList ();
8929     default-type: const (FIXED_DEFAULT);
8930     text-content: 'value3';
8931     }
8932     attribute-definition {
8933     node-name: 'at4';
8934     declared-type: const (CDATA_ATTR);
8935     allowed-tokens: DOMStringList ();
8936     default-type: const (EXPLICIT_DEFAULT);
8937     text-content: 'value4';
8938     }
8939     attribute-definition {
8940     node-name: 'at5';
8941     declared-type: const (CDATA_ATTR);
8942     allowed-tokens: DOMStringList ();
8943     default-type: const (FIXED_DEFAULT);
8944     text-content: 'value5';
8945     }
8946     attribute-definition {
8947     node-name: 'at6';
8948     declared-type: const (CDATA_ATTR);
8949     allowed-tokens: DOMStringList ();
8950     default-type: const (EXPLICIT_DEFAULT);
8951     text-content: 'value6';
8952     }
8953     }
8954     }
8955     element {
8956     namespace-uri: null;
8957     local-name: 'a';
8958     attribute {
8959     node-name: 'at3';
8960     text-content: 'value3';
8961     specified: false;
8962     }
8963     attribute {
8964     node-name: 'at4';
8965     text-content: 'value4';
8966     specified: false;
8967     }
8968     attribute {
8969     node-name: 'at5';
8970     text-content: 'value5';
8971     specified: false;
8972     }
8973     attribute {
8974     node-name: 'at6';
8975     text-content: 'value6';
8976     specified: false;
8977     }
8978     }
8979     }
8980    
8981     @@XMLTest:
8982     @@@QName: xp.doctype.internal.attr.cdata.default.normalize.test
8983     @@@DEnt:
8984     @@@@test:value:
8985     <!DOCTYPE a [
8986     <!ATTLIST a
8987     at CDATA " default &#x0A;value "
8988     >
8989     ]>
8990     <a></a>
8991     @@@test:domTree:
8992     document {
8993     xml-version: '1.0';
8994     xml-encoding: null;
8995     xml-standalone: false;
8996     document-type {
8997     node-name: 'a';
8998     element-type-definition {
8999     node-name: 'a';
9000     attribute-definition {
9001     node-name: 'at';
9002     declared-type: const (CDATA_ATTR);
9003     allowed-tokens: DOMStringList ();
9004     default-type: const (EXPLICIT_DEFAULT);
9005     text-content: ' default ' U+000A 'value ';
9006     }
9007     }
9008     }
9009     element {
9010     namespace-uri: null;
9011     local-name: 'a';
9012     attribute {
9013     node-name: 'at';
9014     text-content: ' default ' U+000A 'value ';
9015     specified: false;
9016     }
9017     }
9018     }
9019     @@XMLTest:
9020     @@@QName: xp.doctype.internal.attr.nmtoken.default.normalize.test
9021     @@@DEnt:
9022     @@@@test:value:
9023     <!DOCTYPE a [
9024     <!ATTLIST a
9025     at NMTOKEN " default &#x0A;value "
9026     >
9027     ]>
9028     <a></a>
9029     @@@test:domTree:
9030     document {
9031     xml-version: '1.0';
9032     xml-encoding: null;
9033     xml-standalone: false;
9034     document-type {
9035     node-name: 'a';
9036     element-type-definition {
9037     node-name: 'a';
9038     attribute-definition {
9039     node-name: 'at';
9040     declared-type: const (NMTOKEN_ATTR);
9041     allowed-tokens: DOMStringList ();
9042     default-type: const (EXPLICIT_DEFAULT);
9043     text-content: ' default ' U+000A 'value ';
9044     }
9045     }
9046     }
9047     element {
9048     namespace-uri: null;
9049     local-name: 'a';
9050     attribute {
9051     node-name: 'at';
9052     text-content: ' default ' U+000A 'value ';
9053     specified: false;
9054     }
9055     }
9056     }
9057    
9058     @@XMLTest:
9059     @@@QName: xp.doctype.attrtype.no-value.test
9060     @@@DEnt:
9061     @@@@test:value:
9062     <!DOCTYPE a>
9063     <a at=" at value "></a>
9064     @@@test:domTree:
9065     document {
9066     xml-version: '1.0';
9067     xml-encoding: null;
9068     xml-standalone: false;
9069     document-type { }
9070     element {
9071     namespace-uri: null;
9072     local-name: 'a';
9073     attribute {
9074     namespace-uri: null;
9075     local-name: 'at';
9076     value: ' at value ';
9077     text {
9078     data: ' at value ';
9079     }
9080     schema-type-info: TypeInfo (null, null);
9081     specified: true;
9082     }
9083     }
9084     }
9085     @@XMLTest:
9086     @@@QName: xp.doctype.attrtype.cdata.test
9087     @@@DEnt:
9088     @@@@test:value:
9089     <!DOCTYPE a [
9090     <!ATTLIST a
9091     at CDATA #IMPLIED
9092     >
9093     ]>
9094     <a at=" at value "></a>
9095     @@@test:domTree:
9096     document {
9097     xml-version: '1.0';
9098     xml-encoding: null;
9099     xml-standalone: false;
9100     document-type { }
9101     element {
9102     namespace-uri: null;
9103     local-name: 'a';
9104     attribute {
9105     namespace-uri: null;
9106     local-name: 'at';
9107     value: ' at value ';
9108     text {
9109     data: ' at value ';
9110     }
9111     schema-type-info:
9112     TypeInfo ('http://www.w3.org/TR/REC-xml', 'CDATA');
9113     specified: true;
9114     }
9115     }
9116     }
9117     @@XMLTest:
9118     @@@QName: xp.doctype.attrtype.nmtoken.test
9119     @@@DEnt:
9120     @@@@test:value:
9121     <!DOCTYPE a [
9122     <!ATTLIST a
9123     at NMTOKEN #IMPLIED
9124     >
9125     ]>
9126     <a at=" at value "></a>
9127     @@@test:domTree:
9128     document {
9129     xml-version: '1.0';
9130     xml-encoding: null;
9131     xml-standalone: false;
9132     document-type { }
9133     element {
9134     namespace-uri: null;
9135     local-name: 'a';
9136     attribute {
9137     namespace-uri: null;
9138     local-name: 'at';
9139     value: 'at value';
9140     text {
9141     data: ' at value ';
9142     }
9143     schema-type-info:
9144     TypeInfo ('http://www.w3.org/TR/REC-xml', 'NMTOKEN');
9145     specified: true;
9146     }
9147     }
9148     }
9149    
9150     @@XMLTest:
9151     @@@QName: xp.doctype.attr.normalization.1.test
9152     @@@DEnt:
9153     @@@@test:value:
9154     <a at=" at &#xA;value "></a>
9155     @@@test:domTree:
9156     document {
9157     element {
9158     attribute {
9159     node-name: 'at';
9160     value: ' at ' U+000A 'value ';
9161     schema-type-info: TypeInfo (null, null);
9162     specified: true;
9163     }
9164     }
9165     }
9166     @@XMLTest:
9167     @@@QName: xp.doctype.attr.normalization.2.test
9168     @@@DEnt:
9169     @@@@test:value:
9170     <a at=" at &#xD;value "></a>
9171     @@@test:domTree:
9172     document {
9173     element {
9174     attribute {
9175     value: ' at ' U+000D 'value ';
9176     schema-type-info: TypeInfo (null, null);
9177     specified: true;
9178     }
9179     }
9180     }
9181     @@XMLTest:
9182     @@@QName: xp.doctype.attr.normalization.3.test
9183     @@@DEnt:
9184     @@@@test:value:
9185     <a at=" at &#x9;value "></a>
9186     @@@test:domTree:
9187     document {
9188     element {
9189     attribute {
9190     node-name: 'at';
9191     value: ' at ' U+0009 'value ';
9192     schema-type-info: TypeInfo (null, null);
9193     specified: true;
9194     }
9195     }
9196     }
9197    
9198     @@XMLTest:
9199     @@@QName: xp.doctype.attr.specified.1.test
9200     @@@DEnt:
9201     @@@@test:value:
9202     <!DOCTYPE a [
9203     <!ATTLIST a
9204     at CDATA "default"
9205     >
9206     ]>
9207     <a></a>
9208     @@@test:domTree:
9209     document {
9210     document-type { }
9211     element {
9212     attribute {
9213     node-name: 'at';
9214     value: 'default';
9215     specified: false;
9216     }
9217     }
9218     }
9219     @@XMLTest:
9220     @@@QName: xp.doctype.attr.specified.2.test
9221     @@@DEnt:
9222     @@@@test:value:
9223     <!DOCTYPE a [
9224     <!ATTLIST a
9225     at CDATA "default"
9226     >
9227     ]>
9228     <a at2="specified"></a>
9229     @@@test:domTree:
9230     document {
9231     document-type { }
9232     element {
9233     attribute {
9234     node-name: 'at';
9235     value: 'default';
9236     specified: false;
9237     }
9238     attribute {
9239     node-name: 'at2';
9240     value: 'specified';
9241     specified: true;
9242     }
9243     }
9244     }
9245     @@XMLTest:
9246     @@@QName: xp.doctype.attr.specified.3.test
9247     @@@DEnt:
9248     @@@@test:value:
9249     <!DOCTYPE a [
9250     <!ATTLIST a
9251     at CDATA "default"
9252     >
9253     ]>
9254     <a at="specified"></a>
9255     @@@test:domTree:
9256     document {
9257     document-type { }
9258     element {
9259     attribute {
9260     node-name: 'at';
9261     value: 'specified';
9262     specified: true;
9263     }
9264     }
9265     }
9266    
9267     @@XMLTest:
9268     @@@QName: xp.attr.literal.charref.test
9269     @@@DEnt:
9270     @@@@test:value:
9271     <a at1 = "value&#33;_&#x25;value"
9272     at2 = 'value&#x25;_&#33;value'></a>
9273     @@@test:domTree:
9274     document {
9275     element {
9276     attribute {
9277     node-name: 'at1';
9278     text-content: 'value!_%value';
9279     }
9280     attribute {
9281     node-name: 'at2';
9282     text-content: 'value%_!value';
9283     }
9284     }
9285     }
9286     @@XMLTest:
9287     @@@QName: xp.attr.literal.entref.test
9288     @@@DEnt:
9289     @@@@test:value:
9290     <!DOCTYPE a [
9291     <!ENTITY ent "entity&#x26;#33;_&#x26;#x29;value">
9292     ]>
9293     <a at1 = "value&ent;value"
9294     at2 = 'value&ent;value'></a>
9295 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
9296 wakaba 1.18 @@@test:domTree:
9297     document {
9298     document-type {
9299     general-entity {
9300     node-name: 'ent';
9301     text-content: 'entity!_)value';
9302     }
9303     }
9304     element {
9305     attribute {
9306     node-name: 'at1';
9307     text-content: 'valueentity!_)valuevalue';
9308     }
9309     attribute {
9310     node-name: 'at2';
9311     text-content: 'valueentity!_)valuevalue';
9312     }
9313     }
9314     }
9315     @@XMLTest:
9316     @@@QName: xp.attr.literal.entref.nest.test
9317     @@@DEnt:
9318     @@@@test:value:
9319     <!DOCTYPE a [
9320     <!ENTITY ent1 "entity&#x26;#33;_&#x26;#x29;value">
9321     <!ENTITY ent2 "@&ent1;@">
9322     ]>
9323     <a at1 = "value&ent2;value"
9324     at2 = 'value&ent2;value'></a>
9325 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
9326 wakaba 1.18 @@@test:domTree:
9327     document {
9328     document-type {
9329     general-entity {
9330     node-name: 'ent1';
9331     text-content: 'entity!_)value';
9332     }
9333     general-entity {
9334     node-name: 'ent2';
9335     text-content: '@entity!_)value@';
9336     }
9337     }
9338     element {
9339     attribute {
9340     node-name: 'at1';
9341     text-content: 'value@entity!_)value@value';
9342     }
9343     attribute {
9344     node-name: 'at2';
9345     text-content: 'value@entity!_)value@value';
9346     }
9347     }
9348     }
9349    
9350     @@XMLTest:
9351     @@@QName: xp.element.content.ncr.1.test
9352     @@@DEnt:
9353     @@@@test:value:
9354     <e>&#33;</e>
9355     @@@test:domTree:
9356     document {
9357     element {
9358     text-content: '!';
9359     }
9360     }
9361     @@XMLTest:
9362     @@@QName: xp.element.content.ncr.2.test
9363     @@@DEnt:
9364     @@@@test:value:
9365     <e>aaaa&#33;bbbb</e>
9366     @@@test:domTree:
9367     document {
9368     element {
9369     text-content: 'aaaa!bbbb';
9370 wakaba 1.31 text {
9371     text-content: 'aaaa!bbbb';
9372     }
9373 wakaba 1.18 }
9374     }
9375     @@XMLTest:
9376     @@@QName: xp.attrval.ncr.1.test
9377     @@@DEnt:
9378     @@@@test:value:
9379     <e a="&#33;"/>
9380     @@@test:domTree:
9381     document {
9382     element {
9383     attribute {
9384     node-name: 'a';
9385     text-content: '!';
9386     }
9387     }
9388     }
9389     @@XMLTest:
9390     @@@QName: xp.attrval.ncr.2.test
9391     @@@DEnt:
9392     @@@@test:value:
9393     <e a="aaaaa&#33;bbbbb"/>
9394     @@@test:domTree:
9395     document {
9396     element {
9397     attribute {
9398     node-name: 'a';
9399     text-content: 'aaaaa!bbbbb';
9400 wakaba 1.31 text {
9401     text-content: 'aaaaa!bbbbb';
9402     }
9403 wakaba 1.18 }
9404     }
9405     }
9406     @@XMLTest:
9407     @@@QName: xp.attrval.ncr.3.test
9408     @@@DEnt:
9409     @@@@test:value:
9410     <e a='&#33;'/>
9411     @@@test:domTree:
9412     document {
9413     element {
9414     attribute {
9415     node-name: 'a';
9416     text-content: '!';
9417     }
9418     }
9419     }
9420     @@XMLTest:
9421     @@@QName: xp.attrval.ncr.4.test
9422     @@@DEnt:
9423     @@@@test:value:
9424     <e a='aaaaa&#33;bbbbb'/>
9425     @@@test:domTree:
9426     document {
9427     element {
9428     attribute {
9429     node-name: 'a';
9430     text-content: 'aaaaa!bbbbb';
9431     }
9432     }
9433     }
9434     @@XMLTest:
9435     @@@QName: xp.entval.ncr.1.test
9436     @@@DEnt:
9437     @@@@test:value:
9438     <!DOCTYPE e [
9439     <!ENTITY ent "&#33;">
9440     ]>
9441     <e/>
9442 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
9443 wakaba 1.18 @@@test:domTree:
9444     document {
9445     document-type {
9446     general-entity {
9447     node-name: 'ent';
9448     text-content: '!';
9449     }
9450     }
9451     element { }
9452     }
9453     @@XMLTest:
9454     @@@QName: xp.entval.ncr.2.test
9455     @@@DEnt:
9456     @@@@test:value:
9457     <!DOCTYPE e [
9458     <!ENTITY ent "aaaaa&#33;bbbbb">
9459     ]>
9460     <e/>
9461 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
9462 wakaba 1.18 @@@test:domTree:
9463     document {
9464     document-type {
9465     general-entity {
9466     node-name: 'ent';
9467     text-content: 'aaaaa!bbbbb';
9468     }
9469     }
9470     element { }
9471     }
9472     @@XMLTest:
9473     @@@QName: xp.element.content.reptxt.ncr.1.test
9474     @@@DEnt:
9475     @@@@test:value:
9476     <!DOCTYPE e [
9477     <!ENTITY ent "&#38;#33;">
9478     ]>
9479     <e>&ent;</e>
9480     @@@test:domTree:
9481     document {
9482     document-type { }
9483     element {
9484     general-entity-reference {
9485     node-name: 'ent';
9486     text-content: '!';
9487 wakaba 1.34 manakai-expanded: true;
9488 wakaba 1.18 }
9489     }
9490     }
9491     @@XMLTest:
9492     @@@QName: xp.element.content.reptxt.ncr.2.test
9493     @@@DEnt:
9494     @@@@test:value:
9495     <!DOCTYPE e [
9496     <!ENTITY ent "aaaaa&#38;#33;bbbbb">
9497     ]>
9498     <e>&ent;</e>
9499     @@@test:domTree:
9500     document {
9501     document-type { }
9502     element {
9503     general-entity-reference {
9504     node-name: 'ent';
9505     text-content: 'aaaaa!bbbbb';
9506 wakaba 1.34 manakai-expanded: true;
9507 wakaba 1.18 }
9508     }
9509     }
9510     @@XMLTest:
9511     @@@QName: xp.element.content.reptxt.reptxt.ncr.1.test
9512     @@@DEnt:
9513     @@@@test:value:
9514     <!DOCTYPE e [
9515     <!ENTITY ent "&#38;#33;">
9516     <!ENTITY ent2 "&ent;">
9517     ]>
9518     <e>&ent2;</e>
9519     @@@test:domTree:
9520     document {
9521     document-type { }
9522     element {
9523     general-entity-reference {
9524     node-name: 'ent2';
9525     general-entity-reference {
9526     node-name: 'ent';
9527     text-content: '!';
9528 wakaba 1.34 manakai-expanded: true;
9529 wakaba 1.18 }
9530 wakaba 1.34 manakai-expanded: true;
9531 wakaba 1.18 }
9532     }
9533     }
9534     @@XMLTest:
9535     @@@QName: xp.element.content.reptxt.reptxt.ncr.2.test
9536     @@@DEnt:
9537     @@@@test:value:
9538     <!DOCTYPE e [
9539     <!ENTITY ent "aa&#38;#33;bb">
9540     <!ENTITY ent2 "&ent;">
9541     ]>
9542     <e>&ent2;</e>
9543     @@@test:domTree:
9544     document {
9545     document-type { }
9546     element {
9547     general-entity-reference {
9548     node-name: 'ent2';
9549     general-entity-reference {
9550     node-name: 'ent';
9551     text-content: 'aa!bb';
9552 wakaba 1.34 manakai-expanded: true;
9553 wakaba 1.31 text {
9554     text-content: 'aa!bb';
9555     }
9556 wakaba 1.18 }
9557 wakaba 1.34 manakai-expanded: true;
9558 wakaba 1.18 }
9559     }
9560     }
9561     @@XMLTest:
9562     @@@QName: xp.attval.reptxt.ncr.1.test
9563     @@@DEnt:
9564     @@@@test:value:
9565     <!DOCTYPE e [
9566     <!ENTITY ent "&#38;#33;">
9567     ]>
9568     <e a="&ent;"/>
9569     @@@test:domTree:
9570     document {
9571     document-type { }
9572     element {
9573     attribute {
9574     node-name: 'a';
9575     general-entity-reference {
9576     node-name: 'ent';
9577     text-content: '!';
9578 wakaba 1.34 manakai-expanded: true;
9579 wakaba 1.18 }
9580     }
9581     }
9582     }
9583     @@XMLTest:
9584     @@@QName: xp.attval.reptxt.ncr.2.test
9585     @@@DEnt:
9586     @@@@test:value:
9587     <!DOCTYPE e [
9588     <!ENTITY ent "aaaaa&#38;#33;bbbbb">
9589     ]>
9590     <e a="&ent;"/>
9591     @@@test:domTree:
9592     document {
9593     document-type { }
9594     element {
9595     attribute {
9596     node-name: 'a';
9597     general-entity-reference {
9598     node-name: 'ent';
9599     text-content: 'aaaaa!bbbbb';
9600 wakaba 1.34 manakai-expanded: true;
9601 wakaba 1.31 text {
9602     text-content: 'aaaaa!bbbbb';
9603     }
9604 wakaba 1.18 }
9605     }
9606     }
9607     }
9608     @@XMLTest:
9609     @@@QName: xp.attval.reptxt.reptxt.ncr.1.test
9610     @@@DEnt:
9611     @@@@test:value:
9612     <!DOCTYPE e [
9613     <!ENTITY ent "&#38;#33;">
9614     <!ENTITY ent2 "&ent;">
9615     ]>
9616     <e a="&ent2;"/>
9617     @@@test:domTree:
9618     document {
9619     document-type { }
9620     element {
9621     attribute {
9622     node-name: 'a';
9623     general-entity-reference {
9624     node-name: 'ent2';
9625 wakaba 1.34 manakai-expanded: true;
9626 wakaba 1.18 general-entity-reference {
9627     node-name: 'ent';
9628     text-content: '!';
9629 wakaba 1.34 manakai-expanded: true;
9630 wakaba 1.18 }
9631     }
9632     }
9633     }
9634     }
9635     @@XMLTest:
9636     @@@QName: xp.attval.reptxt.reptxt.ncr.2.test
9637     @@@DEnt:
9638     @@@@test:value:
9639     <!DOCTYPE e [
9640     <!ENTITY ent "aa&#38;#33;bb">
9641     <!ENTITY ent2 "&ent;">
9642     ]>
9643     <e a="&ent2;"/>
9644     @@@test:domTree:
9645     document {
9646     document-type { }
9647     element {
9648     attribute {
9649     node-name: 'a';
9650     general-entity-reference {
9651     node-name: 'ent2';
9652 wakaba 1.34 manakai-expanded: true;
9653 wakaba 1.18 general-entity-reference {
9654     node-name: 'ent';
9655     text-content: 'aa!bb';
9656 wakaba 1.34 manakai-expanded: true;
9657 wakaba 1.18 }
9658     }
9659     }
9660     }
9661     }
9662    
9663     @@XMLTest:
9664     @@@QName: xp.element.content.hcr.1.test
9665     @@@DEnt:
9666     @@@@test:value:
9667     <e>&#x21;</e>
9668     @@@test:domTree:
9669     document {
9670     element {
9671     text-content: '!';
9672     }
9673     }
9674     @@XMLTest:
9675     @@@QName: xp.element.content.hcr.2.test
9676     @@@DEnt:
9677     @@@@test:value:
9678     <e>aaaa&#x21;bbbb</e>
9679     @@@test:domTree:
9680     document {
9681     element {
9682     text-content: 'aaaa!bbbb';
9683 wakaba 1.31 text {
9684     text-content: 'aaaa!bbbb';
9685     }
9686 wakaba 1.18 }
9687     }
9688     @@XMLTest:
9689     @@@QName: xp.attrval.hcr.1.test
9690     @@@DEnt:
9691     @@@@test:value:
9692     <e a="&#x21;"/>
9693     @@@test:domTree:
9694     document {
9695     element {
9696     attribute {
9697     node-name: 'a';
9698     text-content: '!';
9699     }
9700     }
9701     }
9702     @@XMLTest:
9703     @@@QName: xp.attrval.hcr.2.test
9704     @@@DEnt:
9705     @@@@test:value:
9706     <e a="aaaaa&#x21;bbbbb"/>
9707     @@@test:domTree:
9708     document {
9709     element {
9710     attribute {
9711     node-name: 'a';
9712     text-content: 'aaaaa!bbbbb';
9713 wakaba 1.31 text {
9714     text-content: 'aaaaa!bbbbb';
9715     }
9716 wakaba 1.18 }
9717     }
9718     }
9719     @@XMLTest:
9720     @@@QName: xp.attrval.hcr.3.test
9721     @@@DEnt:
9722     @@@@test:value:
9723     <e a='&#x21;'/>
9724     @@@test:domTree:
9725     document {
9726     element {
9727     attribute {
9728     node-name: 'a';
9729     text-content: '!';
9730     }
9731     }
9732     }
9733     @@XMLTest:
9734     @@@QName: xp.attrval.hcr.4.test
9735     @@@DEnt:
9736     @@@@test:value:
9737     <e a='aaaaa&#x21;bbbbb'/>
9738     @@@test:domTree:
9739     document {
9740     element {
9741     attribute {
9742     node-name: 'a';
9743     text-content: 'aaaaa!bbbbb';
9744     }
9745     }
9746     }
9747     @@XMLTest:
9748     @@@QName: xp.entval.hcr.1.test
9749     @@@DEnt:
9750     @@@@test:value:
9751     <!DOCTYPE e [
9752     <!ENTITY ent "&#x21;">
9753     ]>
9754     <e/>
9755 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
9756 wakaba 1.18 @@@test:domTree:
9757     document {
9758     document-type {
9759     general-entity {
9760     node-name: 'ent';
9761     text-content: '!';
9762 wakaba 1.10 }
9763 wakaba 1.9 }
9764 wakaba 1.18 element { }
9765 wakaba 1.9 }
9766     @@XMLTest:
9767 wakaba 1.18 @@@QName: xp.entval.hcr.2.test
9768 wakaba 1.9 @@@DEnt:
9769     @@@@test:value:
9770 wakaba 1.18 <!DOCTYPE e [
9771     <!ENTITY ent "aaaaa&#x21;bbbbb">
9772     ]>
9773     <e/>
9774 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
9775 wakaba 1.9 @@@test:domTree:
9776     document {
9777 wakaba 1.18 document-type {
9778     general-entity {
9779     node-name: 'ent';
9780     text-content: 'aaaaa!bbbbb';
9781 wakaba 1.31 text {
9782     text-content: 'aaaaa!bbbbb';
9783     }
9784 wakaba 1.9 }
9785     }
9786 wakaba 1.18 element { }
9787 wakaba 1.9 }
9788     @@XMLTest:
9789 wakaba 1.18 @@@QName: xp.element.content.reptxt.hcr.1.test
9790 wakaba 1.9 @@@DEnt:
9791     @@@@test:value:
9792 wakaba 1.18 <!DOCTYPE e [
9793     <!ENTITY ent "&#38;#x21;">
9794 wakaba 1.9 ]>
9795 wakaba 1.18 <e>&ent;</e>
9796 wakaba 1.9 @@@test:domTree:
9797     document {
9798     document-type { }
9799     element {
9800 wakaba 1.18 general-entity-reference {
9801     node-name: 'ent';
9802     text-content: '!';
9803 wakaba 1.34 manakai-expanded: true;
9804 wakaba 1.9 }
9805     }
9806     }
9807     @@XMLTest:
9808 wakaba 1.18 @@@QName: xp.element.content.reptxt.hcr.2.test
9809 wakaba 1.9 @@@DEnt:
9810     @@@@test:value:
9811 wakaba 1.18 <!DOCTYPE e [
9812     <!ENTITY ent "aaaaa&#38;#x21;bbbbb">
9813 wakaba 1.9 ]>
9814 wakaba 1.18 <e>&ent;</e>
9815 wakaba 1.9 @@@test:domTree:
9816     document {
9817     document-type { }
9818     element {
9819 wakaba 1.18 general-entity-reference {
9820     node-name: 'ent';
9821     text-content: 'aaaaa!bbbbb';
9822 wakaba 1.34 manakai-expanded: true;
9823 wakaba 1.9 }
9824     }
9825     }
9826     @@XMLTest:
9827 wakaba 1.18 @@@QName: xp.element.content.reptxt.reptxt.hcr.1.test
9828 wakaba 1.9 @@@DEnt:
9829     @@@@test:value:
9830 wakaba 1.18 <!DOCTYPE e [
9831     <!ENTITY ent "&#38;#x21;">
9832     <!ENTITY ent2 "&ent;">
9833     ]>
9834     <e>&ent2;</e>
9835 wakaba 1.9 @@@test:domTree:
9836     document {
9837 wakaba 1.18 document-type { }
9838 wakaba 1.9 element {
9839 wakaba 1.18 general-entity-reference {
9840     node-name: 'ent2';
9841 wakaba 1.34 manakai-expanded: true;
9842 wakaba 1.18 general-entity-reference {
9843     node-name: 'ent';
9844     text-content: '!';
9845 wakaba 1.34 manakai-expanded: true;
9846 wakaba 1.18 }
9847 wakaba 1.9 }
9848     }
9849     }
9850     @@XMLTest:
9851 wakaba 1.18 @@@QName: xp.element.content.reptxt.reptxt.hcr.2.test
9852 wakaba 1.9 @@@DEnt:
9853     @@@@test:value:
9854 wakaba 1.18 <!DOCTYPE e [
9855     <!ENTITY ent "aa&#38;#x21;bb">
9856     <!ENTITY ent2 "&ent;">
9857     ]>
9858     <e>&ent2;</e>
9859 wakaba 1.9 @@@test:domTree:
9860     document {
9861 wakaba 1.18 document-type { }
9862 wakaba 1.9 element {
9863 wakaba 1.18 general-entity-reference {
9864     node-name: 'ent2';
9865 wakaba 1.34 manakai-expanded: true;
9866 wakaba 1.18 general-entity-reference {
9867     node-name: 'ent';
9868 wakaba 1.34 manakai-expanded: true;
9869 wakaba 1.18 text-content: 'aa!bb';
9870     }
9871 wakaba 1.9 }
9872     }
9873     }
9874     @@XMLTest:
9875 wakaba 1.18 @@@QName: xp.attval.reptxt.hcr.1.test
9876 wakaba 1.9 @@@DEnt:
9877     @@@@test:value:
9878 wakaba 1.18 <!DOCTYPE e [
9879     <!ENTITY ent "&#38;#x21;">
9880     ]>
9881     <e a="&ent;"/>
9882 wakaba 1.9 @@@test:domTree:
9883     document {
9884 wakaba 1.18 document-type { }
9885 wakaba 1.9 element {
9886     attribute {
9887 wakaba 1.18 node-name: 'a';
9888     general-entity-reference {
9889     node-name: 'ent';
9890 wakaba 1.34 manakai-expanded: true;
9891 wakaba 1.18 text-content: '!';
9892     }
9893 wakaba 1.10 }
9894     }
9895     }
9896     @@XMLTest:
9897 wakaba 1.18 @@@QName: xp.attval.reptxt.hcr.2.test
9898 wakaba 1.10 @@@DEnt:
9899     @@@@test:value:
9900 wakaba 1.18 <!DOCTYPE e [
9901     <!ENTITY ent "aaaaa&#38;#x21;bbbbb">
9902 wakaba 1.10 ]>
9903 wakaba 1.18 <e a="&ent;"/>
9904 wakaba 1.10 @@@test:domTree:
9905     document {
9906     document-type { }
9907     element {
9908     attribute {
9909 wakaba 1.18 node-name: 'a';
9910     general-entity-reference {
9911     node-name: 'ent';
9912 wakaba 1.34 manakai-expanded: true;
9913 wakaba 1.18 text-content: 'aaaaa!bbbbb';
9914 wakaba 1.31 text {
9915     text-content: 'aaaaa!bbbbb';
9916     }
9917 wakaba 1.18 }
9918 wakaba 1.10 }
9919     }
9920     }
9921     @@XMLTest:
9922 wakaba 1.18 @@@QName: xp.attval.reptxt.reptxt.hcr.1.test
9923 wakaba 1.10 @@@DEnt:
9924     @@@@test:value:
9925 wakaba 1.18 <!DOCTYPE e [
9926     <!ENTITY ent "&#38;#x21;">
9927     <!ENTITY ent2 "&ent;">
9928 wakaba 1.10 ]>
9929 wakaba 1.18 <e a="&ent2;"/>
9930 wakaba 1.10 @@@test:domTree:
9931     document {
9932     document-type { }
9933     element {
9934     attribute {
9935 wakaba 1.18 node-name: 'a';
9936     general-entity-reference {
9937     node-name: 'ent2';
9938 wakaba 1.34 manakai-expanded: true;
9939 wakaba 1.18 general-entity-reference {
9940     node-name: 'ent';
9941 wakaba 1.34 manakai-expanded: true;
9942 wakaba 1.18 text-content: '!';
9943     }
9944     }
9945 wakaba 1.10 }
9946     }
9947     }
9948     @@XMLTest:
9949 wakaba 1.18 @@@QName: xp.attval.reptxt.reptxt.hcr.2.test
9950 wakaba 1.10 @@@DEnt:
9951     @@@@test:value:
9952 wakaba 1.18 <!DOCTYPE e [
9953     <!ENTITY ent "aa&#38;#x21;bb">
9954     <!ENTITY ent2 "&ent;">
9955 wakaba 1.10 ]>
9956 wakaba 1.18 <e a="&ent2;"/>
9957 wakaba 1.10 @@@test:domTree:
9958     document {
9959     document-type { }
9960     element {
9961     attribute {
9962 wakaba 1.18 node-name: 'a';
9963     general-entity-reference {
9964     node-name: 'ent2';
9965 wakaba 1.34 manakai-expanded: true;
9966 wakaba 1.18 general-entity-reference {
9967     node-name: 'ent';
9968 wakaba 1.34 manakai-expanded: true;
9969 wakaba 1.18 text-content: 'aa!bb';
9970     }
9971     }
9972 wakaba 1.11 }
9973     }
9974     }
9975    
9976     @@XMLTest:
9977 wakaba 1.18 @@@QName: xp.element.content.ncr.legal.char.1.0.1.test
9978     @@@DEnt:
9979     @@@@test:value:
9980     <?xml version="1.0"?>
9981     <e>&#0;</e>
9982     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 7); }
9983     @@XMLTest:
9984     @@@QName: xp.element.content.ncr.legal.char.1.1.1.test
9985     @@@DEnt:
9986     @@@@test:value:
9987     <?xml version="1.1"?>
9988     <e>&#0;</e>
9989     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 7); }
9990     @@XMLTest:
9991     @@@QName: xp.element.content.ncr.legal.char.1.0.2.test
9992     @@@DEnt:
9993     @@@@test:value:
9994     <?xml version="1.0"?>
9995     <e>&#1;</e>
9996     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 7); }
9997     @@XMLTest:
9998     @@@QName: xp.element.content.ncr.legal.char.1.1.2.test
9999 wakaba 1.11 @@@DEnt:
10000     @@@@test:value:
10001 wakaba 1.18 <?xml version="1.1"?>
10002     <e>&#1;</e>
10003 wakaba 1.11 @@@test:domTree:
10004     document {
10005 wakaba 1.18 xml-version: '1.1';
10006 wakaba 1.11 element {
10007 wakaba 1.18 text-content: U+0001;
10008 wakaba 1.11 }
10009     }
10010     @@XMLTest:
10011 wakaba 1.18 @@@QName: xp.element.content.hcr.legal.char.1.0.1.test
10012     @@@DEnt:
10013     @@@@test:value:
10014     <?xml version="1.0"?>
10015     <e>&#x0;</e>
10016     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 8); }
10017     @@XMLTest:
10018     @@@QName: xp.element.content.hcr.legal.char.1.1.1.test
10019     @@@DEnt:
10020     @@@@test:value:
10021     <?xml version="1.1"?>
10022     <e>&#x0;</e>
10023     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 8); }
10024     @@XMLTest:
10025     @@@QName: xp.element.content.hcr.legal.char.1.0.2.test
10026 wakaba 1.11 @@@DEnt:
10027     @@@@test:value:
10028 wakaba 1.18 <?xml version="1.0"?>
10029     <e>&#x1;</e>
10030     @@@c:erred: <[[xp|wf-legal-character]]> { (2, 4)..(2, 8); }
10031 wakaba 1.11 @@XMLTest:
10032 wakaba 1.18 @@@QName: xp.element.content.hcr.legal.char.1.1.2.test
10033 wakaba 1.11 @@@DEnt:
10034     @@@@test:value:
10035 wakaba 1.18 <?xml version="1.1"?>
10036     <e>&#x1;</e>
10037 wakaba 1.11 @@@test:domTree:
10038     document {
10039 wakaba 1.18 xml-version: '1.1';
10040 wakaba 1.11 element {
10041 wakaba 1.18 text-content: U+0001;
10042 wakaba 1.6 }
10043     }
10044    
10045 wakaba 1.19 @@XMLTest:
10046     @@@QName: xp.element.content.ger.entity.declared.nodtd.1.test
10047     @@@DEnt:
10048     @@@@test:value:
10049     <p>&entity;</p>
10050     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 4)..(1, 11); }
10051     @@XMLTest:
10052     @@@QName: xp.element.content.ger.entity.declared.nodtd.2.test
10053     @@@DEnt:
10054     @@@@test:value:
10055     <?xml version="1.0" standalone="yes"?>
10056     <p>&entity;</p>
10057     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 4)..(2, 11); }
10058     @@XMLTest:
10059     @@@QName: xp.element.content.ger.entity.declared.nodtd.3.test
10060     @@@DEnt:
10061     @@@@test:value:
10062     <?xml version="1.0" standalone="no"?>
10063     <p>&entity;</p>
10064     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 4)..(2, 11); }
10065     @@XMLTest:
10066     @@@QName: xp.element.content.ger.entity.declared.nodtd.-1.test
10067     @@@DEnt:
10068     @@@@test:value:
10069     <p>&lt;&gt;&amp;&quot;&apos;</p>
10070     @@@test:domTree:
10071     document {
10072     element {
10073     text-content: '<>&"' U+0027;
10074     }
10075     }
10076     @@XMLTest:
10077     @@@QName: xp.element.content.ger.entity.declared.nopref.1.test
10078     @@@DEnt:
10079     @@@@test:value:
10080     <!DOCTYPE p []>
10081     <p>&entity;</p>
10082     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 4)..(2, 11); }
10083     @@XMLTest:
10084     @@@QName: xp.element.content.ger.entity.declared.nopref.2.test
10085     @@@DEnt:
10086     @@@@test:value:
10087     <!DOCTYPE p [
10088     <!ENTITY other "aa">
10089     <!ENTITY % another "aa">
10090     ]>
10091     <p>&entity;</p>
10092     @@@c:erred: <[[xp|wf-entity-declared]]> { (5, 4)..(5, 11); }
10093     @@XMLTest:
10094     @@@QName: xp.element.content.ger.entity.declared.nopref.3.test
10095     @@@DEnt:
10096     @@@@test:value:
10097     <?xml version="1.0" standalone="yes"?>
10098     <!DOCTYPE p []>
10099     <p>&entity;</p>
10100     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 4)..(3, 11); }
10101     @@XMLTest:
10102     @@@QName: xp.element.content.ger.entity.declared.nopref.4.test
10103     @@@DEnt:
10104     @@@@test:value:
10105     <?xml version="1.0" standalone="no"?>
10106     <!DOCTYPE p []>
10107     <p>&entity;</p>
10108     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 4)..(3, 11); }
10109     @@XMLTest:
10110     @@@QName: xp.element.content.ger.entity.declared.nopref.5.test
10111     @@@DEnt:
10112     @@@@test:value:
10113     <?xml version="1.0" standalone="yes"?>
10114     <!DOCTYPE p [
10115     <!ENTITY other "aa">
10116     <!ENTITY % another "aa">
10117     ]>
10118     <p>&entity;</p>
10119     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 4)..(6, 11); }
10120     @@XMLTest:
10121     @@@QName: xp.element.content.ger.entity.declared.nopref.6.test
10122     @@@DEnt:
10123     @@@@test:value:
10124     <?xml version="1.0" standalone="no"?>
10125     <!DOCTYPE p [
10126     <!ENTITY other "aa">
10127     <!ENTITY % another "aa">
10128     ]>
10129     <p>&entity;</p>
10130     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 4)..(6, 11); }
10131     @@XMLTest:
10132     @@@QName: xp.element.content.ger.entity.declared.nopref.-1.test
10133     @@@DEnt:
10134     @@@@test:value:
10135     <!DOCTYPE p [
10136     <!ENTITY entity "value">
10137     ]>
10138     <p>&entity;</p>
10139 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
10140 wakaba 1.19 @@@test:domTree:
10141     document {
10142     document-type {
10143     general-entity {
10144     node-name: 'entity';
10145     text-content: 'value';
10146     }
10147     }
10148     element {
10149 wakaba 1.20 general-entity-reference {
10150 wakaba 1.19 node-name: 'entity';
10151 wakaba 1.34 manakai-expanded: true;
10152 wakaba 1.19 text-content: 'value';
10153     }
10154     }
10155     }
10156     @@XMLTest:
10157     @@@QName: xp.element.content.ger.entity.declared.nopref.-2.test
10158     @@@DEnt:
10159     @@@@test:value:
10160     <!DOCTYPE p [
10161     <!ENTITY entity "value">
10162     <!ENTITY another SYSTEM "another">
10163     ]>
10164     <p>&entity;</p>
10165 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
10166 wakaba 1.19 @@@test:domTree:
10167     document {
10168     document-type {
10169     general-entity {
10170     node-name: 'entity';
10171     text-content: 'value';
10172     }
10173 wakaba 1.20 general-entity {
10174     node-name: 'another';
10175     public-id: null;
10176     system-id: 'another';
10177     }
10178 wakaba 1.19 }
10179     element {
10180 wakaba 1.20 general-entity-reference {
10181 wakaba 1.19 node-name: 'entity';
10182 wakaba 1.34 manakai-expanded: true;
10183 wakaba 1.19 text-content: 'value';
10184     }
10185     }
10186     }
10187     @@XMLTest:
10188     @@@QName: xp.element.content.ger.entity.declared.standalone.1.test
10189     @@@DEnt:
10190     @@@@test:value:
10191     <?xml version="1.0" standalone="yes"?>
10192     <p>&entity;</p>
10193     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 4)..(2, 11); }
10194     @@XMLTest:
10195     @@@QName: xp.element.content.ger.entity.declared.standalone.2.test
10196     @@@DEnt:
10197     @@@@test:value:
10198     <?xml version="1.0" standalone="yes"?>
10199     <!DOCTYPE p []>
10200     <p>&entity;</p>
10201     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 4)..(3, 11); }
10202     @@XMLTest:
10203     @@@QName: xp.element.content.ger.entity.declared.standalone.3.test
10204     @@@DEnt:
10205     @@@@test:value:
10206     <?xml version="1.0" standalone="yes"?>
10207     <!DOCTYPE p [
10208     <!ENTITY % para "<!-- -->">
10209     %para;
10210     ]>
10211     <p>&entity;</p>
10212     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 4)..(6, 11); }
10213     @@XMLTest:
10214     @@@QName: xp.element.content.ger.entity.declared.standalone.-1.test
10215     @@@DEnt:
10216     @@@@test:value:
10217     <?xml version="1.0" standalone="no"?>
10218     <!DOCTYPE p [
10219     <!ENTITY % para "<!-- -->">
10220     %para;
10221     ]>
10222     <p>&entity;</p>
10223     @@@test:domTree:
10224     document {
10225     document-type { }
10226     element {
10227     general-entity-reference {
10228 wakaba 1.34 manakai-expanded: false;
10229 wakaba 1.19 }
10230     }
10231     }
10232     @@XMLTest:
10233     @@@QName: xp.element.content.ger.entity.declared.standalone.-2.test
10234     @@@DEnt:
10235     @@@@test:value:
10236     <!DOCTYPE p [
10237     <!ENTITY % para "<!-- -->">
10238     %para;
10239     ]>
10240     <p>&entity;</p>
10241     @@@test:domTree:
10242     document {
10243     document-type { }
10244     element {
10245     general-entity-reference {
10246 wakaba 1.34 manakai-expanded: false;
10247 wakaba 1.19 }
10248     }
10249     }
10250     @@XMLTest:
10251     @@@QName: xp.element.content.ger.entity.declared.standalone.4.test
10252     @@@DEnt:
10253     @@@@test:value:
10254     <?xml version="1.0" standalone="yes"?>
10255     <!DOCTYPE p [
10256     <!ENTITY % para SYSTEM "para">
10257     %para;
10258     ]>
10259     <p>&entity;</p>
10260     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 4)..(6, 11); }
10261     @@XMLTest:
10262     @@@QName: xp.element.content.ger.entity.declared.standalone.-3.test
10263     @@@DEnt:
10264     @@@@test:value:
10265     <?xml version="1.0" standalone="no"?>
10266     <!DOCTYPE p [
10267     <!ENTITY % para SYSTEM "para">
10268     %para;
10269     ]>
10270     <p>&entity;</p>
10271     @@@test:domTree:
10272     document {
10273     document-type { }
10274     element {
10275     general-entity-reference {
10276 wakaba 1.34 manakai-expanded: false;
10277 wakaba 1.19 }
10278     }
10279     }
10280     @@XMLTest:
10281     @@@QName: xp.element.content.ger.entity.declared.standalone.-4.test
10282     @@@DEnt:
10283     @@@@test:value:
10284     <!DOCTYPE p [
10285     <!ENTITY % para SYSTEM "para">
10286     %para;
10287     ]>
10288     <p>&entity;</p>
10289     @@@test:domTree:
10290     document {
10291     document-type { }
10292     element {
10293     general-entity-reference {
10294 wakaba 1.34 manakai-expanded: false;
10295 wakaba 1.19 }
10296     }
10297     }
10298     @@XMLTest:
10299     @@@QName: xp.element.content.ger.entity.declared.standalone.5.test
10300     @@@DEnt:
10301     @@@@test:value:
10302     <?xml version="1.0" standalone="yes"?>
10303     <!DOCTYPE p SYSTEM "dtd">
10304     <p>&entity;</p>
10305     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 4)..(3, 11); }
10306     @@XMLTest:
10307     @@@QName: xp.element.content.ger.entity.declared.standalone.-5.test
10308     @@@DEnt:
10309     @@@@test:value:
10310     <?xml version="1.0" standalone="no"?>
10311     <!DOCTYPE p SYSTEM "dtd">
10312     <p>&entity;</p>
10313     @@@test:domTree:
10314     document {
10315     document-type { }
10316     element {
10317     general-entity-reference {
10318 wakaba 1.34 manakai-expanded: false;
10319 wakaba 1.19 }
10320     }
10321     }
10322     @@XMLTest:
10323     @@@QName: xp.element.content.ger.entity.declared.standalone.-6.test
10324     @@@DEnt:
10325     @@@@test:value:
10326     <!DOCTYPE p SYSTEM "dtd">
10327     <p>&entity;</p>
10328     @@@test:domTree:
10329     document {
10330     document-type { }
10331     element {
10332     general-entity-reference {
10333 wakaba 1.34 manakai-expanded: false;
10334 wakaba 1.19 }
10335     }
10336     }
10337    
10338 wakaba 1.20 @@XMLTest:
10339     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.1.test
10340     @@@DEnt:
10341     @@@@test:value:
10342     <!DOCTYPE p [
10343     <!ENTITY c "&entity;">
10344     ]>
10345     <p>&c;</p>
10346     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
10347     @@XMLTest:
10348     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.2.test
10349     @@@DEnt:
10350     @@@@test:value:
10351     <!DOCTYPE p [
10352     <!ENTITY other "aa">
10353     <!ENTITY % another "aa">
10354     <!ENTITY c "&entity;">
10355     ]>
10356     <p>&c;</p>
10357     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
10358     @@XMLTest:
10359     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.3.test
10360     @@@DEnt:
10361     @@@@test:value:
10362     <?xml version="1.0" standalone="yes"?>
10363     <!DOCTYPE p [
10364     <!ENTITY c "&entity;">
10365     ]>
10366     <p>&c;</p>
10367     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
10368     @@XMLTest:
10369     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.4.test
10370     @@@DEnt:
10371     @@@@test:value:
10372     <?xml version="1.0" standalone="no"?>
10373     <!DOCTYPE p [
10374     <!ENTITY c "&entity;">
10375     ]>
10376     <p>&c;</p>
10377     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
10378     @@XMLTest:
10379     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.5.test
10380     @@@DEnt:
10381     @@@@test:value:
10382     <?xml version="1.0" standalone="yes"?>
10383     <!DOCTYPE p [
10384     <!ENTITY other "aa">
10385     <!ENTITY % another "aa">
10386     <!ENTITY c "&entity;">
10387     ]>
10388     <p>&c;</p>
10389     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
10390     @@XMLTest:
10391     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.6.test
10392     @@@DEnt:
10393     @@@@test:value:
10394     <?xml version="1.0" standalone="no"?>
10395     <!DOCTYPE p [
10396     <!ENTITY other "aa">
10397     <!ENTITY % another "aa">
10398     <!ENTITY c "&entity;">
10399     ]>
10400     <p>&c;</p>
10401     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
10402     @@XMLTest:
10403     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.-1.test
10404     @@@DEnt:
10405     @@@@test:value:
10406     <!DOCTYPE p [
10407     <!ENTITY entity "value">
10408     <!ENTITY c "&entity;">
10409     ]>
10410     <p>&c;</p>
10411 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
10412 wakaba 1.20 @@@test:domTree:
10413     document {
10414     document-type {
10415     general-entity {
10416     node-name: 'entity';
10417     text-content: 'value';
10418     }
10419     general-entity {
10420     node-name: 'c';
10421     general-entity-reference {
10422     node-name: 'entity';
10423     text-content: 'value';
10424     }
10425     }
10426     }
10427     element {
10428     general-entity-reference {
10429     node-name: 'c';
10430     general-entity-reference {
10431     node-name: 'entity';
10432     text-content: 'value';
10433     }
10434     }
10435     }
10436     }
10437     @@XMLTest:
10438     @@@QName: xp.reptxt.element.content.ger.entity.declared.nopref.-2.test
10439     @@@DEnt:
10440     @@@@test:value:
10441     <!DOCTYPE p [
10442     <!ENTITY entity "value">
10443     <!ENTITY another SYSTEM "another">
10444     <!ENTITY c "&entity;">
10445     ]>
10446     <p>&c;</p>
10447 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
10448 wakaba 1.20 @@@test:domTree:
10449     document {
10450     document-type {
10451     general-entity {
10452     node-name: 'entity';
10453     text-content: 'value';
10454     }
10455     general-entity {
10456     node-name: 'c';
10457     general-entity-reference {
10458     node-name: 'entity';
10459 wakaba 1.34 manakai-expanded: true;
10460 wakaba 1.20 text-content: 'value';
10461     }
10462     }
10463     general-entity {
10464     node-name: 'another';
10465     public-id: null;
10466     system-id: 'another';
10467     has-replacement-tree: false;
10468     }
10469     }
10470     element {
10471     general-entity-reference {
10472     node-name: 'c';
10473 wakaba 1.34 manakai-expanded: true;
10474 wakaba 1.20 general-entity-reference {
10475     node-name: 'entity';
10476 wakaba 1.34 manakai-expanded: true;
10477 wakaba 1.20 text-content: 'value';
10478     }
10479     }
10480     }
10481     }
10482     @@XMLTest:
10483     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.2.test
10484     @@@DEnt:
10485     @@@@test:value:
10486     <?xml version="1.0" standalone="yes"?>
10487     <!DOCTYPE p [
10488     <!ENTITY c "&entity;">
10489     ]>
10490     <p>&c;</p>
10491     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
10492     @@XMLTest:
10493     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.3.test
10494     @@@DEnt:
10495     @@@@test:value:
10496     <?xml version="1.0" standalone="yes"?>
10497     <!DOCTYPE p [
10498     <!ENTITY % para "<!-- -->">
10499     %para;
10500     <!ENTITY c "&entity;">
10501     ]>
10502     <p>&c;</p>
10503     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
10504     @@XMLTest:
10505     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-1.test
10506     @@@DEnt:
10507     @@@@test:value:
10508     <?xml version="1.0" standalone="no"?>
10509     <!DOCTYPE p [
10510     <!ENTITY c "&entity;">
10511     <!ENTITY % para "<!-- -->">
10512     %para;
10513     ]>
10514     <p>&c;</p>
10515 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
10516 wakaba 1.20 @@@test:domTree:
10517     document {
10518     document-type {
10519     general-entity {
10520     node-name: 'c';
10521     general-entity-reference {
10522     node-name: 'entity';
10523 wakaba 1.34 manakai-expanded: false;
10524 wakaba 1.20 }
10525     }
10526     }
10527     element {
10528     general-entity-reference {
10529     node-name: 'c';
10530     general-entity-reference {
10531     node-name: 'entity';
10532 wakaba 1.34 manakai-expanded: false;
10533 wakaba 1.20 }
10534     }
10535     }
10536     }
10537     @@XMLTest:
10538     @@@QName:
10539     xp.reptxt.element.content.ger.entity.declared.standalone.-1.2.test
10540     @@@DEnt:
10541     @@@@test:value:
10542     <?xml version="1.0" standalone="no"?>
10543     <!DOCTYPE p [
10544     <!ENTITY % para "<!-- -->">
10545     %para;
10546     <!ENTITY c "&entity;">
10547     ]>
10548     <p>&c;</p>
10549     @@@test:domTree:
10550     document {
10551     document-type { }
10552     element {
10553     general-entity-reference {
10554     node-name: 'c';
10555 wakaba 1.34 manakai-expanded: false;
10556 wakaba 1.20 }
10557     }
10558     }
10559     @@XMLTest:
10560     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-2.test
10561     @@@DEnt:
10562     @@@@test:value:
10563     <!DOCTYPE p [
10564     <!ENTITY c "&entity;">
10565     <!ENTITY % para "<!-- -->">
10566     %para;
10567     ]>
10568     <p>&c;</p>
10569     @@@test:domTree:
10570     document {
10571     document-type { }
10572     element {
10573     general-entity-reference {
10574     node-name: 'c';
10575 wakaba 1.34 manakai-expanded: true;
10576 wakaba 1.20 general-entity-reference {
10577     node-name: 'entity';
10578 wakaba 1.34 manakai-expanded: false;
10579 wakaba 1.20 }
10580     }
10581     }
10582     }
10583     @@XMLTest:
10584     @@@QName:
10585     xp.reptxt.element.content.ger.entity.declared.standalone.-2.2.test
10586     @@@DEnt:
10587     @@@@test:value:
10588     <!DOCTYPE p [
10589     <!ENTITY % para "<!-- -->">
10590     %para;
10591     <!ENTITY c "&entity;">
10592     ]>
10593     <p>&c;</p>
10594     @@@test:domTree:
10595     document {
10596     document-type { }
10597     element {
10598     general-entity-reference {
10599     node-name: 'c';
10600 wakaba 1.34 manakai-expanded: false;
10601 wakaba 1.20 }
10602     }
10603     }
10604     @@XMLTest:
10605     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.4.test
10606     @@@DEnt:
10607     @@@@test:value:
10608     <?xml version="1.0" standalone="yes"?>
10609     <!DOCTYPE p [
10610     <!ENTITY % para SYSTEM "para">
10611     %para;
10612     <!ENTITY c "&entity;">
10613     ]>
10614     <p>&c;</p>
10615     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
10616     @@XMLTest:
10617     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-3.test
10618     @@@DEnt:
10619     @@@@test:value:
10620     <?xml version="1.0" standalone="no"?>
10621     <!DOCTYPE p [
10622     <!ENTITY c "&entity;">
10623     <!ENTITY % para SYSTEM "para">
10624     %para;
10625     ]>
10626     <p>&c;</p>
10627     @@@test:domTree:
10628     document {
10629     document-type { }
10630     element {
10631     general-entity-reference {
10632     node-name: 'c';
10633 wakaba 1.34 manakai-expanded: true;
10634 wakaba 1.20 general-entity-reference {
10635     node-name: 'entity';
10636 wakaba 1.34 manakai-expanded: false;
10637 wakaba 1.20 }
10638     }
10639     }
10640     }
10641     @@XMLTest:
10642     @@@QName:
10643     xp.reptxt.element.content.ger.entity.declared.standalone.-3.2.test
10644     @@@DEnt:
10645     @@@@test:value:
10646     <?xml version="1.0" standalone="no"?>
10647     <!DOCTYPE p [
10648     <!ENTITY % para SYSTEM "para">
10649     %para;
10650     <!ENTITY c "&entity;">
10651     ]>
10652     <p>&c;</p>
10653     @@@test:domTree:
10654     document {
10655     document-type { }
10656     element {
10657     general-entity-reference {
10658     node-name: 'c';
10659 wakaba 1.34 manakai-expanded: false;
10660 wakaba 1.20 }
10661     }
10662     }
10663     @@XMLTest:
10664     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-4.test
10665     @@@DEnt:
10666     @@@@test:value:
10667     <!DOCTYPE p [
10668     <!ENTITY c "&entity;">
10669     <!ENTITY % para SYSTEM "para">
10670     %para;
10671     ]>
10672     <p>&c;</p>
10673     @@@test:domTree:
10674     document {
10675     document-type { }
10676     element {
10677     general-entity-reference {
10678     node-name: 'c';
10679 wakaba 1.34 manakai-expanded: true;
10680 wakaba 1.20 general-entity-reference {
10681     node-name: 'entity';
10682 wakaba 1.34 manakai-expanded: false;
10683 wakaba 1.20 }
10684     }
10685     }
10686     }
10687     @@XMLTest:
10688     @@@QName:
10689     xp.reptxt.element.content.ger.entity.declared.standalone.-4.2.test
10690     @@@DEnt:
10691     @@@@test:value:
10692     <!DOCTYPE p [
10693     <!ENTITY % para SYSTEM "para">
10694     %para;
10695     <!ENTITY c "&entity;">
10696     ]>
10697     <p>&c;</p>
10698     @@@test:domTree:
10699     document {
10700     document-type { }
10701     element {
10702     general-entity-reference {
10703     node-name: 'c';
10704 wakaba 1.34 manakai-expanded: false;
10705 wakaba 1.20 }
10706     }
10707     }
10708     @@XMLTest:
10709     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.5.test
10710     @@@DEnt:
10711     @@@@test:value:
10712     <?xml version="1.0" standalone="yes"?>
10713     <!DOCTYPE p SYSTEM "dtd" [
10714     <!ENTITY c "&entity;">
10715     ]>
10716     <p>&c;</p>
10717     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
10718     @@XMLTest:
10719     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-5.test
10720     @@@DEnt:
10721     @@@@test:value:
10722     <?xml version="1.0" standalone="no"?>
10723     <!DOCTYPE p SYSTEM "dtd" [
10724     <!ENTITY c "&entity;">
10725     ]>
10726     <p>&c;</p>
10727     @@@test:domTree:
10728     document {
10729     document-type { }
10730     element {
10731     general-entity-reference {
10732     node-name: 'c';
10733 wakaba 1.34 manakai-expanded: true;
10734 wakaba 1.20 general-entity-reference {
10735     node-name: 'entity';
10736 wakaba 1.34 manakai-expanded: false;
10737 wakaba 1.20 }
10738     }
10739     }
10740     }
10741     @@XMLTest:
10742     @@@QName: xp.reptxt.element.content.ger.entity.declared.standalone.-6.test
10743     @@@DEnt:
10744     @@@@test:value:
10745     <!DOCTYPE p SYSTEM "dtd" [<!ENTITY c "&entity;">]>
10746     <p>&c;</p>
10747     @@@test:domTree:
10748     document {
10749     document-type { }
10750     element {
10751     general-entity-reference {
10752     node-name: 'c';
10753 wakaba 1.34 manakai-expanded: true;
10754 wakaba 1.20 general-entity-reference {
10755     node-name: 'entity';
10756 wakaba 1.34 manakai-expanded: false;
10757 wakaba 1.20 }
10758     }
10759     }
10760     }
10761    
10762     @@XMLTest:
10763     @@@QName: xp.attval.ger.entity.declared.nodtd.1.test
10764     @@@DEnt:
10765     @@@@test:value:
10766     <p a="&entity;"/>
10767     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 7)..(1, 14); }
10768     @@XMLTest:
10769     @@@QName: xp.attval.ger.entity.declared.nodtd.2.test
10770     @@@DEnt:
10771     @@@@test:value:
10772     <?xml version="1.0" standalone="yes"?>
10773     <p a="&entity;"/>
10774     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 7)..(2, 14); }
10775     @@XMLTest:
10776     @@@QName: xp.attval.ger.entity.declared.nodtd.3.test
10777     @@@DEnt:
10778     @@@@test:value:
10779     <?xml version="1.0" standalone="no"?>
10780     <p a="&entity;"/>
10781     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 7)..(2, 14); }
10782     @@XMLTest:
10783     @@@QName: xp.attval.ger.entity.declared.nodtd.-1.test
10784     @@@DEnt:
10785     @@@@test:value:
10786     <p a="&lt;&gt;&amp;&quot;&apos;"/>
10787     @@@test:domTree:
10788     document {
10789     element {
10790     attribute {
10791     node-name: 'a';
10792     text-content: '<>&"' U+0027;
10793     }
10794     }
10795     }
10796     @@XMLTest:
10797     @@@QName: xp.attval.ger.entity.declared.nopref.1.test
10798     @@@DEnt:
10799     @@@@test:value:
10800     <!DOCTYPE p []>
10801     <p a="&entity;"/>
10802     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 7)..(2, 14); }
10803     @@XMLTest:
10804     @@@QName: xp.attval.ger.entity.declared.nopref.2.test
10805     @@@DEnt:
10806     @@@@test:value:
10807     <!DOCTYPE p [
10808     <!ENTITY other "aa">
10809     <!ENTITY % another "aa">
10810     ]>
10811     <p a="&entity;"/>
10812     @@@c:erred: <[[xp|wf-entity-declared]]> { (5, 7)..(5, 14); }
10813     @@XMLTest:
10814     @@@QName: xp.attval.ger.entity.declared.nopref.3.test
10815     @@@DEnt:
10816     @@@@test:value:
10817     <?xml version="1.0" standalone="yes"?>
10818     <!DOCTYPE p []>
10819     <p a="&entity;"/>
10820     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 7)..(3, 14); }
10821     @@XMLTest:
10822     @@@QName: xp.attval.ger.entity.declared.nopref.4.test
10823     @@@DEnt:
10824     @@@@test:value:
10825     <?xml version="1.0" standalone="no"?>
10826     <!DOCTYPE p []>
10827     <p a="&entity;"/>
10828     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 7)..(3, 14); }
10829     @@XMLTest:
10830     @@@QName: xp.attval.ger.entity.declared.nopref.5.test
10831     @@@DEnt:
10832     @@@@test:value:
10833     <?xml version="1.0" standalone="yes"?>
10834     <!DOCTYPE p [
10835     <!ENTITY other "aa">
10836     <!ENTITY % another "aa">
10837     ]>
10838     <p a="&entity;"/>
10839     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 7)..(6, 14); }
10840     @@XMLTest:
10841     @@@QName: xp.attval.ger.entity.declared.nopref.6.test
10842     @@@DEnt:
10843     @@@@test:value:
10844     <?xml version="1.0" standalone="no"?>
10845     <!DOCTYPE p [
10846     <!ENTITY other "aa">
10847     <!ENTITY % another "aa">
10848     ]>
10849     <p a="&entity;"/>
10850     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 7)..(6, 14); }
10851     @@XMLTest:
10852     @@@QName: xp.attval.ger.entity.declared.nopref.-1.test
10853     @@@DEnt:
10854     @@@@test:value:
10855     <!DOCTYPE p [
10856     <!ENTITY entity "value">
10857     ]>
10858     <p a="&entity;"/>
10859 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
10860 wakaba 1.20 @@@test:domTree:
10861     document {
10862     document-type {
10863     general-entity {
10864     node-name: 'entity';
10865     text-content: 'value';
10866     }
10867     }
10868     element {
10869     attribute {
10870     node-name: 'a';
10871     general-entity-reference {
10872     node-name: 'entity';
10873 wakaba 1.34 manakai-expanded: true;
10874 wakaba 1.20 text-content: 'value';
10875     }
10876     }
10877     }
10878     }
10879     @@XMLTest:
10880     @@@QName: xp.attval.ger.entity.declared.nopref.-2.test
10881     @@@DEnt:
10882     @@@@test:value:
10883     <!DOCTYPE p [
10884     <!ENTITY entity "value">
10885     <!ENTITY another SYSTEM "another">
10886     ]>
10887     <p a="&entity;"/>
10888 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
10889 wakaba 1.20 @@@test:domTree:
10890     document {
10891     document-type {
10892     general-entity {
10893     node-name: 'entity';
10894     text-content: 'value';
10895     has-replacement-tree: true;
10896     }
10897     general-entity {
10898     node-name: 'another';
10899     public-id: null;
10900     system-id: 'another';
10901     has-replacement-tree: false;
10902     }
10903     }
10904     element {
10905     attribute {
10906     node-name: 'a';
10907     general-entity-reference {
10908     node-name: 'entity';
10909 wakaba 1.34 manakai-expanded: true;
10910 wakaba 1.20 text-content: 'value';
10911     }
10912     }
10913     }
10914     }
10915     @@XMLTest:
10916     @@@QName: xp.attval.ger.entity.declared.standalone.1.test
10917     @@@DEnt:
10918     @@@@test:value:
10919     <?xml version="1.0" standalone="yes"?>
10920     <p a="&entity;"/>
10921     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 7)..(2, 14); }
10922     @@XMLTest:
10923     @@@QName: xp.attval.ger.entity.declared.standalone.2.test
10924     @@@DEnt:
10925     @@@@test:value:
10926     <?xml version="1.0" standalone="yes"?>
10927     <!DOCTYPE p []>
10928     <p a="&entity;"/>
10929     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 7)..(3, 14); }
10930     @@XMLTest:
10931     @@@QName: xp.attval.ger.entity.declared.standalone.3.test
10932     @@@DEnt:
10933     @@@@test:value:
10934     <?xml version="1.0" standalone="yes"?>
10935     <!DOCTYPE p [
10936     <!ENTITY % para "<!-- -->">
10937     %para;
10938     ]>
10939     <p a="&entity;"/>
10940     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 7)..(6, 14); }
10941     @@XMLTest:
10942     @@@QName: xp.attval.ger.entity.declared.standalone.-1.test
10943     @@@DEnt:
10944     @@@@test:value:
10945     <?xml version="1.0" standalone="no"?>
10946     <!DOCTYPE p [
10947     <!ENTITY % para "<!-- -->">
10948     %para;
10949     ]>
10950     <p a="&entity;"/>
10951     @@@test:domTree:
10952     document {
10953     document-type { }
10954     element {
10955     attribute {
10956     node-name: 'a';
10957     general-entity-reference {
10958 wakaba 1.34 manakai-expanded: false;
10959 wakaba 1.20 }
10960     }
10961     }
10962     }
10963     @@XMLTest:
10964     @@@QName: xp.attval.ger.entity.declared.standalone.-2.test
10965     @@@DEnt:
10966     @@@@test:value:
10967     <!DOCTYPE p [
10968     <!ENTITY % para "<!-- -->">
10969     %para;
10970     ]>
10971     <p a="&entity;"/>
10972     @@@test:domTree:
10973     document {
10974     document-type { }
10975     element {
10976     attribute {
10977     node-name: 'a';
10978     general-entity-reference {
10979 wakaba 1.34 manakai-expanded: false;
10980 wakaba 1.20 }
10981     }
10982     }
10983     }
10984     @@XMLTest:
10985     @@@QName: xp.attval.ger.entity.declared.standalone.4.test
10986     @@@DEnt:
10987     @@@@test:value:
10988     <?xml version="1.0" standalone="yes"?>
10989     <!DOCTYPE p [
10990     <!ENTITY % para SYSTEM "para">
10991     %para;
10992     ]>
10993     <p a="&entity;"/>
10994     @@@c:erred: <[[xp|wf-entity-declared]]> { (6, 7)..(6, 14); }
10995     @@XMLTest:
10996     @@@QName: xp.attval.ger.entity.declared.standalone.-3.test
10997     @@@DEnt:
10998     @@@@test:value:
10999     <?xml version="1.0" standalone="no"?>
11000     <!DOCTYPE p [
11001     <!ENTITY % para SYSTEM "para">
11002     %para;
11003     ]>
11004     <p a="&entity;"/>
11005     @@@test:domTree:
11006     document {
11007     document-type { }
11008     element {
11009     attribute {
11010     node-name: 'a';
11011     general-entity-reference {
11012 wakaba 1.34 manakai-expanded: false;
11013 wakaba 1.20 }
11014     }
11015     }
11016     }
11017     @@XMLTest:
11018     @@@QName: xp.attval.ger.entity.declared.standalone.-4.test
11019     @@@DEnt:
11020     @@@@test:value:
11021     <!DOCTYPE p [
11022     <!ENTITY % para SYSTEM "para">
11023     %para;
11024     ]>
11025     <p a="&entity;"/>
11026     @@@test:domTree:
11027     document {
11028     document-type { }
11029     element {
11030     attribute {
11031     node-name: 'a';
11032     general-entity-reference {
11033 wakaba 1.34 manakai-expanded: false;
11034 wakaba 1.20 }
11035     }
11036     }
11037     }
11038     @@XMLTest:
11039     @@@QName: xp.attval.ger.entity.declared.standalone.5.test
11040     @@@DEnt:
11041     @@@@test:value:
11042     <?xml version="1.0" standalone="yes"?>
11043     <!DOCTYPE p SYSTEM "dtd">
11044     <p a="&entity;"/>
11045     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 7)..(3, 14); }
11046     @@XMLTest:
11047     @@@QName: xp.attval.ger.entity.declared.standalone.-5.test
11048     @@@DEnt:
11049     @@@@test:value:
11050     <?xml version="1.0" standalone="no"?>
11051     <!DOCTYPE p SYSTEM "dtd">
11052     <p a="&entity;"/>
11053     @@@test:domTree:
11054     document {
11055     document-type { }
11056     element {
11057     attribute {
11058     node-name: 'a';
11059     general-entity-reference {
11060 wakaba 1.34 manakai-expanded: false;
11061 wakaba 1.20 }
11062     }
11063     }
11064     }
11065     @@XMLTest:
11066     @@@QName: xp.attval.ger.entity.declared.standalone.-6.test
11067     @@@DEnt:
11068     @@@@test:value:
11069     <!DOCTYPE p SYSTEM "dtd">
11070     <p a="&entity;"/>
11071     @@@test:domTree:
11072     document {
11073     document-type { }
11074     element {
11075     attribute {
11076     node-name: 'a';
11077     general-entity-reference {
11078 wakaba 1.34 manakai-expanded: false;
11079 wakaba 1.20 }
11080     }
11081     }
11082     }
11083    
11084 wakaba 1.21 @@XMLTest:
11085 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.nopref.1.test
11086 wakaba 1.21 @@@DEnt:
11087     @@@@test:value:
11088     <!DOCTYPE p [
11089 wakaba 1.22 <!ENTITY c "&entity;">
11090 wakaba 1.21 ]>
11091 wakaba 1.22 <p a="&c;"/>
11092     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11093 wakaba 1.21 @@XMLTest:
11094 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.nopref.2.test
11095 wakaba 1.21 @@@DEnt:
11096     @@@@test:value:
11097     <!DOCTYPE p [
11098     <!ENTITY other "aa">
11099     <!ENTITY % another "aa">
11100 wakaba 1.22 <!ENTITY c "&entity;">
11101 wakaba 1.21 ]>
11102 wakaba 1.22 <p a="&c;"/>
11103     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11104 wakaba 1.21 @@XMLTest:
11105 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.nopref.3.test
11106 wakaba 1.21 @@@DEnt:
11107     @@@@test:value:
11108     <?xml version="1.0" standalone="yes"?>
11109     <!DOCTYPE p [
11110 wakaba 1.22 <!ENTITY c "&entity;">
11111 wakaba 1.21 ]>
11112 wakaba 1.22 <p a="&c;"/>
11113     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11114 wakaba 1.21 @@XMLTest:
11115 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.nopref.4.test
11116 wakaba 1.21 @@@DEnt:
11117     @@@@test:value:
11118     <?xml version="1.0" standalone="no"?>
11119     <!DOCTYPE p [
11120 wakaba 1.22 <!ENTITY c "&entity;">
11121 wakaba 1.21 ]>
11122 wakaba 1.22 <p a="&c;"/>
11123     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11124 wakaba 1.21 @@XMLTest:
11125 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.nopref.5.test
11126 wakaba 1.21 @@@DEnt:
11127     @@@@test:value:
11128     <?xml version="1.0" standalone="yes"?>
11129     <!DOCTYPE p [
11130     <!ENTITY other "aa">
11131     <!ENTITY % another "aa">
11132 wakaba 1.22 <!ENTITY c "&entity;">
11133 wakaba 1.21 ]>
11134 wakaba 1.22 <p a="&c;"/>
11135     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11136 wakaba 1.21 @@XMLTest:
11137 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.nopref.6.test
11138 wakaba 1.21 @@@DEnt:
11139     @@@@test:value:
11140     <?xml version="1.0" standalone="no"?>
11141     <!DOCTYPE p [
11142     <!ENTITY other "aa">
11143     <!ENTITY % another "aa">
11144 wakaba 1.22 <!ENTITY c "&entity;">
11145 wakaba 1.21 ]>
11146 wakaba 1.22 <p a="&c;"/>
11147     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11148 wakaba 1.21 @@XMLTest:
11149 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.nopref.-1.test
11150 wakaba 1.21 @@@DEnt:
11151     @@@@test:value:
11152     <!DOCTYPE p [
11153     <!ENTITY entity "value">
11154 wakaba 1.22 <!ENTITY c "&entity;">
11155 wakaba 1.21 ]>
11156 wakaba 1.22 <p a="&c;"/>
11157 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
11158 wakaba 1.21 @@@test:domTree:
11159     document {
11160     document-type {
11161     general-entity {
11162     node-name: 'entity';
11163     text-content: 'value';
11164     }
11165 wakaba 1.22 general-entity {
11166     node-name: 'c';
11167     general-entity-reference {
11168     node-name: 'entity';
11169     text-content: 'value';
11170 wakaba 1.21 }
11171     }
11172     }
11173     element {
11174     attribute {
11175     node-name: 'a';
11176     general-entity-reference {
11177 wakaba 1.22 node-name: 'c';
11178     general-entity-reference {
11179     node-name: 'entity';
11180     text-content: 'value';
11181     }
11182 wakaba 1.21 }
11183     }
11184     }
11185     }
11186     @@XMLTest:
11187 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.nopref.-2.test
11188 wakaba 1.21 @@@DEnt:
11189     @@@@test:value:
11190     <!DOCTYPE p [
11191     <!ENTITY entity "value">
11192     <!ENTITY another SYSTEM "another">
11193 wakaba 1.22 <!ENTITY c "&entity;">
11194 wakaba 1.21 ]>
11195 wakaba 1.22 <p a="&c;"/>
11196 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
11197 wakaba 1.21 @@@test:domTree:
11198     document {
11199     document-type {
11200     general-entity {
11201     node-name: 'entity';
11202     text-content: 'value';
11203 wakaba 1.22 }
11204     general-entity {
11205     node-name: 'c';
11206     general-entity-reference {
11207     node-name: 'entity';
11208     text-content: 'value';
11209     }
11210 wakaba 1.21 }
11211     general-entity {
11212     node-name: 'another';
11213     public-id: null;
11214     system-id: 'another';
11215     has-replacement-tree: false;
11216     }
11217     }
11218     element {
11219     attribute {
11220     node-name: 'a';
11221     general-entity-reference {
11222 wakaba 1.22 node-name: 'c';
11223     general-entity-reference {
11224     node-name: 'entity';
11225     text-content: 'value';
11226     }
11227 wakaba 1.21 }
11228     }
11229     }
11230     }
11231     @@XMLTest:
11232 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.standalone.2.test
11233 wakaba 1.21 @@@DEnt:
11234     @@@@test:value:
11235     <?xml version="1.0" standalone="yes"?>
11236     <!DOCTYPE p [
11237 wakaba 1.22 <!ENTITY c "&entity;">
11238 wakaba 1.21 ]>
11239 wakaba 1.22 <p a="&c;"/>
11240     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11241 wakaba 1.21 @@XMLTest:
11242 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.standalone.3.test
11243 wakaba 1.21 @@@DEnt:
11244     @@@@test:value:
11245     <?xml version="1.0" standalone="yes"?>
11246     <!DOCTYPE p [
11247     <!ENTITY % para "<!-- -->">
11248     %para;
11249 wakaba 1.22 <!ENTITY c "&entity;">
11250 wakaba 1.21 ]>
11251 wakaba 1.22 <p a="&c;"/>
11252     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11253 wakaba 1.21 @@XMLTest:
11254 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.standalone.-1.test
11255 wakaba 1.21 @@@DEnt:
11256     @@@@test:value:
11257 wakaba 1.22 <?xml version="1.0" standalone="no"?>
11258 wakaba 1.21 <!DOCTYPE p [
11259 wakaba 1.22 <!ENTITY c "&entity;">
11260 wakaba 1.21 <!ENTITY % para "<!-- -->">
11261     %para;
11262     ]>
11263 wakaba 1.22 <p a="&c;"/>
11264 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
11265 wakaba 1.22 @@@test:domTree:
11266     document {
11267     document-type {
11268     general-entity {
11269     node-name: 'c';
11270     general-entity-reference {
11271     node-name: 'entity';
11272 wakaba 1.34 manakai-expanded: false;
11273 wakaba 1.22 }
11274     }
11275     }
11276     element {
11277     attribute {
11278     node-name: 'a';
11279     general-entity-reference {
11280     node-name: 'c';
11281     general-entity-reference {
11282     node-name: 'entity';
11283 wakaba 1.34 manakai-expanded: false;
11284 wakaba 1.22 }
11285     }
11286     }
11287     }
11288     }
11289 wakaba 1.21 @@XMLTest:
11290 wakaba 1.22 @@@QName:
11291     xp.reptxt.attval.ger.entity.declared.standalone.-1.2.test
11292 wakaba 1.21 @@@DEnt:
11293     @@@@test:value:
11294     <?xml version="1.0" standalone="no"?>
11295     <!DOCTYPE p [
11296     <!ENTITY % para "<!-- -->">
11297     %para;
11298 wakaba 1.22 <!ENTITY c "&entity;">
11299 wakaba 1.21 ]>
11300 wakaba 1.22 <p a="&c;"/>
11301     @@@test:domTree:
11302     document {
11303     document-type { }
11304     element {
11305     attribute {
11306     node-name: 'a';
11307     general-entity-reference {
11308     node-name: 'c';
11309 wakaba 1.34 manakai-expanded: false;
11310 wakaba 1.22 }
11311     }
11312     }
11313     }
11314 wakaba 1.21 @@XMLTest:
11315 wakaba 1.22 @@@QName: xp.reptxt.attval.ger.entity.declared.standalone.-2.test
11316 wakaba 1.21 @@@DEnt:
11317     @@@@test:value:
11318     <!DOCTYPE p [
11319 wakaba 1.22 <!ENTITY c "&entity;">
11320     <!ENTITY % para "<!-- -->">
11321     %para;
11322     ]>
11323     <p a="&c;"/>
11324     @@@test:domTree:
11325     document {
11326     document-type { }
11327     element {
11328     attribute {
11329     node-name: 'a';
11330     general-entity-reference {
11331     node-name: 'c';
11332 wakaba 1.34 manakai-expanded: true;
11333 wakaba 1.22 general-entity-reference {
11334     node-name: 'entity';
11335 wakaba 1.34 manakai-expanded: false;
11336 wakaba 1.22 }
11337     }
11338     }
11339     }
11340     }
11341     @@XMLTest:
11342     @@@QName:
11343     xp.reptxt.attval.ger.entity.declared.standalone.-2.2.test
11344     @@@DEnt:
11345     @@@@test:value:
11346     <!DOCTYPE p [
11347     <!ENTITY % para "<!-- -->">
11348     %para;
11349     <!ENTITY c "&entity;">
11350     ]>
11351     <p a="&c;"/>
11352     @@@test:domTree:
11353     document {
11354     document-type { }
11355     element {
11356     attribute {
11357     node-name: 'a';
11358     general-entity-reference {
11359     node-name: 'c';
11360 wakaba 1.34 manakai-expanded: false;
11361 wakaba 1.22 }
11362     }
11363     }
11364     }
11365     @@XMLTest:
11366     @@@QName: xp.reptxt.attval.ger.entity.declared.standalone.4.test
11367     @@@DEnt:
11368     @@@@test:value:
11369     <?xml version="1.0" standalone="yes"?>
11370     <!DOCTYPE p [
11371     <!ENTITY % para SYSTEM "para">
11372     %para;
11373     <!ENTITY c "&entity;">
11374     ]>
11375     <p a="&c;"/>
11376     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11377     @@XMLTest:
11378     @@@QName: xp.reptxt.attval.ger.entity.declared.standalone.-3.test
11379     @@@DEnt:
11380     @@@@test:value:
11381     <?xml version="1.0" standalone="no"?>
11382     <!DOCTYPE p [
11383     <!ENTITY c "&entity;">
11384     <!ENTITY % para SYSTEM "para">
11385     %para;
11386     ]>
11387     <p a="&c;"/>
11388     @@@test:domTree:
11389     document {
11390     document-type { }
11391     element {
11392     attribute {
11393     node-name: 'a';
11394     general-entity-reference {
11395     node-name: 'c';
11396 wakaba 1.34 manakai-expanded: true;
11397 wakaba 1.22 general-entity-reference {
11398     node-name: 'entity';
11399 wakaba 1.34 manakai-expanded: false;
11400 wakaba 1.22 }
11401     }
11402     }
11403     }
11404     }
11405     @@XMLTest:
11406     @@@QName:
11407     xp.reptxt.attval.ger.entity.declared.standalone.-3.2.test
11408     @@@DEnt:
11409     @@@@test:value:
11410     <?xml version="1.0" standalone="no"?>
11411     <!DOCTYPE p [
11412     <!ENTITY % para SYSTEM "para">
11413     %para;
11414     <!ENTITY c "&entity;">
11415     ]>
11416     <p a="&c;"/>
11417     @@@test:domTree:
11418     document {
11419     document-type { }
11420     element {
11421     attribute {
11422     node-name: 'a';
11423     general-entity-reference {
11424     node-name: 'c';
11425 wakaba 1.34 manakai-expanded: false;
11426 wakaba 1.22 }
11427     }
11428     }
11429     }
11430     @@XMLTest:
11431     @@@QName: xp.reptxt.attval.ger.entity.declared.standalone.-4.test
11432     @@@DEnt:
11433     @@@@test:value:
11434     <!DOCTYPE p [
11435     <!ENTITY c "&entity;">
11436     <!ENTITY % para SYSTEM "para">
11437     %para;
11438     ]>
11439     <p a="&c;"/>
11440     @@@test:domTree:
11441     document {
11442     document-type { }
11443     element {
11444     attribute {
11445     node-name: 'a';
11446     general-entity-reference {
11447     node-name: 'c';
11448 wakaba 1.34 manakai-expanded: true;
11449 wakaba 1.22 general-entity-reference {
11450     node-name: 'entity';
11451 wakaba 1.34 manakai-expanded: false;
11452 wakaba 1.22 }
11453     }
11454     }
11455     }
11456     }
11457     @@XMLTest:
11458     @@@QName:
11459     xp.reptxt.attval.ger.entity.declared.standalone.-4.2.test
11460     @@@DEnt:
11461     @@@@test:value:
11462     <!DOCTYPE p [
11463     <!ENTITY % para SYSTEM "para">
11464     %para;
11465     <!ENTITY c "&entity;">
11466     ]>
11467     <p a="&c;"/>
11468     @@@test:domTree:
11469     document {
11470     document-type { }
11471     element {
11472     attribute {
11473     node-name: 'a';
11474     general-entity-reference {
11475     node-name: 'c';
11476 wakaba 1.34 manakai-expanded: false;
11477 wakaba 1.22 }
11478     }
11479     }
11480     }
11481     @@XMLTest:
11482     @@@QName: xp.reptxt.attval.ger.entity.declared.standalone.5.test
11483     @@@DEnt:
11484     @@@@test:value:
11485     <?xml version="1.0" standalone="yes"?>
11486     <!DOCTYPE p SYSTEM "dtd" [
11487     <!ENTITY c "&entity;">
11488     ]>
11489     <p a="&c;"/>
11490     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11491     @@XMLTest:
11492     @@@QName: xp.reptxt.attval.ger.entity.declared.standalone.-5.test
11493     @@@DEnt:
11494     @@@@test:value:
11495     <?xml version="1.0" standalone="no"?>
11496     <!DOCTYPE p SYSTEM "dtd" [
11497     <!ENTITY c "&entity;">
11498     ]>
11499     <p a="&c;"/>
11500     @@@test:domTree:
11501     document {
11502     document-type { }
11503     element {
11504     attribute {
11505     node-name: 'a';
11506     general-entity-reference {
11507     node-name: 'c';
11508 wakaba 1.34 manakai-expanded: true;
11509 wakaba 1.22 general-entity-reference {
11510     node-name: 'entity';
11511 wakaba 1.34 manakai-expanded: false;
11512 wakaba 1.22 }
11513     }
11514     }
11515     }
11516     }
11517     @@XMLTest:
11518     @@@QName: xp.reptxt.attval.ger.entity.declared.standalone.-6.test
11519     @@@DEnt:
11520     @@@@test:value:
11521     <!DOCTYPE p SYSTEM "dtd" [<!ENTITY c "&entity;">]>
11522     <p a="&c;"/>
11523     @@@test:domTree:
11524     document {
11525     document-type { }
11526     element {
11527     attribute {
11528     node-name: 'a';
11529     general-entity-reference {
11530     node-name: 'c';
11531 wakaba 1.34 manakai-expanded: true;
11532 wakaba 1.22 general-entity-reference {
11533     node-name: 'entity';
11534 wakaba 1.34 manakai-expanded: false;
11535 wakaba 1.22 }
11536     }
11537     }
11538     }
11539     }
11540    
11541     @@XMLTest:
11542     @@@QName: xp.attlist.dup.entity.declared.1.test
11543     @@@DEnt:
11544     @@@@test:value:
11545     <!DOCTYPE p [
11546     <!ATTLIST p a CDATA "no-entity">
11547     <!ATTLIST p a CDATA "&entity;">
11548     ]>
11549     <p/>
11550     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 21)..(3, 29); }
11551     @@XMLTest:
11552     @@@QName: xp.attlist.dup.entity.declared.2.test
11553     @@@DEnt:
11554     @@@@test:value:
11555     <!DOCTYPE p [
11556     <!ATTLIST p a CDATA "no-entity"
11557     a CDATA "&entity;">
11558     ]>
11559     <p/>
11560     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 21)..(3, 29); }
11561     @@XMLTest:
11562     @@@QName: xp.attlist.unused.entity.declared.1.test
11563     @@@DEnt:
11564     @@@@test:value:
11565     <!DOCTYPE p [
11566     <!ATTLIST q a CDATA "&entity;">
11567     ]>
11568     <p/>
11569     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 21)..(2, 29); }
11570     @@XMLTest:
11571     @@@QName: xp.attlist.unused.entity.declared.2.test
11572     @@@DEnt:
11573     @@@@test:value:
11574     <!DOCTYPE p [
11575     <!ATTLIST p a CDATA "&entity;">
11576     ]>
11577     <p a="bb"/>
11578     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 21)..(2, 29); }
11579    
11580     @@XMLTest:
11581     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.nopref.1.test
11582     @@@DEnt:
11583     @@@@test:value:
11584     <!DOCTYPE p [
11585     <!ENTITY c "&entity;">
11586     <!ATTLIST p a CDATA "&c;">
11587     ]>
11588     <p/>
11589     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11590     @@XMLTest:
11591     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.nopref.2.test
11592     @@@DEnt:
11593     @@@@test:value:
11594     <!DOCTYPE p [
11595     <!ENTITY other "aa">
11596     <!ENTITY % another "aa">
11597     <!ENTITY c "&entity;">
11598     <!ATTLIST p a CDATA "&c;">
11599     ]>
11600     <p/>
11601     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11602     @@XMLTest:
11603     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.nopref.3.test
11604     @@@DEnt:
11605     @@@@test:value:
11606     <?xml version="1.0" standalone="yes"?>
11607     <!DOCTYPE p [
11608     <!ENTITY c "&entity;">
11609     <!ATTLIST p a CDATA "&c;">
11610     ]>
11611     <p/>
11612     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11613     @@XMLTest:
11614     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.nopref.4.test
11615     @@@DEnt:
11616     @@@@test:value:
11617     <?xml version="1.0" standalone="no"?>
11618     <!DOCTYPE p [
11619     <!ENTITY c "&entity;">
11620     <!ATTLIST p a CDATA "&c;">
11621     ]>
11622     <p/>
11623     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11624     @@XMLTest:
11625     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.nopref.5.test
11626     @@@DEnt:
11627     @@@@test:value:
11628     <?xml version="1.0" standalone="yes"?>
11629     <!DOCTYPE p [
11630     <!ENTITY other "aa">
11631     <!ENTITY % another "aa">
11632     <!ENTITY c "&entity;">
11633     <!ATTLIST p a CDATA "&c;">
11634     ]>
11635     <p/>
11636     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11637     @@XMLTest:
11638     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.nopref.6.test
11639     @@@DEnt:
11640     @@@@test:value:
11641     <?xml version="1.0" standalone="no"?>
11642     <!DOCTYPE p [
11643     <!ENTITY other "aa">
11644     <!ENTITY % another "aa">
11645     <!ENTITY c "&entity;">
11646     <!ATTLIST p a CDATA "&c;">
11647     ]>
11648     <p/>
11649     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11650     @@XMLTest:
11651     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.nopref.-1.test
11652     @@@DEnt:
11653     @@@@test:value:
11654     <!DOCTYPE p [
11655     <!ENTITY entity "value">
11656     <!ENTITY c "&entity;">
11657     <!ATTLIST p a CDATA "&c;">
11658     ]>
11659     <p/>
11660 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
11661 wakaba 1.22 @@@test:domTree:
11662     document {
11663     document-type {
11664     general-entity {
11665     node-name: 'entity';
11666     text-content: 'value';
11667     }
11668     general-entity {
11669     node-name: 'c';
11670     general-entity-reference {
11671     node-name: 'entity';
11672 wakaba 1.34 manakai-expanded: true;
11673 wakaba 1.22 text-content: 'value';
11674     }
11675     }
11676     element-type-definition {
11677     node-name: 'p';
11678     attribute-definition {
11679     node-name: 'a';
11680     general-entity-reference {
11681     node-name: 'c';
11682 wakaba 1.34 manakai-expanded: true;
11683 wakaba 1.22 general-entity-reference {
11684     node-name: 'entity';
11685 wakaba 1.34 manakai-expanded: true;
11686 wakaba 1.22 text-content: 'value';
11687     }
11688     }
11689     }
11690     }
11691     }
11692     element {
11693     attribute {
11694     node-name: 'a';
11695     specified: false;
11696     general-entity-reference {
11697     node-name: 'c';
11698     general-entity-reference {
11699     node-name: 'entity';
11700     text-content: 'value';
11701     }
11702     }
11703     }
11704     }
11705     }
11706     @@XMLTest:
11707     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.nopref.-2.test
11708     @@@DEnt:
11709     @@@@test:value:
11710     <!DOCTYPE p [
11711     <!ENTITY entity "value">
11712     <!ENTITY another SYSTEM "another">
11713     <!ENTITY c "&entity;">
11714     <!ATTLIST p a CDATA "&c;">
11715     ]>
11716     <p/>
11717 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
11718 wakaba 1.22 @@@test:domTree:
11719     document {
11720     document-type {
11721     general-entity {
11722     node-name: 'entity';
11723     text-content: 'value';
11724     }
11725     general-entity {
11726     node-name: 'c';
11727     general-entity-reference {
11728     node-name: 'entity';
11729     text-content: 'value';
11730     }
11731     }
11732     general-entity {
11733     node-name: 'another';
11734     public-id: null;
11735     system-id: 'another';
11736     has-replacement-tree: false;
11737     }
11738     element-type-definition {
11739     node-name: 'p';
11740     attribute-definition {
11741     node-name: 'a';
11742     general-entity-reference {
11743     node-name: 'c';
11744 wakaba 1.34 manakai-expanded: true;
11745 wakaba 1.22 general-entity-reference {
11746     node-name: 'entity';
11747 wakaba 1.34 manakai-expanded: true;
11748 wakaba 1.22 text-content: 'value';
11749     }
11750     }
11751     }
11752     }
11753     }
11754     element {
11755     attribute {
11756     node-name: 'a';
11757     specified: false;
11758     general-entity-reference {
11759     node-name: 'c';
11760     general-entity-reference {
11761     node-name: 'entity';
11762     text-content: 'value';
11763     }
11764     }
11765     }
11766     }
11767     }
11768     @@XMLTest:
11769     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.standalone.2.test
11770     @@@DEnt:
11771     @@@@test:value:
11772     <?xml version="1.0" standalone="yes"?>
11773     <!DOCTYPE p [
11774     <!ENTITY c "&entity;">
11775     <!ATTLIST p a CDATA "&c;">
11776     ]>
11777     <p/>
11778     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11779     @@XMLTest:
11780     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.standalone.3.test
11781     @@@DEnt:
11782     @@@@test:value:
11783     <?xml version="1.0" standalone="yes"?>
11784     <!DOCTYPE p [
11785     <!ENTITY % para "<!-- -->">
11786     %para;
11787     <!ENTITY c "&entity;">
11788     <!ATTLIST p a CDATA "&c;">
11789     ]>
11790     <p/>
11791     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11792     @@XMLTest:
11793     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.standalone.-1.test
11794     @@@DEnt:
11795     @@@@test:value:
11796     <?xml version="1.0" standalone="no"?>
11797     <!DOCTYPE p [
11798     <!ENTITY c "&entity;">
11799     <!ATTLIST p a CDATA "&c;">
11800     <!ENTITY % para "<!-- -->">
11801     %para;
11802     ]>
11803     <p/>
11804     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11805     @@XMLTest:
11806     @@@QName:
11807     xp.reptxt.attlist.attval.ger.entity.declared.standalone.-1.2.test
11808     @@@DEnt:
11809     @@@@test:value:
11810     <?xml version="1.0" standalone="no"?>
11811     <!DOCTYPE p [
11812     <!ENTITY % para "<!-- -->">
11813     %para;
11814     <!ENTITY c "&entity;">
11815     <!ATTLIST p a CDATA "&c;">
11816     ]>
11817     <p g="h"/>
11818     @@@test:domTree:
11819     document {
11820     document-type { }
11821     element {
11822     attribute {
11823     node-name: 'g';
11824     text-content: 'h';
11825     }
11826     }
11827     }
11828     @@XMLTest:
11829     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.standalone.-2.test
11830     @@@DEnt:
11831     @@@@test:value:
11832     <!DOCTYPE p [
11833     <!ENTITY c "&entity;">
11834     <!ATTLIST p a CDATA "&c;">
11835     <!ENTITY % para "<!-- -->">
11836     %para;
11837     ]>
11838     <p/>
11839     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11840     @@XMLTest:
11841     @@@QName:
11842     xp.reptxt.attlist.attval.ger.entity.declared.standalone.-2.2.test
11843     @@@DEnt:
11844     @@@@test:value:
11845     <!DOCTYPE p [
11846     <!ENTITY % para "<!-- -->">
11847     %para;
11848     <!ENTITY c "&entity;">
11849     <!ATTLIST p a CDATA "&c;">
11850     ]>
11851     <p g="h"/>
11852     @@@test:domTree:
11853     document {
11854     document-type { }
11855     element {
11856     attribute {
11857     node-name: 'g';
11858     text-content: 'h';
11859     }
11860     }
11861     }
11862     @@XMLTest:
11863     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.standalone.4.test
11864     @@@DEnt:
11865     @@@@test:value:
11866     <?xml version="1.0" standalone="yes"?>
11867     <!DOCTYPE p [
11868     <!ENTITY % para SYSTEM "para">
11869     %para;
11870     <!ENTITY c "&entity;">
11871     <!ATTLIST p a CDATA "&c;">
11872     ]>
11873     <p/>
11874     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11875     @@XMLTest:
11876     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.standalone.-3.test
11877     @@@DEnt:
11878     @@@@test:value:
11879     <?xml version="1.0" standalone="no"?>
11880     <!DOCTYPE p [
11881     <!ENTITY c "&entity;">
11882     <!ATTLIST p a CDATA "&c;">
11883     <!ENTITY % para SYSTEM "para">
11884     %para;
11885     ]>
11886     <p/>
11887     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11888     @@XMLTest:
11889     @@@QName:
11890     xp.reptxt.attlist.attval.ger.entity.declared.standalone.-3.2.test
11891     @@@DEnt:
11892     @@@@test:value:
11893     <?xml version="1.0" standalone="no"?>
11894     <!DOCTYPE p [
11895     <!ENTITY % para SYSTEM "para">
11896     %para;
11897     <!ENTITY c "&entity;">
11898     <!ATTLIST p a CDATA "&c;">
11899     ]>
11900     <p g="h"/>
11901     @@@test:domTree:
11902     document {
11903     document-type { }
11904     element {
11905     attribute {
11906     node-name: 'g';
11907     text-content: 'h';
11908     }
11909     }
11910     }
11911     @@XMLTest:
11912     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.standalone.-4.test
11913     @@@DEnt:
11914     @@@@test:value:
11915     <!DOCTYPE p [
11916     <!ENTITY c "&entity;">
11917     <!ATTLIST p a CDATA "&c;">
11918     <!ENTITY % para SYSTEM "para">
11919     %para;
11920     ]>
11921     <p/>
11922     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11923     @@XMLTest:
11924     @@@QName:
11925     xp.reptxt.attlist.attval.ger.entity.declared.standalone.-4.2.test
11926     @@@DEnt:
11927     @@@@test:value:
11928     <!DOCTYPE p [
11929     <!ENTITY % para SYSTEM "para">
11930     %para;
11931     <!ENTITY c "&entity;">
11932     <!ATTLIST p a CDATA "&c;">
11933     ]>
11934     <p g="h"/>
11935     @@@test:domTree:
11936     document {
11937     document-type { }
11938     element {
11939     attribute {
11940     node-name: 'g';
11941     text-content: 'h';
11942     }
11943     }
11944     }
11945     @@XMLTest:
11946     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.standalone.5.test
11947     @@@DEnt:
11948     @@@@test:value:
11949     <?xml version="1.0" standalone="yes"?>
11950     <!DOCTYPE p SYSTEM "dtd" [
11951     <!ENTITY c "&entity;">
11952     <!ATTLIST p a CDATA "&c;">
11953     ]>
11954     <p/>
11955     @@@c:erred: <[[xp|wf-entity-declared]]> { (1, 1)..(1, 8); }
11956     @@XMLTest:
11957     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.standalone.-5.test
11958     @@@DEnt:
11959     @@@@test:value:
11960     <?xml version="1.0" standalone="no"?>
11961     <!DOCTYPE p SYSTEM "dtd" [
11962     <!ENTITY c "&entity;">
11963     <!ATTLIST p a CDATA "&c;">
11964     ]>
11965     <p/>
11966     @@@test:domTree:
11967     document {
11968     document-type { }
11969     element {
11970     attribute {
11971     node-name: 'a';
11972     specified: false;
11973     general-entity-reference {
11974     node-name: 'c';
11975 wakaba 1.34 manakai-expanded: true;
11976 wakaba 1.22 general-entity-reference {
11977     node-name: 'entity';
11978 wakaba 1.34 manakai-expanded: false;
11979 wakaba 1.22 }
11980     }
11981     }
11982     }
11983     }
11984     @@XMLTest:
11985     @@@QName: xp.reptxt.attlist.attval.ger.entity.declared.standalone.-6.test
11986     @@@DEnt:
11987     @@@@test:value:
11988     <!DOCTYPE p SYSTEM "dtd" [<!ENTITY c "&entity;">
11989     <!ATTLIST p a CDATA "&c;">
11990     ]>
11991     <p/>
11992     @@@test:domTree:
11993     document {
11994     document-type { }
11995     element {
11996     attribute {
11997     node-name: 'a';
11998     specified: false;
11999     general-entity-reference {
12000     node-name: 'c';
12001 wakaba 1.34 manakai-expanded: true;
12002 wakaba 1.22 general-entity-reference {
12003     node-name: 'entity';
12004 wakaba 1.34 manakai-expanded: false;
12005 wakaba 1.22 }
12006     }
12007     }
12008     }
12009     }
12010    
12011     @@XMLTest:
12012     @@@QName: xp.attlist.attval.ger.entity.declared.nopref.1.test
12013     @@@DEnt:
12014     @@@@test:value:
12015     <!DOCTYPE p [
12016     <!ATTLIST p a CDATA "&entity;">
12017     ]>
12018     <p/>
12019     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 22)..(2, 29); }
12020     @@XMLTest:
12021     @@@QName: xp.attlist.attval.ger.entity.declared.nopref.2.test
12022     @@@DEnt:
12023     @@@@test:value:
12024     <!DOCTYPE p [
12025     <!ENTITY other "aa">
12026     <!ENTITY % another "aa">
12027     <!ATTLIST p a CDATA "&entity;">
12028     ]>
12029     <p/>
12030     @@@c:erred: <[[xp|wf-entity-declared]]> { (4, 22)..(4, 29); }
12031     @@XMLTest:
12032     @@@QName: xp.attlist.attval.ger.entity.declared.nopref.3.test
12033     @@@DEnt:
12034     @@@@test:value:
12035     <?xml version="1.0" standalone="yes"?>
12036     <!DOCTYPE p [
12037     <!ATTLIST p a CDATA "&entity;">
12038     ]>
12039     <p/>
12040     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 22)..(3, 29); }
12041     @@XMLTest:
12042     @@@QName: xp.attlist.attval.ger.entity.declared.nopref.4.test
12043     @@@DEnt:
12044     @@@@test:value:
12045     <?xml version="1.0" standalone="no"?>
12046     <!DOCTYPE p [
12047     <!ATTLIST p a CDATA "&entity;">
12048     ]>
12049     <p/>
12050     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 22)..(3, 29); }
12051     @@XMLTest:
12052     @@@QName: xp.attlist.attval.ger.entity.declared.nopref.5.test
12053     @@@DEnt:
12054     @@@@test:value:
12055     <?xml version="1.0" standalone="yes"?>
12056     <!DOCTYPE p [
12057     <!ENTITY other "aa">
12058     <!ENTITY % another "aa">
12059     <!ATTLIST p a CDATA "&entity;">
12060     ]>
12061     <p/>
12062     @@@c:erred: <[[xp|wf-entity-declared]]> { (5, 22)..(5, 29); }
12063     @@XMLTest:
12064     @@@QName: xp.attlist.attval.ger.entity.declared.nopref.6.test
12065     @@@DEnt:
12066     @@@@test:value:
12067     <?xml version="1.0" standalone="no"?>
12068     <!DOCTYPE p [
12069     <!ENTITY other "aa">
12070     <!ENTITY % another "aa">
12071     <!ATTLIST p a CDATA "&entity;">
12072     ]>
12073     <p/>
12074     @@@c:erred: <[[xp|wf-entity-declared]]> { (5, 22)..(5, 29); }
12075     @@XMLTest:
12076     @@@QName: xp.attlist.attval.ger.entity.declared.nopref.-1.test
12077     @@@DEnt:
12078     @@@@test:value:
12079     <!DOCTYPE p [
12080     <!ENTITY entity "value">
12081     <!ATTLIST p a CDATA "&entity;">
12082     ]>
12083     <p/>
12084 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
12085 wakaba 1.22 @@@test:domTree:
12086     document {
12087     document-type {
12088     general-entity {
12089     node-name: 'entity';
12090     text-content: 'value';
12091     }
12092     element-type-definition {
12093     node-name: 'p';
12094     attribute-definition {
12095     node-name: 'a';
12096     general-entity-reference {
12097     node-name: 'entity';
12098 wakaba 1.34 manakai-expanded: true;
12099 wakaba 1.22 text-content: 'value';
12100     }
12101     }
12102     }
12103     }
12104     element {
12105     attribute {
12106     node-name: 'a';
12107     specified: false;
12108     general-entity-reference {
12109     node-name: 'entity';
12110 wakaba 1.34 manakai-expanded: true;
12111 wakaba 1.22 text-content: 'value';
12112     }
12113     }
12114     }
12115     }
12116     @@XMLTest:
12117     @@@QName: xp.attlist.attval.ger.entity.declared.nopref.-1.2.test
12118     @@@DEnt:
12119     @@@@test:value:
12120     <!DOCTYPE p [
12121     <!ATTLIST p a CDATA "&entity;">
12122     <!ENTITY entity "value">
12123     ]>
12124     <p/>
12125     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 22)..(2, 29); }
12126     @@XMLTest:
12127     @@@QName: xp.attlist.attval.ger.entity.declared.nopref.-2.test
12128     @@@DEnt:
12129     @@@@test:value:
12130     <!DOCTYPE p [
12131     <!ENTITY entity "value">
12132     <!ENTITY another SYSTEM "another">
12133     <!ATTLIST p a CDATA "&entity;">
12134     ]>
12135     <p/>
12136 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
12137 wakaba 1.22 @@@test:domTree:
12138     document {
12139     document-type {
12140     element-type-definition {
12141     node-name: 'p';
12142     attribute-definition {
12143     node-name: 'a';
12144     general-entity-reference {
12145     node-name: 'entity';
12146 wakaba 1.34 manakai-expanded: true;
12147 wakaba 1.22 text-content: 'value';
12148     }
12149     }
12150     }
12151     general-entity {
12152     node-name: 'entity';
12153     text-content: 'value';
12154     has-replacement-tree: true;
12155     }
12156     general-entity {
12157     node-name: 'another';
12158     public-id: null;
12159     system-id: 'another';
12160     has-replacement-tree: false;
12161     }
12162     }
12163     element {
12164     attribute {
12165     node-name: 'a';
12166     specified: false;
12167     general-entity-reference {
12168     node-name: 'entity';
12169 wakaba 1.34 manakai-expanded: true;
12170 wakaba 1.22 text-content: 'value';
12171     }
12172     }
12173     }
12174     }
12175     @@XMLTest:
12176     @@@QName: xp.attlist.attval.ger.entity.declared.nopref.-2.2.test
12177     @@@DEnt:
12178     @@@@test:value:
12179     <!DOCTYPE p [
12180     <!ATTLIST p a CDATA "&entity;">
12181     <!ENTITY entity "value">
12182     <!ENTITY another SYSTEM "another">
12183     ]>
12184     <p/>
12185     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 22)..(2, 29); }
12186     @@XMLTest:
12187     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.2.test
12188     @@@DEnt:
12189     @@@@test:value:
12190     <?xml version="1.0" standalone="yes"?>
12191     <!DOCTYPE p [
12192     <!ATTLIST p a CDATA "&entity;">
12193     ]>
12194     <p/>
12195     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 22)..(3, 29); }
12196     @@XMLTest:
12197     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.3.test
12198     @@@DEnt:
12199     @@@@test:value:
12200     <?xml version="1.0" standalone="yes"?>
12201     <!DOCTYPE p [
12202     <!ATTLIST p a CDATA "&entity;">
12203     <!ENTITY % para "<!-- -->">
12204     %para;
12205     ]>
12206     <p/>
12207     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 22)..(3, 29); }
12208     @@XMLTest:
12209     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.3.2.test
12210     @@@DEnt:
12211     @@@@test:value:
12212     <?xml version="1.0" standalone="yes"?>
12213     <!DOCTYPE p [
12214     <!ENTITY % para "<!-- -->">
12215     %para;
12216     <!ATTLIST p a CDATA "&entity;">
12217     ]>
12218     <p/>
12219     @@@c:erred: <[[xp|wf-entity-declared]]> { (5, 22)..(5, 29); }
12220     @@@enImplNote:
12221     The <XML::ATTLIST> declaration is processed since
12222     it is a <XA::standalone> document.
12223     @@XMLTest:
12224     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.-1.test
12225     @@@DEnt:
12226     @@@@test:value:
12227     <?xml version="1.0" standalone="no"?>
12228     <!DOCTYPE p [
12229     <!ATTLIST p a CDATA "&entity;">
12230     <!ENTITY % para "<!-- -->">
12231     %para;
12232     ]>
12233     <p/>
12234     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 22)..(3, 29); }
12235     @@XMLTest:
12236     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.-1.2.test
12237     @@@DEnt:
12238     @@@@test:value:
12239     <?xml version="1.0" standalone="no"?>
12240     <!DOCTYPE p [
12241 wakaba 1.25 <!ATTLIST p b CDATA #IMPLIED>
12242 wakaba 1.21 <!ENTITY % para "<!-- -->">
12243     %para;
12244     <!ATTLIST p a CDATA "&entity;">
12245     ]>
12246     <p c="d"/>
12247 wakaba 1.25 @@@c:erred:
12248     <[[xp|warning-attribute-definition-not-processed]]> { (6, 13)..(6, 30); }
12249 wakaba 1.21 @@@test:domTree:
12250     document {
12251     document-type {
12252     element-type-definition {
12253 wakaba 1.25 node-name: 'p';
12254 wakaba 1.21 attribute-definition {
12255     node-name: 'b';
12256     }
12257     }
12258     }
12259     element {
12260     attribute {
12261     node-name: 'c';
12262     text-content: 'd';
12263     }
12264     }
12265     }
12266     @@@enImplNote:
12267     The second <XML::ATTLIST> declaration is read but not processed
12268     and its <XML::&entity;> general entity reference violates
12269     entity declared validty constraint rather than well-formedness
12270     constraint.
12271     @@XMLTest:
12272     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.-2.test
12273     @@@DEnt:
12274     @@@@test:value:
12275     <!DOCTYPE p [
12276     <!ATTLIST p a CDATA "&entity;">
12277     <!ENTITY % para "<!-- -->">
12278     %para;
12279     ]>
12280     <p/>
12281     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 22)..(2, 29); }
12282     @@XMLTest:
12283     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.-2.2.test
12284     @@@DEnt:
12285     @@@@test:value:
12286     <!DOCTYPE p [
12287 wakaba 1.25 <!ATTLIST p b CDATA #IMPLIED>
12288 wakaba 1.21 <!ENTITY % para "<!-- -->">
12289     %para;
12290     <!ATTLIST p a CDATA "&entity;">
12291     ]>
12292     <p c="d"/>
12293 wakaba 1.25 @@@c:erred:
12294     <[[xp|warning-attribute-definition-not-processed]]> { (5, 13)..(5, 30); }
12295 wakaba 1.21 @@@test:domTree:
12296     document {
12297     document-type {
12298     element-type-definition {
12299 wakaba 1.25 node-name: 'p';
12300 wakaba 1.21 attribute-definition {
12301     node-name: 'b';
12302     }
12303     }
12304     }
12305     element {
12306     attribute {
12307     node-name: 'c';
12308     text-content: 'd';
12309     }
12310     }
12311     }
12312     @@XMLTest:
12313     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.4.test
12314     @@@DEnt:
12315     @@@@test:value:
12316     <?xml version="1.0" standalone="yes"?>
12317     <!DOCTYPE p [
12318     <!ATTLIST p a CDATA "&entity;">
12319     <!ENTITY % para SYSTEM "p">
12320     %para;
12321     ]>
12322     <p/>
12323     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 22)..(3, 29); }
12324     @@XMLTest:
12325     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.4.2.test
12326     @@@DEnt:
12327     @@@@test:value:
12328     <?xml version="1.0" standalone="yes"?>
12329     <!DOCTYPE p [
12330     <!ENTITY % para SYSTEM "p">
12331     %para;
12332     <!ATTLIST p a CDATA "&entity;">
12333     ]>
12334     <p/>
12335     @@@c:erred: <[[xp|wf-entity-declared]]> { (5, 22)..(5, 29); }
12336     @@@enImplNote:
12337     The <XML::ATTLIST> declaration is processed since
12338     it is a <XA::standalone> document.
12339     @@XMLTest:
12340     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.-3.test
12341     @@@DEnt:
12342     @@@@test:value:
12343     <?xml version="1.0" standalone="no"?>
12344     <!DOCTYPE p [
12345     <!ATTLIST p a CDATA "&entity;">
12346     <!ENTITY % para SYSTEM "p">
12347     %para;
12348     ]>
12349     <p/>
12350     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 22)..(3, 29); }
12351     @@@enImplNote:
12352     Is this well-formed? It has a parameter entity reference,
12353     therefore, it does not violates Entity Declared WFC, isn't it?
12354    
12355     Note that Firefox 1.5 and Opera 9 TP1 reports that this document has a
12356     fatal error (also note that they does not support unexpanded).
12357    
12358     See also:
12359     <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>
12360     @@XMLTest:
12361     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.-3.2.test
12362     @@@DEnt:
12363     @@@@test:value:
12364     <?xml version="1.0" standalone="no"?>
12365     <!DOCTYPE p [
12366 wakaba 1.25 <!ATTLIST p b CDATA #IMPLIED>
12367 wakaba 1.21 <!ENTITY % para SYSTEM "p">
12368     %para;
12369     <!ATTLIST p a CDATA "&entity;">
12370     ]>
12371     <p c="d"/>
12372 wakaba 1.25 @@@c:erred:
12373     <[[xp|warning-attribute-definition-not-processed]]> { (6, 13)..(6, 30); }
12374 wakaba 1.21 @@@test:domTree:
12375     document {
12376     document-type {
12377     element-type-definition {
12378 wakaba 1.25 node-name: 'p';
12379 wakaba 1.21 attribute-definition {
12380     node-name: 'b';
12381     }
12382     }
12383     }
12384     element {
12385     attribute {
12386     node-name: 'c';
12387     text-content: 'd';
12388     }
12389     }
12390     }
12391     @@@enImplNote:
12392     The second <XML::ATTLIST> declaration is read but not processed
12393     and its <XML::&entity;> general entity reference violates
12394     entity declared validty constraint rather than well-formedness
12395     constraint.
12396     @@XMLTest:
12397     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.-4.test
12398     @@@DEnt:
12399     @@@@test:value:
12400     <!DOCTYPE p [
12401     <!ATTLIST p a CDATA "&entity;">
12402     <!ENTITY % para SYSTEM "p">
12403     %para;
12404     ]>
12405     <p/>
12406     @@@c:erred: <[[xp|wf-entity-declared]]> { (2, 22)..(2, 29); }
12407     @@XMLTest:
12408     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.-4.2.test
12409     @@@DEnt:
12410     @@@@test:value:
12411     <!DOCTYPE p [
12412 wakaba 1.25 <!ATTLIST p b CDATA #IMPLIED>
12413 wakaba 1.21 <!ENTITY % para SYSTEM "p">
12414     %para;
12415     <!ATTLIST p a CDATA "&entity;">
12416     ]>
12417     <p c="d"/>
12418 wakaba 1.25 @@@c:erred:
12419     <[[xp|warning-attribute-definition-not-processed]]> { (5, 13)..(5, 30); }
12420 wakaba 1.21 @@@test:domTree:
12421     document {
12422     document-type {
12423     element-type-definition {
12424 wakaba 1.25 node-name: 'p';
12425 wakaba 1.21 attribute-definition {
12426     node-name: 'b';
12427     }
12428     }
12429     }
12430     element {
12431     attribute {
12432     node-name: 'c';
12433     text-content: 'd';
12434     }
12435     }
12436     }
12437     @@XMLTest:
12438     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.5.test
12439     @@@DEnt:
12440     @@@@test:value:
12441     <?xml version="1.0" standalone="yes"?>
12442     <!DOCTYPE p SYSTEM "dtd" [
12443     <!ATTLIST p a CDATA "&entity;">
12444     ]>
12445     <p/>
12446     @@@c:erred: <[[xp|wf-entity-declared]]> { (3, 22)..(3, 29); }
12447     @@@enImplNote:
12448     This document has an error - result is implementation dependent.
12449     @@XMLTest:
12450     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.-5.test
12451     @@@DEnt:
12452     @@@@test:value:
12453     <?xml version="1.0" standalone="no"?>
12454     <!DOCTYPE p SYSTEM "dtd" [
12455     <!ATTLIST p a CDATA "&entity;">
12456     ]>
12457     <p/>
12458     @@@test:domTree:
12459     document {
12460     document-type {
12461     element-type-definition {
12462     node-name: 'p';
12463     attribute-definition {
12464     node-name: 'a';
12465     general-entity-reference {
12466     node-name: 'entity';
12467 wakaba 1.34 manakai-expanded: false;
12468 wakaba 1.21 }
12469     }
12470     }
12471     }
12472     element {
12473     attribute {
12474     node-name: 'a';
12475     specified: false;
12476     general-entity-reference {
12477     node-name: 'entity';
12478 wakaba 1.34 manakai-expanded: false;
12479 wakaba 1.21 }
12480     }
12481     }
12482     }
12483     @@@enImplNote:
12484     This document has an error - result is implementation dependent.
12485     @@XMLTest:
12486     @@@QName: xp.attlist.attval.ger.entity.declared.standalone.-6.test
12487     @@@DEnt:
12488     @@@@test:value:
12489     <!DOCTYPE p SYSTEM "dtd" [
12490     <!ATTLIST p a CDATA "&entity;">
12491     ]>
12492     <p/>
12493     @@@test:domTree:
12494     document {
12495     document-type {
12496     element-type-definition {
12497     node-name: 'p';
12498     attribute-definition {
12499     node-name: 'a';
12500     general-entity-reference {
12501     node-name: 'entity';
12502 wakaba 1.34 manakai-expanded: false;
12503 wakaba 1.21 }
12504     }
12505     }
12506     }
12507     element {
12508     attribute {
12509     node-name: 'a';
12510     specified: false;
12511     general-entity-reference {
12512     node-name: 'entity';
12513 wakaba 1.34 manakai-expanded: false;
12514 wakaba 1.21 }
12515     }
12516     }
12517     }
12518     @@@enImplNote:
12519     This document has an error - result is implementation dependent.
12520    
12521 wakaba 1.19 @@enImplNote:
12522     {TODO:: Entity declared WFC for
12523 wakaba 1.20
12524     - General entity references in entity value??
12525 wakaba 1.19
12526     }
12527    
12528 wakaba 1.23 @@XMLTest:
12529     @@@QName: xp.element.content.parsed.entity.reference.test
12530     @@@DEnt:
12531     @@@@test:value:
12532     <!DOCTYPE p [
12533     <!NOTATION n SYSTEM "notation">
12534     <!ENTITY ext SYSTEM "system" NDATA n>
12535     ]>
12536     <p>&ext;</p>
12537     @@@c:erred: <[[xp|wf-parsed-entity]]> { (5, 4)..(5, 8); }
12538     @@XMLTest:
12539     @@@QName: xp.attval.parsed.entity.reference.test
12540     @@@DEnt:
12541     @@@@test:value:
12542     <!DOCTYPE p [
12543     <!NOTATION n SYSTEM "notation">
12544     <!ENTITY ext SYSTEM "system" NDATA n>
12545     ]>
12546     <p a="&ext;"/>
12547     # @@@c:erred: <[[xp|wf-parsed-entity]]> { (5, 7)..(5, 11); }
12548     @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (5, 7)..(5, 11); }
12549     @@XMLTest:
12550     @@@QName: xp.element.content.reptxt.parsed.entity.reference.test
12551     @@@DEnt:
12552     @@@@test:value:
12553     <!DOCTYPE p [
12554     <!NOTATION n SYSTEM "notation">
12555     <!ENTITY ext SYSTEM "system" NDATA n>
12556     <!ENTITY c "&#x26;ext;">
12557     ]>
12558     <p>&c;</p>
12559     @@@c:erred: <[[xp|wf-parsed-entity]]> { (1, 1)..(1, 5); }
12560     @@XMLTest:
12561     @@@QName: xp.attval.reptxt.parsed.entity.reference.test
12562     @@@DEnt:
12563     @@@@test:value:
12564     <!DOCTYPE p [
12565     <!NOTATION n SYSTEM "notation">
12566     <!ENTITY ext SYSTEM "system" NDATA n>
12567     <!ENTITY c "&#x26;ext;">
12568     ]>
12569     <p a="&c;"/>
12570 wakaba 1.34 @@@cfg:entity-replacement-tree: 0
12571     @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (1, 1)..(1, 5); }
12572     @@XMLTest:
12573     @@@QName: xp.attval.reptxt.parsed.entity.reference.2.test
12574     @@@DEnt:
12575     @@@@test:value:
12576     <!DOCTYPE p [
12577     <!NOTATION n SYSTEM "notation">
12578     <!ENTITY ext SYSTEM "system" NDATA n>
12579     <!ENTITY c "&#x26;ext;">
12580     ]>
12581     <p a="&c;"/>
12582     @@@cfg:entity-replacement-tree: 1
12583 wakaba 1.23 @@@c:erred: <[[xp|wf-no-external-entity-references]]> { (1, 1)..(1, 5); }
12584     @@@c:erred:
12585     @@@@@: <[[xp|wf-parsed-entity]]> { }
12586     @@@@enImplNote: During entity node construction.
12587     @@XMLTest:
12588     @@@QName: xp.element.content.entval.parsed.entity.reference.test
12589     @@@DEnt:
12590     @@@@test:value:
12591     <!DOCTYPE p [
12592     <!NOTATION n SYSTEM "notation">
12593     <!ENTITY ext SYSTEM "system" NDATA n>
12594     <!ENTITY c "&ext;">
12595     ]>
12596     <p>&c;</p>
12597     @@@c:erred: <[[xp|wf-parsed-entity]]> { }
12598     @@XMLTest:
12599     @@@QName: xp.attval.entval.parsed.entity.reference.test
12600     @@@DEnt:
12601     @@@@test:value:
12602     <!DOCTYPE p [
12603     <!NOTATION n SYSTEM "notation">
12604     <!ENTITY ext SYSTEM "system" NDATA n>
12605     <!ENTITY c "&ext;">
12606     ]>
12607     <p a="&c;"/>
12608 wakaba 1.34 @@@cfg:entity-replacement-tree: 0
12609     @@@c:erred: <[[xp|wf-no-external-entity-references]]> { }
12610     @@XMLTest:
12611     @@@QName: xp.attval.entval.parsed.entity.reference.2.test
12612     @@@DEnt:
12613     @@@@test:value:
12614     <!DOCTYPE p [
12615     <!NOTATION n SYSTEM "notation">
12616     <!ENTITY ext SYSTEM "system" NDATA n>
12617     <!ENTITY c "&ext;">
12618     ]>
12619     <p a="&c;"/>
12620     @@@cfg:entity-replacement-tree: 1
12621 wakaba 1.23 @@@c:erred: <[[xp|wf-no-external-entity-references]]> { }
12622     @@@c:erred: <[[xp|wf-parsed-entity]]> { }
12623    
12624     @@XMLTest:
12625     @@@QName: xp.element.content.no.recursion.direct.test
12626     @@@DEnt:
12627     @@@@test:value:
12628     <!DOCTYPE p [
12629     <!ENTITY c "&c;">
12630     ]>
12631     <p>&c;</p>
12632     @@@c:erred: <[[xp|wf-no-recursion]]> { (1, 1)..(1, 3); }
12633     @@XMLTest:
12634     @@@QName: xp.element.content.no.recursion.indirect.test
12635     @@@DEnt:
12636     @@@@test:value:
12637     <!DOCTYPE p [
12638     <!ENTITY d "&c;">
12639     <!ENTITY c "&d;">
12640     ]>
12641     <p>&c;</p>
12642     @@@c:erred: <[[xp|wf-no-recursion]]> { /* |d| */ (1, 1)..(1, 3); }
12643     @@XMLTest:
12644     @@@QName: xp.attval.no.recursion.direct.test
12645     @@@DEnt:
12646     @@@@test:value:
12647     <!DOCTYPE p [
12648     <!ENTITY c "&c;">
12649     ]>
12650     <p a="&c;"/>
12651     @@@c:erred: <[[xp|wf-no-recursion]]> { (1, 1)..(1, 3); }
12652     @@XMLTest:
12653     @@@QName: xp.attval.no.recursion.indirect.test
12654     @@@DEnt:
12655     @@@@test:value:
12656     <!DOCTYPE p [
12657     <!ENTITY d "&c;">
12658     <!ENTITY c "&d;">
12659     ]>
12660     <p a="&c;"/>
12661     @@@c:erred: <[[xp|wf-no-recursion]]> { /* |d| */ (1, 1)..(1, 3); }
12662     @@XMLTest:
12663     @@@QName: xp.reptxt.element.content.no.recursion.direct.test
12664     @@@DEnt:
12665     @@@@test:value:
12666     <!DOCTYPE p [
12667     <!ENTITY c "&c;">
12668     <!ENTITY e "&#x26;c;">
12669     ]>
12670     <p>&e;</p>
12671     @@@c:erred: <[[xp|wf-no-recursion]]> { /* |e| */ (1, 1)..(1, 3); }
12672     @@XMLTest:
12673     @@@QName: xp.reptxt.element.content.no.recursion.indirect.test
12674     @@@DEnt:
12675     @@@@test:value:
12676     <!DOCTYPE p [
12677     <!ENTITY d "&c;">
12678     <!ENTITY c "&d;">
12679     <!ENTITY e "&#x26;c;">
12680     ]>
12681     <p>&e;</p>
12682     @@@c:erred: <[[xp|wf-no-recursion]]> { /* |d| */ (1, 1)..(1, 3); }
12683     @@XMLTest:
12684     @@@QName: xp.reptxt.attval.no.recursion.direct.test
12685     @@@DEnt:
12686     @@@@test:value:
12687     <!DOCTYPE p [
12688     <!ENTITY c "&c;">
12689     <!ENTITY e "&#x26;c;">
12690     ]>
12691     <p a="&e;"/>
12692     @@@c:erred: <[[xp|wf-no-recursion]]> { /* |e| */ (1, 1)..(1, 3); }
12693     @@XMLTest:
12694     @@@QName: xp.reptxt.attval.no.recursion.indirect.test
12695     @@@DEnt:
12696     @@@@test:value:
12697     <!DOCTYPE p [
12698     <!ENTITY d "&c;">
12699     <!ENTITY c "&d;">
12700     <!ENTITY e "&#x26;c;">
12701     ]>
12702     <p a="&e;"/>
12703     @@@c:erred: <[[xp|wf-no-recursion]]> { /* |d| */ (1, 1)..(1, 3); }
12704    
12705     @@XMLTest:
12706     @@@QName: xp.ENTITY.system.ndata.name.test
12707     @@@DEnt:
12708     @@@@test:value:
12709     <!DOCTYPE a [
12710     <!NOTATION n SYSTEM "n">
12711     <!ENTITY % e SYSTEM "sys" NDATA n>
12712     ]><a/>
12713     @@@c:erred: <[[xp|wf-syntax-error]]> { (3, 26)..(3, 30); }
12714     @@XMLTest:
12715     @@@QName: xp.ENTITY.public.ndata.name.test
12716     @@@DEnt:
12717     @@@@test:value:
12718     <!DOCTYPE a [
12719     <!NOTATION n SYSTEM "n">
12720     <!ENTITY % e PUBLIC "pub" "sys" NDATA n>
12721     ]><a/>
12722     @@@c:erred: <[[xp|wf-syntax-error]]> { (3, 33)..(3, 37); }
12723     @@XMLTest:
12724     @@@QName: xp.ENTITY.public.ndata.name.-1.test
12725     @@@DEnt:
12726     @@@@test:value:
12727     <!DOCTYPE a [
12728     <!NOTATION n SYSTEM "n">
12729     <!ENTITY % e PUBLIC "pub" "sys" >
12730     ]><a/>
12731     @@@test:domTree:
12732     document { }
12733    
12734     @@XMLTest:
12735     @@@QName: xp.ENTITY.pubid.1.test
12736     @@@DEnt:
12737     @@@@test:value:
12738     <!DOCTYPE a [
12739     <!ENTITY e PUBLIC "p" "s">
12740     ]><a/>
12741     @@@test:domTree:
12742     document {
12743     document-type {
12744     general-entity {
12745     node-name: 'e';
12746     public-id: 'p';
12747     system-id: 's';
12748     }
12749     }
12750     element { }
12751     }
12752     @@XMLTest:
12753     @@@QName: xp.ENTITY.pubid.2.test
12754     @@@DEnt:
12755     @@@@test:value:
12756     <!DOCTYPE a [
12757     <!ENTITY e PUBLIC " p " "s">
12758     ]><a/>
12759     @@@test:domTree:
12760     document {
12761     document-type {
12762     general-entity {
12763     node-name: 'e';
12764     public-id: 'p';
12765     system-id: 's';
12766     }
12767     }
12768     element { }
12769     }
12770     @@XMLTest:
12771     @@@QName: xp.ENTITY.pubid.3.test
12772     @@@DEnt:
12773     @@@@test:value:
12774     <!DOCTYPE a [
12775     <!ENTITY e PUBLIC " p $u000Aq$u000A " "s">
12776     ]><a/>
12777     @@@test:domTree:
12778     document {
12779     document-type {
12780     general-entity {
12781     node-name: 'e';
12782     public-id: 'p q';
12783     system-id: 's';
12784     }
12785     }
12786     element { }
12787     }
12788     @@XMLTest:
12789     @@@QName: xp.ENTITY.pubid.4.test
12790     @@@DEnt:
12791     @@@@test:value:
12792     <!DOCTYPE a [
12793     <!ENTITY e PUBLIC " p $u000D$u000Aq" "s">
12794     ]><a/>
12795     @@@test:domTree:
12796     document {
12797     document-type {
12798     general-entity {
12799     node-name: 'e';
12800     public-id: 'p q';
12801     system-id: 's';
12802     }
12803     }
12804     element { }
12805     }
12806     @@XMLTest:
12807     @@@QName: xp.ENTITY.pubid.5.test
12808     @@@DEnt:
12809     @@@@test:value:
12810     <?xml version="1.1"?>
12811     <!DOCTYPE a [
12812 wakaba 1.27 <!ENTITY e PUBLIC " p $u000D$u0085q" "s">
12813 wakaba 1.23 ]><a/>
12814     @@@test:domTree:
12815     document {
12816     document-type {
12817     general-entity {
12818     node-name: 'e';
12819     public-id: 'p q';
12820     system-id: 's';
12821     }
12822     }
12823     element { }
12824     }
12825    
12826 wakaba 1.24 @@XMLTest:
12827     @@@QName: xp.ENTITY.ignored.test
12828     @@@DEnt:
12829     @@@@test:value:
12830     <!DOCTYPE a [
12831     <!ENTITY e "a">
12832     <!ENTITY e "b">
12833     ]><a/>
12834 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
12835 wakaba 1.24 @@@test:domTree:
12836     document {
12837     document-type {
12838     general-entity {
12839     node-name: 'e';
12840     text-content: 'a';
12841     }
12842     }
12843     element { }
12844     }
12845     @@@c:erred:
12846     <[[xp|warning-entity-declaration-ignored]]> { (3, 1)..(3, 15); }
12847     @@XMLTest:
12848     @@@QName: xp.ENTITY.ignored.2.test
12849     @@@DEnt:
12850     @@@@test:value:
12851     <!DOCTYPE a [
12852     <!ENTITY % e "a">
12853     <!ENTITY % e "b">
12854     ]><a/>
12855     @@@test:domTree:
12856     document { }
12857     @@@c:erred:
12858     <[[xp|warning-entity-declaration-ignored]]> { (3, 1)..(3, 17); }
12859    
12860     @@XMLTest:
12861     @@@QName: xp.ENTITY.predefined.1.test
12862     @@@DEnt:
12863     @@@@test:value:
12864     <!DOCTYPE a [
12865     <!ENTITY lt "&#38;#60;">
12866     <!ENTITY gt "&#62;">
12867     <!ENTITY amp "&#38;#38;">
12868     <!ENTITY apos "&#39;">
12869     <!ENTITY quot "&#34;">
12870     <!ENTITY e "f">
12871     ]><a>&lt;&gt;&amp;&apos;&quot;</a>
12872 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
12873 wakaba 1.24 @@@test:domTree:
12874     document {
12875     document-type {
12876     general-entity {
12877     node-name: 'e';
12878     text-content: 'f';
12879     }
12880     }
12881     element {
12882     text-content: '<>&' U+0027 '"';
12883     }
12884     }
12885     @@XMLTest:
12886     @@@QName: xp.ENTITY.predefined.2.test
12887     @@@DEnt:
12888     @@@@test:value:
12889     <!DOCTYPE a [
12890     <!ENTITY lt "&#38;#60;">
12891     <!ENTITY gt "&#x26;#62;">
12892     <!ENTITY amp "&#38;#38;">
12893     <!ENTITY apos "&#x26;#39;">
12894     <!ENTITY quot "&#x26;#34;">
12895     <!ENTITY e "f">
12896     ]><a>&lt;&gt;&amp;&apos;&quot;</a>
12897 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
12898 wakaba 1.24 @@@test:domTree:
12899     document {
12900     document-type {
12901     general-entity {
12902     node-name: 'e';
12903     text-content: 'f';
12904     }
12905     }
12906     element {
12907     text-content: '<>&' U+0027 '"';
12908     }
12909     }
12910     @@XMLTest:
12911     @@@QName: xp.ENTITY.predefined.3.test
12912     @@@DEnt:
12913     @@@@test:value:
12914     <!DOCTYPE a [
12915     <!ENTITY lt "&#60;">
12916     <!ENTITY gt "&#62;">
12917     <!ENTITY amp "&#38;">
12918     <!ENTITY apos "&#39;">
12919     <!ENTITY quot "&#34;">
12920     <!ENTITY e "f">
12921     ]><a>&lt;&gt;&amp;&apos;&quot;</a>
12922 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
12923 wakaba 1.24 @@@c:erred: <[[xp|error-malformed-predefined-entity]]> { (2, 1)..(2, 24); }
12924     @@@c:erred: <[[xp|error-malformed-predefined-entity]]> { (4, 1)..(4, 24); }
12925     @@@test:domTree:
12926     document {
12927     document-type {
12928     general-entity {
12929     node-name: 'e';
12930     text-content: 'f';
12931     }
12932     }
12933     element {
12934     text-content: '<>&' U+0027 '"';
12935     }
12936     }
12937     @@XMLTest:
12938     @@@QName: xp.ENTITY.predefined.4.test
12939     @@@DEnt:
12940     @@@@test:value:
12941     <!DOCTYPE a [
12942     <!ENTITY lt "1">
12943     <!ENTITY gt "2">
12944     <!ENTITY amp "3">
12945     <!ENTITY apos "4">
12946     <!ENTITY quot "5">
12947     <!ENTITY e "f">
12948     ]><a>&lt;&gt;&amp;&apos;&quot;</a>
12949 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
12950 wakaba 1.24 @@@c:erred: <[[xp|error-malformed-predefined-entity]]> { (2, 1)..(2, 24); }
12951     @@@c:erred: <[[xp|error-malformed-predefined-entity]]> { (3, 1)..(3, 24); }
12952     @@@c:erred: <[[xp|error-malformed-predefined-entity]]> { (4, 1)..(4, 24); }
12953     @@@c:erred: <[[xp|error-malformed-predefined-entity]]> { (5, 1)..(5, 24); }
12954     @@@c:erred: <[[xp|error-malformed-predefined-entity]]> { (6, 1)..(6, 24); }
12955     @@@test:domTree:
12956     document {
12957     document-type {
12958     general-entity {
12959     node-name: 'e';
12960     text-content: 'f';
12961     }
12962     }
12963     element {
12964     text-content: '<>&' U+0027 '"';
12965     }
12966     }
12967     @@XMLTest:
12968     @@@QName: xp.ENTITY.predefined.5.test
12969     @@@DEnt:
12970     @@@@test:value:
12971     <!DOCTYPE a [
12972     <!ENTITY lt SYSTEM "1">
12973     <!ENTITY gt SYSTEM "2">
12974     <!ENTITY amp SYSTEM "3">
12975     <!ENTITY apos SYSTEM "4">
12976     <!ENTITY quot SYSTEM "5">
12977     <!ENTITY e "f">
12978     ]><a>&lt;&gt;&amp;&apos;&quot;</a>
12979 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
12980 wakaba 1.24 @@@c:erred: <[[xp|error-internal-predefined-entity]]> { (2, 1)..(2, 27); }
12981     @@@c:erred: <[[xp|error-internal-predefined-entity]]> { (3, 1)..(3, 27); }
12982     @@@c:erred: <[[xp|error-internal-predefined-entity]]> { (4, 1)..(4, 27); }
12983     @@@c:erred: <[[xp|error-internal-predefined-entity]]> { (5, 1)..(5, 27); }
12984     @@@c:erred: <[[xp|error-internal-predefined-entity]]> { (6, 1)..(6, 27); }
12985     @@@test:domTree:
12986     document {
12987     document-type {
12988     general-entity {
12989     node-name: 'e';
12990     text-content: 'f';
12991     }
12992     }
12993     element {
12994     text-content: '<>&' U+0027 '"';
12995     }
12996     }
12997     @@XMLTest:
12998     @@@QName: xp.ENTITY.predefined.6.test
12999     @@@DEnt:
13000     @@@@test:value:
13001     <!DOCTYPE a [
13002     <!ENTITY % lt SYSTEM "1">
13003     <!ENTITY % gt SYSTEM "2">
13004     <!ENTITY % amp SYSTEM "3">
13005     <!ENTITY % apos SYSTEM "4">
13006     <!ENTITY % quot SYSTEM "5">
13007     <!ENTITY e "f">
13008     ]><a>&lt;&gt;&amp;&apos;&quot;</a>
13009 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
13010 wakaba 1.24 @@@test:domTree:
13011     document {
13012     document-type {
13013     general-entity {
13014     node-name: 'e';
13015     text-content: 'f';
13016     }
13017     }
13018     element {
13019     text-content: '<>&' U+0027 '"';
13020     }
13021     }
13022     @@XMLTest:
13023     @@@QName: xp.ENTITY.predefined.7.test
13024     @@@DEnt:
13025     @@@@test:value:
13026     <!DOCTYPE a [
13027     <!ENTITY lt "&#38;#x3C;">
13028     <!ENTITY gt "&#x3E;">
13029     <!ENTITY amp "&#38;#x26;">
13030     <!ENTITY apos "&#x27;">
13031     <!ENTITY quot "&#x22;">
13032     <!ENTITY e "f">
13033     ]><a>&lt;&gt;&amp;&apos;&quot;</a>
13034 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
13035 wakaba 1.24 @@@test:domTree:
13036     document {
13037     document-type {
13038     general-entity {
13039     node-name: 'e';
13040     text-content: 'f';
13041     }
13042     }
13043     element {
13044     text-content: '<>&' U+0027 '"';
13045     }
13046     }
13047     @@XMLTest:
13048     @@@QName: xp.ENTITY.predefined.8.test
13049     @@@DEnt:
13050     @@@@test:value:
13051     <!DOCTYPE a [
13052     <!ENTITY lt "&#38;#x3c;">
13053     <!ENTITY gt "&#x3e;">
13054     <!ENTITY amp "&#38;#x26;">
13055     <!ENTITY apos "&#x27;">
13056     <!ENTITY quot "&#x22;">
13057     <!ENTITY e "f">
13058     ]><a>&lt;&gt;&amp;&apos;&quot;</a>
13059 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
13060 wakaba 1.24 @@@test:domTree:
13061     document {
13062     document-type {
13063     general-entity {
13064     node-name: 'e';
13065     text-content: 'f';
13066     }
13067     }
13068     element {
13069     text-content: '<>&' U+0027 '"';
13070     }
13071     }
13072     @@XMLTest:
13073     @@@QName: xp.ENTITY.predefined.9.test
13074     @@@DEnt:
13075     @@@@test:value:
13076     <!DOCTYPE a [
13077     <!ENTITY lt "&#38;#x00003C;">
13078     <!ENTITY gt "&#x0003E;">
13079     <!ENTITY amp "&#38;#x026;">
13080     <!ENTITY apos "&#x000027;">
13081     <!ENTITY quot "&#x0022;">
13082     <!ENTITY e "f">
13083     ]><a>&lt;&gt;&amp;&apos;&quot;</a>
13084 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
13085 wakaba 1.24 @@@test:domTree:
13086     document {
13087     document-type {
13088     general-entity {
13089     node-name: 'e';
13090     text-content: 'f';
13091     }
13092     }
13093     element {
13094     text-content: '<>&' U+0027 '"';
13095     }
13096     }
13097     @@XMLTest:
13098     @@@QName: xp.ENTITY.predefined.10.test
13099     @@@DEnt:
13100     @@@@test:value:
13101     <!DOCTYPE a [
13102     <!ENTITY lt "&#38;#00060;">
13103     <!ENTITY gt "&#062;">
13104     <!ENTITY amp "&#38;#000038;">
13105     <!ENTITY apos "&#0000039;">
13106     <!ENTITY quot "&#0034;">
13107     <!ENTITY e "f">
13108     ]><a>&lt;&gt;&amp;&apos;&quot;</a>
13109 wakaba 1.34 @@@cfg:entity-replacement-tree: 1
13110 wakaba 1.24 @@@test:domTree:
13111     document {
13112     document-type {
13113     general-entity {
13114     node-name: 'e';
13115     text-content: 'f';
13116     }
13117     }
13118     element {
13119     text-content: '<>&' U+0027 '"';
13120     }
13121     }
13122    
13123 wakaba 1.25 @@XMLTest:
13124     @@@QName: xp.processed.1.test
13125     @@@DEnt:
13126     @@@@test:value:
13127     <a/>
13128     @@@test:domTree:
13129     document {
13130     all-declarations-processed: true;
13131     element { }
13132     }
13133     @@XMLTest:
13134     @@@QName: xp.processed.2.test
13135     @@@DEnt:
13136     @@@@test:value:
13137     <!DOCTYPE a [
13138     <!ENTITY e "f">
13139     <!ATTLIST a b NMTOKEN " c ">
13140     ]><a>&e;</a>
13141     @@@test:domTree:
13142     document {
13143     document-type {
13144     general-entity {
13145     node-name: 'e';
13146     }
13147     element-type-definition {
13148     node-name: 'a';
13149     attribute-definition {
13150     node-name: 'b';
13151     }
13152     }
13153     }
13154     all-declarations-processed: true;
13155     element {
13156     attribute {
13157     node-name: 'b';
13158     node-value: 'c';
13159     }
13160     text-content: 'f';
13161     }
13162     }
13163     @@XMLTest:
13164     @@@QName: xp.processed.3.test
13165     @@@DEnt:
13166     @@@@test:value:
13167     <!DOCTYPE a [
13168     <!ENTITY % p SYSTEM "p">
13169     %p;
13170     <!ENTITY e "f">
13171     <!ATTLIST a b NMTOKEN " c ">
13172     ]><a d="e">&e;</a>
13173     @@@test:domTree:
13174     document {
13175     document-type { }
13176     all-declarations-processed: false;
13177     element {
13178     attribute {
13179     node-name: 'd';
13180     node-value: 'e';
13181     }
13182     general-entity-reference {
13183     node-name: 'e';
13184 wakaba 1.34 manakai-expanded: false;
13185 wakaba 1.25 }
13186     }
13187     }
13188     @@@c:erred:
13189     <[[xp|warning-entity-declaration-not-processed]]> { (4, 1)..(4, 20); }
13190     @@@c:erred:
13191     <[[xp|warning-attribute-definition-not-processed]]> { (5, 13)..(5, 31); }
13192     @@XMLTest:
13193     @@@QName: xp.processed.4.test
13194     @@@DEnt:
13195     @@@@test:value:
13196     <?xml version="1.1" standalone="yes"?>
13197     <!DOCTYPE a [
13198     <!ENTITY % p SYSTEM "p">
13199     %p;
13200     <!ENTITY e "f">
13201     <!ATTLIST a b NMTOKEN " c ">
13202     ]><a>&e;</a>
13203     @@@test:domTree:
13204     document {
13205     document-type {
13206     general-entity {
13207     node-name: 'e';
13208     }
13209     element-type-definition {
13210     node-name: 'a';
13211     attribute-definition {
13212     node-name: 'b';
13213     }
13214     }
13215     }
13216     all-declarations-processed: false;
13217     element {
13218     attribute {
13219     node-name: 'b';
13220     node-value: 'c';
13221     }
13222     text-content: 'f';
13223     }
13224     }
13225     @@XMLTest:
13226     @@@QName: xp.processed.5.test
13227     @@@DEnt:
13228     @@@@test:value:
13229     <!DOCTYPE a SYSTEM "p" [
13230     <!ENTITY e "f">
13231     <!ATTLIST a b NMTOKEN " c ">
13232     ]><a>&e;</a>
13233     @@@test:domTree:
13234     document {
13235     document-type {
13236     general-entity {
13237     node-name: 'e';
13238     }
13239     element-type-definition {
13240     node-name: 'a';
13241     attribute-definition {
13242     node-name: 'b';
13243     }
13244     }
13245     }
13246     all-declarations-processed: false;
13247     element {
13248     attribute {
13249     node-name: 'b';
13250     node-value: 'c';
13251     }
13252     text-content: 'f';
13253     }
13254     }
13255    
13256     @@XMLTest:
13257     @@@QName: xp.PEs.in.internal.subset.1.test
13258     @@@DEnt:
13259     @@@@test:value:
13260     <!DOCTYPE a [
13261     <!ENTITY % p " ">
13262 wakaba 1.26 <!ENTITY % q "%p;">
13263 wakaba 1.25 ]><a/>
13264     @@@c:erred: <[[xp|wf-pes-in-internal-subset]]> { (3, 15)..(3, 17); }
13265     @@XMLTest:
13266     @@@QName: xp.PEs.in.internal.subset.2.test
13267     @@@DEnt:
13268     @@@@test:value:
13269     <!DOCTYPE a [
13270     <!ENTITY % p " ">
13271 wakaba 1.26 <!ENTITY % q '%p;'>
13272 wakaba 1.25 ]><a/>
13273     @@@c:erred: <[[xp|wf-pes-in-internal-subset]]> { (3, 15)..(3, 17); }
13274    
13275 wakaba 1.26 @@XMLTest:
13276     @@@QName: xp.name.pitarget.content.1.0.2.test
13277     @@@DEnt:
13278     @@@@test:value:
13279     <?xml version="1.0"?>
13280     <p>
13281     <?$u3001$u3002?>
13282     </p>
13283     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]> { (3, 3)..(3, 4); }
13284     @@XMLTest:
13285     @@@QName: xp.name.pitarget.content.1.1.2.test
13286     @@@DEnt:
13287     @@@@test:value:
13288     <?xml version="1.1"?>
13289     <p>$
13290     <?$u3001$u3002?>$
13291     </p>
13292     @@@test:domTree:
13293     document {
13294     xml-version: '1.1';
13295     element {
13296     pi {
13297     node-name: U+3001 U+3002;
13298 wakaba 1.14 }
13299 wakaba 1.12 }
13300 wakaba 1.26 }
13301     @@XMLTest:
13302     @@@QName: xp.name.pitarget.content.1.0.3.test
13303     @@@DEnt:
13304     @@@@test:value:
13305     <?xml version="1.0"?>
13306     <p>
13307     <?$u3005b?>
13308     </p>
13309     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]> { (3, 3)..(3, 4); }
13310     @@XMLTest:
13311     @@@QName: xp.name.pitarget.content.1.1.3.test
13312     @@@DEnt:
13313     @@@@test:value:
13314     <?xml version="1.1"?>
13315     <p>$
13316     <?$u3005b?>$
13317     </p>
13318     @@@test:domTree:
13319     document {
13320     xml-version: '1.1';
13321     element {
13322     pi {
13323     node-name: U+3005 'b';
13324 wakaba 1.12 }
13325     }
13326 wakaba 1.26 }
13327     @@XMLTest:
13328     @@@QName: xp.name.pitarget.content.names.1.0.1.test
13329     @@@DEnt:
13330     @@@@test:value:
13331     <?xml version="1.0"?>
13332     <p>
13333     <?a:b?>
13334     </p>
13335     @@@c:erred: <[[xp|nswf-legal-ncname]]> { (3, 3)..(3, 5); }
13336     @@XMLTest:
13337     @@@QName: xp.name.pitarget.content.names.1.1.1.test
13338     @@@DEnt:
13339     @@@@test:value:
13340     <?xml version="1.1"?>
13341     <p>
13342     <?a:b?>
13343     </p>
13344     @@@c:erred: <[[xp|nswf-legal-ncname]]> { (3, 3)..(3, 5); }
13345     @@XMLTest:
13346     @@@QName: xp.name.pitarget.intsubset.1.0.2.test
13347     @@@DEnt:
13348     @@@@test:value:
13349     <?xml version="1.0"?>
13350     <!DOCTYPE p [
13351     <?$u3001$u3002?>
13352     ]><p/>
13353     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]> { (3, 3)..(3, 4); }
13354     @@XMLTest:
13355     @@@QName: xp.name.pitarget.intsubset.1.1.2.test
13356     @@@DEnt:
13357     @@@@test:value:
13358     <?xml version="1.1"?>
13359     <!DOCTYPE p [
13360     <?$u3001$u3002?>
13361     ]><p/>
13362     @@@test:domTree:
13363     document {
13364     xml-version: '1.1';
13365     document-type {
13366     pi {
13367     node-name: U+3001 U+3002;
13368     }
13369     }
13370     element { }
13371     }
13372     @@XMLTest:
13373     @@@QName: xp.name.pitarget.intsubset.1.0.3.test
13374     @@@DEnt:
13375     @@@@test:value:
13376     <?xml version="1.0"?>
13377     <!DOCTYPE p [
13378     <?$u3005b?>
13379     ]><p/>
13380     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]> { (3, 3)..(3, 4); }
13381     @@XMLTest:
13382     @@@QName: xp.name.pitarget.intsubset.1.1.3.test
13383     @@@DEnt:
13384     @@@@test:value:
13385     <?xml version="1.1"?>
13386     <!DOCTYPE p [
13387     <?$u3005b?>
13388     ]><p/>
13389     @@@test:domTree:
13390     document {
13391     xml-version: '1.1';
13392     document-type {
13393     pi {
13394     node-name: U+3005 'b';
13395     }
13396     }
13397     element { }
13398     }
13399     @@XMLTest:
13400     @@@QName: xp.name.pitarget.intsubset.names.1.0.1.test
13401     @@@DEnt:
13402     @@@@test:value:
13403     <?xml version="1.0"?>
13404     <!DOCTYPE p [
13405     <?a:b?>
13406     ]><p/>
13407     @@@c:erred: <[[xp|nswf-legal-ncname]]> { (3, 3)..(3, 5); }
13408     @@XMLTest:
13409     @@@QName: xp.name.pitarget.intsubset.names.1.1.1.test
13410     @@@DEnt:
13411     @@@@test:value:
13412     <?xml version="1.1"?>
13413     <!DOCTYPE p [
13414     <?a:b?>
13415     ]><p/>
13416     @@@c:erred: <[[xp|nswf-legal-ncname]]> { (3, 3)..(3, 5); }
13417     @@XMLTest:
13418     @@@QName: xp.name.doctypedecl.stag.etag.1.0.2.test
13419     @@@DEnt:
13420     @@@@test:value:
13421     <?xml version="1.0"?>
13422     <!DOCTYPE $u3001$u3002>
13423     <$u3001$u3002>
13424     </$u3001$u3002>
13425     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (2, 11)..(2, 12); }
13426     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (3, 2)..(3, 3); }
13427     # @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (4, 3)..(4, 4); }
13428     @@XMLTest:
13429     @@@QName: xp.name.doctypedecl.stag.etag.1.1.2.test
13430     @@@DEnt:
13431     @@@@test:value:
13432     <?xml version="1.1"?>
13433     <!DOCTYPE $u3001$u3002>
13434     <$u3001$u3002>
13435     </$u3001$u3002>
13436     @@@test:domTree:
13437     document {
13438     xml-version: '1.1';
13439     document-type {
13440     node-name: U+3001 U+3002;
13441     }
13442     element {
13443     node-name: U+3001 U+3002;
13444     }
13445     }
13446     @@XMLTest:
13447     @@@QName: xp.name.doctypedecl.stag.etag.1.0.3.test
13448     @@@DEnt:
13449     @@@@test:value:
13450     <?xml version="1.0"?>
13451     <!DOCTYPE $u3005b>
13452     <$u3005b>
13453     </$u3005b>
13454     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (2, 11)..(2, 12); }
13455     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (3, 2)..(3, 3); }
13456     # @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (4, 3)..(4, 4); }
13457     @@XMLTest:
13458     @@@QName: xp.name.doctype.decl.stag.etag.1.1.3.test
13459     @@@DEnt:
13460     @@@@test:value:
13461     <?xml version="1.1"?>
13462     <!DOCTYPE $u3005b>
13463     <$u3005b>
13464     </$u3005b>
13465     @@@test:domTree:
13466     document {
13467     xml-version: '1.1';
13468     document-type {
13469     node-name: U+3005 'b';
13470     }
13471     element {
13472     node-name: U+3005 'b';
13473     }
13474     }
13475     @@XMLTest:
13476     @@@QName: xp.name.doctypedecl.stag.etag.names.1.0.1.test
13477     @@@DEnt:
13478     @@@@test:value:
13479     <?xml version="1.0"?>
13480     <!DOCTYPE a:b>
13481     <a:b xmlns:a="http://a.example/">
13482     </a:b>
13483     @@@test:domTree:
13484     document {
13485     xml-version: '1.0';
13486     document-type {
13487     node-name: 'a:b';
13488     }
13489     element {
13490     prefix: 'a';
13491     local-name: 'b';
13492     namespace-uri: 'http://a.example/';
13493     attribute {
13494     namespace-uri: 'http://www.w3.org/2000/xmlns/';
13495     prefix: 'xmlns';
13496     local-name: 'a';
13497     value: 'http://a.example/';
13498     specified: true;
13499     }
13500     }
13501     }
13502     @@XMLTest:
13503     @@@QName: xp.name.doctypedecl.stag.etag.names.1.1.1.test
13504     @@@DEnt:
13505     @@@@test:value:
13506     <?xml version="1.1"?>
13507     <!DOCTYPE a:b>
13508     <a:b xmlns:a="http://a.example/">
13509     </a:b>
13510     @@@test:domTree:
13511     document {
13512     xml-version: '1.1';
13513     document-type {
13514     node-name: 'a:b';
13515     }
13516     element {
13517     prefix: 'a';
13518     local-name: 'b';
13519     namespace-uri: 'http://a.example/';
13520     attribute {
13521     namespace-uri: 'http://www.w3.org/2000/xmlns/';
13522     prefix: 'xmlns';
13523     local-name: 'a';
13524     specified: true;
13525     }
13526     }
13527     }
13528     @@XMLTest:
13529     @@@QName: xp.name.doctypedecl.stag.etag.names.1.0.2.test
13530     @@@DEnt:
13531     @@@@test:value:
13532     <?xml version="1.0"?>
13533     <!DOCTYPE :ab>
13534     <:ab>
13535     </:ab>
13536     @@@c:erred: <[[xp|nswf-legal-qname]]> { (2, 11)..(2, 13); }
13537     @@@c:erred: <[[xp|nswf-legal-qname]]> { (3, 2)..(3, 4); }
13538     @@@c:erred: <[[xp|nsc-prefix-declared]]> { /* prefix || */ }
13539     @@XMLTest:
13540     @@@QName: xp.name.doctypedecl.stag.etag.names.1.1.2.test
13541     @@@DEnt:
13542     @@@@test:value:
13543     <?xml version="1.1"?>
13544     <!DOCTYPE :ab>
13545     <:ab>
13546     </:ab>
13547     @@@c:erred: <[[xp|nswf-legal-qname]]> { (2, 11)..(2, 13); }
13548     @@@c:erred: <[[xp|nswf-legal-qname]]> { (3, 2)..(3, 4); }
13549     @@@c:erred: <[[xp|nsc-prefix-declared]]> { /* prefix || */ }
13550     @@XMLTest:
13551     @@@QName: xp.name.doctypedecl.stag.etag.names.1.0.3.test
13552     @@@DEnt:
13553     @@@@test:value:
13554     <?xml version="1.0"?>
13555     <!DOCTYPE a:$u3005>
13556     <a:$u3005 xmlns:a="http://a.example/">
13557     </a:$u3005>
13558     @@@c:erred: <[[xp|nswf-legal-qname]]> { (2, 11)..(2, 13); }
13559     @@@c:erred: <[[xp|nswf-legal-qname]]> { (3, 2)..(3, 4); }
13560     @@XMLTest:
13561     @@@QName: xp.name.doctypedecl.stag.etag.names.1.1.3.test
13562     @@@DEnt:
13563     @@@@test:value:
13564     <?xml version="1.1"?>
13565     <!DOCTYPE a:$u3005>
13566     <a:$u3005 xmlns:a="http://a.example/">
13567     </a:$u3005>
13568     @@@test:domTree:
13569     document {
13570     xml-version: '1.1';
13571     document-type {
13572     node-name: 'a:' U+3005;
13573     }
13574     element {
13575     prefix: 'a';
13576     local-name: U+3005;
13577     namespace-uri: 'http://a.example/';
13578     attribute {
13579     namespace-uri: 'http://www.w3.org/2000/xmlns/';
13580     prefix: 'xmlns';
13581     local-name: 'a';
13582     value: 'http://a.example/';
13583     specified: true;
13584     }
13585     }
13586     }
13587     @@XMLTest:
13588     @@@QName: xp.name.doctypedecl.stag.etag.names.1.0.4.test
13589     @@@DEnt:
13590     @@@@test:value:
13591     <?xml version="1.0"?>
13592     <!DOCTYPE a:b>
13593     <a:b>
13594     </a:b>
13595     @@@c:erred: <[[xp|nsc-prefix-declared]]> { (3, 1)..(3, 5); }
13596     @@XMLTest:
13597     @@@QName: xp.name.doctypedecl.stag.etag.names.1.1.4.test
13598     @@@DEnt:
13599     @@@@test:value:
13600     <?xml version="1.1"?>
13601     <!DOCTYPE a:b>
13602     <a:b>
13603     </a:b>
13604     @@@c:erred: <[[xp|nsc-prefix-declared]]> { (3, 1)..(3, 5); }
13605     @@XMLTest:
13606     @@@QName: xp.name.emptyelemtag.1.0.2.test
13607     @@@DEnt:
13608     @@@@test:value:
13609     <?xml version="1.0"?>
13610     <$u3001$u3002/>
13611     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (2, 2)..(2, 3); }
13612     @@XMLTest:
13613     @@@QName: xp.name.emptyelemtag.1.1.2.test
13614     @@@DEnt:
13615     @@@@test:value:
13616     <?xml version="1.1"?>
13617     <$u3001$u3002/>
13618     @@@test:domTree:
13619     document {
13620     xml-version: '1.1';
13621     element {
13622     node-name: U+3001 U+3002;
13623     }
13624     }
13625     @@XMLTest:
13626     @@@QName: xp.name.emptyelemtag.1.0.3.test
13627     @@@DEnt:
13628     @@@@test:value:
13629     <?xml version="1.0"?>
13630     <$u3005b/>
13631     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (2, 2)..(2, 3); }
13632     @@XMLTest:
13633     @@@QName: xp.name.emptyelemtag.1.1.3.test
13634     @@@DEnt:
13635     @@@@test:value:
13636     <?xml version="1.1"?>
13637     <$u3005b/>
13638     @@@test:domTree:
13639     document {
13640     xml-version: '1.1';
13641     element {
13642     node-name: U+3005 'b';
13643     }
13644     }
13645     @@XMLTest:
13646     @@@QName: xp.name.emptyelemtag.names.1.0.1.test
13647     @@@DEnt:
13648     @@@@test:value:
13649     <?xml version="1.0"?>
13650     <a:b/>
13651     @@@c:erred: <[[xp|nsc-prefix-declared]]>{ (2, 1)..(2, 6); }
13652     @@XMLTest:
13653     @@@QName: xp.name.emptyelemtag.names.1.1.1.test
13654     @@@DEnt:
13655     @@@@test:value:
13656     <?xml version="1.1"?>
13657     <a:b/>
13658     @@@c:erred: <[[xp|nsc-prefix-declared]]>{ (2, 1)..(2, 6); }
13659     @@XMLTest:
13660     @@@QName: xp.name.attr.1.0.2.test
13661     @@@DEnt:
13662     @@@@test:value:
13663     <?xml version="1.0"?>
13664     <a $u3001$u3002=""/>
13665     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (2, 4)..(2, 5); }
13666     @@XMLTest:
13667     @@@QName: xp.name.attr.1.1.2.test
13668     @@@DEnt:
13669     @@@@test:value:
13670     <?xml version="1.1"?>
13671     <a $u3001$u3002=""/>
13672     @@@test:domTree:
13673     document {
13674     xml-version: '1.1';
13675     element {
13676     attribute {
13677     node-name: U+3001 U+3002;
13678     }
13679     }
13680     }
13681     @@XMLTest:
13682     @@@QName: xp.name.attr.1.0.3.test
13683     @@@DEnt:
13684     @@@@test:value:
13685     <?xml version="1.0"?>
13686     <a $u3005b=""/>
13687     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (2, 4)..(2, 5); }
13688     @@XMLTest:
13689     @@@QName: xp.name.attr.1.1.3.test
13690     @@@DEnt:
13691     @@@@test:value:
13692     <?xml version="1.1"?>
13693     <a $u3005b=""/>
13694     @@@test:domTree:
13695     document {
13696     xml-version: '1.1';
13697     element {
13698     attribute {
13699     node-name: U+3005 'b';
13700     }
13701     }
13702     }
13703     @@XMLTest:
13704     @@@QName: xp.name.attr.names.1.0.1.test
13705     @@@DEnt:
13706     @@@@test:value:
13707     <?xml version="1.0"?>
13708     <a a:b=""/>
13709     @@@c:erred: <[[xp|nsc-prefix-declared]]>{ (2, 1)..(2, 11); }
13710     @@XMLTest:
13711     @@@QName: xp.name.attr.names.1.1.1.test
13712     @@@DEnt:
13713     @@@@test:value:
13714     <?xml version="1.1"?>
13715     <a a:b=""/>
13716     @@@c:erred: <[[xp|nsc-prefix-declared]]>{ (2, 1)..(2, 11); }
13717     @@XMLTest:
13718     @@@QName: xp.name.attr.names.1.0.2.test
13719     @@@DEnt:
13720     @@@@test:value:
13721     <?xml version="1.0"?>
13722     <a :ab=""/>
13723     @@@c:erred: <[[xp|nswf-legal-qname]]>{ (2, 4)..(2, 6); }
13724     @@@c:erred: <[[xp|nsc-prefix-declared]]> { }
13725     @@XMLTest:
13726     @@@QName: xp.name.attr.names.1.1.2.test
13727     @@@DEnt:
13728     @@@@test:value:
13729     <?xml version="1.1"?>
13730     <a :ab=""/>
13731     @@@c:erred: <[[xp|nswf-legal-qname]]>{ (2, 4)..(2, 6); }
13732     @@@c:erred: <[[xp|nsc-prefix-declared]]> { }
13733     @@XMLTest:
13734     @@@QName: xp.name.attlist.1.0.2.test
13735     @@@DEnt:
13736     @@@@test:value:
13737     <?xml version="1.0"?>
13738     <!DOCTYPE p [
13739     <!NOTATION $u3001$u3002 SYSTEM "n">
13740     <!ATTLIST $u3001$u3002
13741     $u3001$u3002
13742     NOTATION
13743     ($u3001$u3002)
13744     #IMPLIED>
13745     ]><p/>
13746     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (3, 12)..(3, 13); }
13747     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (4, 11)..(4, 12); }
13748     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (5, 1)..(5, 2); }
13749     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (7, 2)..(7, 3); }
13750     @@XMLTest:
13751     @@@QName: xp.name.attlist.1.1.2.test
13752     @@@DEnt:
13753     @@@@test:value:
13754     <?xml version="1.1"?>
13755     <!DOCTYPE p [
13756     <!NOTATION $u3001$u3002 SYSTEM "n">
13757     <!ATTLIST $u3001$u3002
13758     $u3001$u3002
13759     NOTATION
13760     ($u3001$u3002)
13761     #IMPLIED>
13762     ]><p/>
13763     @@@test:domTree:
13764     document {
13765     xml-version: '1.1';
13766     document-type {
13767     notation {
13768     node-name: U+3001 U+3002;
13769     }
13770     element-type-definition {
13771     node-name: U+3001 U+3002;
13772     attribute-definition {
13773     node-name: U+3001 U+3002;
13774     allowed-tokens: DOMStringList (U+3001 U+3002);
13775     }
13776     }
13777     }
13778     element { }
13779     }
13780     @@XMLTest:
13781     @@@QName: xp.name.attlist.1.0.3.test
13782     @@@DEnt:
13783     @@@@test:value:
13784     <?xml version="1.0"?>
13785     <!DOCTYPE p [
13786     <!NOTATION $u3005b SYSTEM "n">
13787     <!ATTLIST $u3005b
13788     $u3005b
13789     NOTATION
13790     ($u3005b)
13791     #IMPLIED>
13792     ]><p/>
13793     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (3, 12)..(3, 13); }
13794     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (4, 11)..(4, 12); }
13795     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (5, 1)..(5, 2); }
13796     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (7, 2)..(7, 3); }
13797     @@XMLTest:
13798     @@@QName: xp.name.attlist.1.1.3.test
13799     @@@DEnt:
13800     @@@@test:value:
13801     <?xml version="1.1"?>
13802     <!DOCTYPE p [
13803     <!NOTATION $u3005b SYSTEM "n">
13804     <!ATTLIST $u3005b
13805     $u3005b
13806     NOTATION
13807     ($u3005b)
13808     #IMPLIED>
13809     ]><p/>
13810     @@@test:domTree:
13811     document {
13812     xml-version: '1.1';
13813     document-type {
13814     notation {
13815     node-name: U+3005 'b';
13816     }
13817     element-type-definition {
13818     node-name: U+3005 'b';
13819     attribute-definition {
13820     node-name: U+3005 'b';
13821     allowed-tokens: DOMStringList (U+3005 'b');
13822     }
13823     }
13824     }
13825     element { }
13826     }
13827     @@XMLTest:
13828     @@@QName: xp.name.attlist.names.1.0.1.test
13829     @@@DEnt:
13830     @@@@test:value:
13831     <?xml version="1.0"?>
13832     <!DOCTYPE p [
13833     <!NOTATION a:b SYSTEM "n">
13834     <!ATTLIST a:b
13835     a:b
13836     NOTATION
13837     (a:b)
13838     #IMPLIED>
13839     ]><p/>
13840     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (3, 12)..(3, 14); }
13841     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (7, 2)..(7, 4); }
13842     @@XMLTest:
13843     @@@QName: xp.name.attlist.names.1.1.1.test
13844     @@@DEnt:
13845     @@@@test:value:
13846     <?xml version="1.1"?>
13847     <!DOCTYPE p [
13848     <!NOTATION a:b SYSTEM "n">
13849     <!ATTLIST a:b
13850     a:b
13851     NOTATION
13852     (a:b)
13853     #IMPLIED>
13854     ]><p/>
13855     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (3, 12)..(3, 14); }
13856     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (7, 2)..(7, 4); }
13857     @@XMLTest:
13858     @@@QName: xp.name.attlist.names.1.0.2.test
13859     @@@DEnt:
13860     @@@@test:value:
13861     <?xml version="1.0"?>
13862     <!DOCTYPE p [
13863     <!NOTATION :ab SYSTEM "n">
13864     <!ATTLIST :ab
13865     :ab
13866     NOTATION
13867     (:ab)
13868     #IMPLIED>
13869     ]><p/>
13870     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (3, 12)..(3, 14); }
13871     @@@c:erred: <[[xp|nswf-legal-qname]]>{ (4, 11)..(4, 13); }
13872     @@@c:erred: <[[xp|nswf-legal-qname]]>{ (5, 1)..(5, 3); }
13873     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (7, 2)..(7, 4); }
13874     @@XMLTest:
13875     @@@QName: xp.name.attlist.names.1.1.2.test
13876     @@@DEnt:
13877     @@@@test:value:
13878     <?xml version="1.1"?>
13879     <!DOCTYPE p [
13880     <!NOTATION :ab SYSTEM "n">
13881     <!ATTLIST :ab
13882     :ab
13883     NOTATION
13884     (:ab)
13885     #IMPLIED>
13886     ]><p/>
13887     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (3, 12)..(3, 14); }
13888     @@@c:erred: <[[xp|nswf-legal-qname]]>{ (4, 11)..(4, 13); }
13889     @@@c:erred: <[[xp|nswf-legal-qname]]>{ (5, 1)..(5, 3); }
13890     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (7, 2)..(7, 4); }
13891     @@XMLTest:
13892     @@@QName: xp.name.gent.1.0.2.test
13893     @@@DEnt:
13894     @@@@test:value:
13895     <?xml version="1.0"?>
13896     <!DOCTYPE p [
13897     <!ENTITY $u3001$u3002 "n">
13898     ]>
13899     <p a="&$u3001$u3002;">
13900     &$u3001$u3002;
13901     </p>
13902     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (3, 10)..(3, 11); }
13903     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (5, 8)..(5, 9); }
13904     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (6, 2)..(6, 3); }
13905     @@XMLTest:
13906     @@@QName: xp.name.ger.1.1.2.test
13907     @@@DEnt:
13908     @@@@test:value:
13909     <?xml version="1.1"?>
13910     <!DOCTYPE p [
13911     <!ENTITY $u3001$u3002 "n">
13912     ]>
13913     <p a="&$u3001$u3002;">$
13914     &$u3001$u3002;$
13915     </p>
13916     @@@test:domTree:
13917     document {
13918     xml-version: '1.1';
13919     document-type {
13920     general-entity {
13921     node-name: U+3001 U+3002;
13922     }
13923     }
13924     element {
13925     attribute {
13926     node-name: 'a';
13927     general-entity-reference {
13928     node-name: U+3001 U+3002;
13929     }
13930     }
13931     general-entity-reference {
13932     node-name: U+3001 U+3002;
13933     }
13934     }
13935     }
13936     @@XMLTest:
13937     @@@QName: xp.name.ger.1.0.3.test
13938     @@@DEnt:
13939     @@@@test:value:
13940     <?xml version="1.0"?>
13941     <!DOCTYPE p [
13942     <!ENTITY $u3005b "n">
13943     ]>
13944     <p a="&$u3005b;">
13945     &$u3005b;
13946     </p>
13947     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (3, 10)..(3, 11); }
13948     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (5, 8)..(5, 9); }
13949     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (6, 2)..(6, 3); }
13950     @@XMLTest:
13951     @@@QName: xp.name.ger.1.1.3.test
13952     @@@DEnt:
13953     @@@@test:value:
13954     <?xml version="1.1"?>
13955     <!DOCTYPE p [
13956     <!ENTITY $u3005b "n">
13957     ]>
13958     <p a="&$u3005b;">$
13959     &$u3005b;$
13960     </p>
13961     @@@test:domTree:
13962     document {
13963     xml-version: '1.1';
13964     document-type {
13965     general-entity {
13966     node-name: U+3005 'b';
13967     }
13968     }
13969     element {
13970     attribute {
13971     node-name: 'a';
13972     general-entity-reference {
13973     node-name: U+3005 'b';
13974     }
13975     }
13976     general-entity-reference {
13977     node-name: U+3005 'b';
13978     }
13979     }
13980     }
13981     @@XMLTest:
13982     @@@QName: xp.name.ger.names.1.0.1.test
13983     @@@DEnt:
13984     @@@@test:value:
13985     <?xml version="1.0"?>
13986     <!DOCTYPE p [
13987     <!ENTITY a:b "n">
13988     ]>
13989     <p a="&a:b;">
13990     &a:b;
13991     </p>
13992     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (3, 10)..(3, 12); }
13993     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (5, 8)..(5, 10); }
13994     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (6, 2)..(6, 4); }
13995     @@XMLTest:
13996     @@@QName: xp.name.ger.names.1.1.1.test
13997     @@@DEnt:
13998     @@@@test:value:
13999     <?xml version="1.1"?>
14000     <!DOCTYPE p [
14001     <!ENTITY a:b "n">
14002     ]>
14003     <p a="&a:b;">
14004     &a:b;
14005     </p>
14006     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (3, 10)..(3, 12); }
14007     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (5, 8)..(5, 10); }
14008     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (6, 2)..(6, 4); }
14009     @@XMLTest:
14010     @@@QName: xp.name.ndata.1.0.2.test
14011     @@@DEnt:
14012     @@@@test:value:
14013     <?xml version="1.0"?>
14014     <!DOCTYPE p [
14015     <!NOTATION $u3001$u3002 SYSTEM "n">
14016     <!ENTITY e SYSTEM "s" NDATA $u3001$u3002>
14017     ]><p/>
14018     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (3, 12)..(3, 13); }
14019     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (4, 29)..(4, 30); }
14020     @@XMLTest:
14021     @@@QName: xp.name.ndata.1.1.2.test
14022     @@@DEnt:
14023     @@@@test:value:
14024     <?xml version="1.1"?>
14025     <!DOCTYPE p [
14026     <!NOTATION $u3001$u3002 SYSTEM "n">
14027     <!ENTITY e SYSTEM "s" NDATA $u3001$u3002>
14028     ]><p/>
14029     @@@test:domTree:
14030     document {
14031     xml-version: '1.1';
14032     document-type {
14033     notation {
14034     node-name: U+3001 U+3002;
14035     }
14036     general-entity {
14037     node-name: 'e';
14038     notation-name: U+3001 U+3002;
14039     }
14040     }
14041     element { }
14042     }
14043     @@XMLTest:
14044     @@@QName: xp.name.ndata.1.0.3.test
14045     @@@DEnt:
14046     @@@@test:value:
14047     <?xml version="1.0"?>
14048     <!DOCTYPE p [
14049     <!NOTATION $u3005b SYSTEM "n">
14050     <!ENTITY e SYSTEM "s" NDATA $u3005b>
14051     ]><p/>
14052     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (3, 12)..(3, 13); }
14053     @@@c:erred: <[[xp|wf-invalid-character-in-node-name]]>{ (4, 29)..(4, 30); }
14054     @@XMLTest:
14055     @@@QName: xp.name.ndata.1.1.3.test
14056     @@@DEnt:
14057     @@@@test:value:
14058     <?xml version="1.1"?>
14059     <!DOCTYPE p [
14060     <!NOTATION $u3005b SYSTEM "n">
14061     <!ENTITY e SYSTEM "s" NDATA $u3005b>
14062     ]><p/>
14063     @@@test:domTree:
14064     document {
14065     xml-version: '1.1';
14066     document-type {
14067     notation {
14068     node-name: U+3005 'b';
14069     }
14070     general-entity {
14071     node-name: 'e';
14072     notation-name: U+3005 'b';
14073     }
14074     }
14075     element { }
14076     }
14077     @@XMLTest:
14078     @@@QName: xp.name.ndata.names.1.0.1.test
14079     @@@DEnt:
14080     @@@@test:value:
14081     <?xml version="1.0"?>
14082     <!DOCTYPE p [
14083     <!NOTATION a:b SYSTEM "n">
14084     <!ENTITY e SYSTEM "s" NDATA a:b>
14085     ]><p/>
14086     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (3, 12)..(3, 14); }
14087     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (4, 29)..(4, 31); }
14088     @@XMLTest:
14089     @@@QName: xp.name.ndata.names.1.1.1.test
14090     @@@DEnt:
14091     @@@@test:value:
14092     <?xml version="1.1"?>
14093     <!DOCTYPE p [
14094     <!NOTATION a:b SYSTEM "n">
14095     <!ENTITY e SYSTEM "s" NDATA a:b>
14096     ]><p/>
14097     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (3, 12)..(3, 14); }
14098     @@@c:erred: <[[xp|nswf-legal-ncname]]>{ (4, 29)..(4, 31); }
14099    
14100     @@enImplNote:
14101     @@@ddid: wf-invalid-character-in-node-name
14102     @@@@:
14103     {ISSUE::
14104     {P:: Tests required for:
14105    
14106     - <CODE::Name> in element type declaration
14107    
14108     - <CODE::Name> in model group
14109    
14110     - <CODE::Name> in parameter entity declaration
14111    
14112     - <CODE::Name> in parameter entity reference
14113    
14114     }
14115     }
14116    
14117     @@XMLTest:
14118     @@@QName: xp.NOTATION.1.test
14119     @@@DEnt:
14120     @@@@test:value:
14121     <!DOCTYPE p [
14122     <!NOTATION n SYSTEM "m">
14123     ]><p/>
14124     @@@test:domTree:
14125     document {
14126     document-type {
14127     notation {
14128     node-name: 'n';
14129     public-id: null;
14130     system-id: 'm';
14131     }
14132     }
14133     element { }
14134     }
14135     @@XMLTest:
14136     @@@QName: xp.NOTATION.2.test
14137     @@@DEnt:
14138     @@@@test:value:
14139     <!DOCTYPE p [
14140     <!NOTATION n PUBLIC "m">
14141     ]><p/>
14142     @@@test:domTree:
14143     document {
14144     document-type {
14145     notation {
14146     node-name: 'n';
14147     system-id: null;
14148     public-id: 'm';
14149     }
14150     }
14151     element { }
14152     }
14153     @@XMLTest:
14154     @@@QName: xp.NOTATION.3.test
14155     @@@DEnt:
14156     @@@@test:value:
14157     <!DOCTYPE p [
14158     <!NOTATION n PUBLIC "m" "l">
14159     ]><p/>
14160     @@@test:domTree:
14161     document {
14162     document-type {
14163     notation {
14164     node-name: 'n';
14165     public-id: 'm';
14166     system-id: 'l';
14167     }
14168     }
14169     element { }
14170     }
14171     @@XMLTest:
14172     @@@QName: xp.NOTATION.4.test
14173     @@@DEnt:
14174     @@@@test:value:
14175     <!DOCTYPE p [
14176     <!NOTATION n SYSTEM "m">
14177     <!NOTATION n SYSTEM "l">
14178     ]><p/>
14179     @@@c:erred: <[[xp|vc-unique-notation-name]]> { (3, 1)..(3, 24); }
14180     @@@test:domTree:
14181     document {
14182     document-type {
14183     notation {
14184     node-name: 'n';
14185     system-id: 'm';
14186     }
14187     }
14188     element { }
14189     }
14190    
14191     @@XMLTest:
14192     @@@QName: xp.names.1.test
14193     @@@DEnt:
14194     @@@@test:value:
14195     <p xmlns="http://1.example/" a="b"/>
14196     @@@test:domTree:
14197     document {
14198     element {
14199     prefix: null;
14200     local-name: 'p';
14201     namespace-uri: 'http://1.example/';
14202     attribute {
14203     prefix: null;
14204     local-name: 'xmlns';
14205     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14206     specified: true;
14207     }
14208     attribute {
14209     prefix: null;
14210     local-name: 'a';
14211     specified: true;
14212     }
14213     }
14214     }
14215     @@XMLTest:
14216     @@@QName: xp.names.2.test
14217     @@@DEnt:
14218     @@@@test:value:
14219     <p xmlns:a="http://1.example/" a="b" a:a="c"/>
14220     @@@test:domTree:
14221     document {
14222     element {
14223     prefix: null;
14224     local-name: 'p';
14225     namespace-uri: null;
14226     attribute {
14227     prefix: 'xmlns';
14228     local-name: 'a';
14229     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14230     specified: true;
14231     }
14232     attribute {
14233     prefix: null;
14234     local-name: 'a';
14235     specified: true;
14236     }
14237     attribute {
14238     prefix: 'a';
14239     local-name: 'a';
14240     namespace-uri: 'http://1.example/';
14241     specified: true;
14242     }
14243     }
14244     }
14245     @@XMLTest:
14246     @@@QName: xp.names.3.test
14247     @@@DEnt:
14248     @@@@test:value:
14249     <a:p xmlns:a="http://1.example/" a="b" a:a="c"/>
14250     @@@test:domTree:
14251     document {
14252     element {
14253     prefix: 'a';
14254     local-name: 'p';
14255     namespace-uri: 'http://1.example/';
14256     attribute {
14257     prefix: 'xmlns';
14258     local-name: 'a';
14259     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14260     specified: true;
14261     }
14262     attribute {
14263     prefix: null;
14264     local-name: 'a';
14265     specified: true;
14266     }
14267     attribute {
14268     prefix: 'a';
14269     local-name: 'a';
14270     namespace-uri: 'http://1.example/';
14271     specified: true;
14272     }
14273     }
14274     }
14275     @@XMLTest:
14276     @@@QName: xp.names.5.test
14277     @@@DEnt:
14278     @@@@test:value:
14279     <p xmlns:a="http://1.example/">$
14280     <a:q/>$
14281     </p>
14282     @@@test:domTree:
14283     document {
14284     element {
14285     prefix: null;
14286     local-name: 'p';
14287     namespace-uri: null;
14288     attribute {
14289     prefix: 'xmlns';
14290     local-name: 'a';
14291     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14292     specified: true;
14293     }
14294     element {
14295     prefix: 'a';
14296     local-name: 'q';
14297     namespace-uri: 'http://1.example/';
14298     }
14299     }
14300     }
14301     @@XMLTest:
14302     @@@QName: xp.names.6.test
14303     @@@DEnt:
14304     @@@@test:value:
14305     <p xmlns:a="http://1.example/">$
14306     <q a:b="c"/>$
14307     </p>
14308     @@@test:domTree:
14309     document {
14310     element {
14311     prefix: null;
14312     local-name: 'p';
14313     namespace-uri: null;
14314     attribute {
14315     prefix: 'xmlns';
14316     local-name: 'a';
14317     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14318     specified: true;
14319     }
14320     element {
14321     prefix: null;
14322     local-name: 'q';
14323     namespace-uri: null;
14324     attribute {
14325     prefix: 'a';
14326     local-name: 'b';
14327     namespace-uri: 'http://1.example/';
14328     specified: true;
14329     }
14330     }
14331     }
14332     }
14333     @@XMLTest:
14334     @@@QName: xp.names.7.test
14335     @@@DEnt:
14336     @@@@test:value:
14337     <p xmlns:a="http://1.example/">$
14338     <q a:b="c" xmlns:a="http://2.example/"/>$
14339     </p>
14340     @@@test:domTree:
14341     document {
14342     element {
14343     prefix: null;
14344     local-name: 'p';
14345     namespace-uri: null;
14346     attribute {
14347     prefix: 'xmlns';
14348     local-name: 'a';
14349     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14350     specified: true;
14351     }
14352     element {
14353     prefix: null;
14354     local-name: 'q';
14355     namespace-uri: null;
14356     attribute {
14357     prefix: 'a';
14358     local-name: 'b';
14359     namespace-uri: 'http://2.example/';
14360     specified: true;
14361     }
14362     attribute {
14363     prefix: 'xmlns';
14364     local-name: 'a';
14365     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14366     specified: true;
14367     }
14368     }
14369     }
14370     }
14371    
14372     @@XMLTest:
14373     @@@QName: xp.names.undeclare.1.test
14374     @@@DEnt:
14375     @@@@test:value:
14376     <p xmlns="http://1.example/">$
14377     <q xmlns="">$
14378     <r xmlns="http://2.example/"/>$
14379     </q>$
14380     </p>
14381     @@@test:domTree:
14382     document {
14383     element {
14384     prefix: null;
14385     local-name: 'p';
14386     namespace-uri: 'http://1.example/';
14387     attribute {
14388     prefix: null;
14389     local-name: 'xmlns';
14390     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14391     specified: true;
14392     }
14393     element {
14394     prefix: null;
14395     local-name: 'q';
14396     namespace-uri: null;
14397     attribute {
14398     prefix: null;
14399     local-name: 'xmlns';
14400     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14401     specified: true;
14402     }
14403     element {
14404     prefix: null;
14405     local-name: 'r';
14406     namespace-uri: 'http://2.example/';
14407     attribute {
14408     prefix: null;
14409     local-name: 'xmlns';
14410     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14411     specified: true;
14412     }
14413     }
14414     }
14415     }
14416     }
14417    
14418     @@XMLTest:
14419     @@@QName: xp.names.undeclare.1.0.1.test
14420     @@@DEnt:
14421     @@@@test:value:
14422     <?xml version="1.0"?>
14423     <a:p xmlns:a="http://1.example/">$
14424     <q xmlns:a="">$
14425     <a:r xmlns:a="http://2.example/"/>$
14426     </q>$
14427     </a:p>
14428     @@@c:erred: <[[xp|nswf-empty-namespace-name]]> { (2, 34)..(2, 47); }
14429     @@XMLTest:
14430     @@@QName: xp.names.undeclare.1.1.1.test
14431     @@@DEnt:
14432     @@@@test:value:
14433     <?xml version="1.1"?>
14434     <a:p xmlns:a="http://1.example/">$
14435     <q xmlns:a="">$
14436     <a:r xmlns:a="http://2.example/"/>$
14437     </q>$
14438     </a:p>
14439     @@@test:domTree:
14440     document {
14441     element {
14442     prefix: 'a';
14443     local-name: 'p';
14444     namespace-uri: 'http://1.example/';
14445     attribute {
14446     prefix: 'xmlns';
14447     local-name: 'a';
14448     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14449     specified: true;
14450     }
14451     element {
14452     prefix: null;
14453     local-name: 'q';
14454     namespace-uri: null;
14455     attribute {
14456     prefix: 'xmlns';
14457     local-name: 'a';
14458     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14459     specified: true;
14460     }
14461     element {
14462     prefix: 'a';
14463     local-name: 'r';
14464     namespace-uri: 'http://2.example/';
14465     attribute {
14466     prefix: 'xmlns';
14467     local-name: 'a';
14468     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14469     specified: true;
14470     }
14471     }
14472     }
14473     }
14474     }
14475     @@XMLTest:
14476     @@@QName: xp.names.undeclare.1.1.2.test
14477     @@@DEnt:
14478     @@@@test:value:
14479     <?xml version="1.1"?>
14480     <a:p xmlns:a="http://1.example/">$
14481     <q xmlns:a="">$
14482     <a:r/>$
14483     </q>$
14484     </a:p>
14485     @@@c:erred: <[[xp|nsc-prefix-declared]]> { (2, 48)..(2, 53); }
14486    
14487     @@XMLTest:
14488     @@@QName: xp.names.xml.prefix.1.test
14489     @@@DEnt:
14490     @@@@test:value:
14491     <a xmlns:xml="http://www.w3.org/XML/1998/namespace"/>
14492     @@@test:domTree:
14493     document {
14494     element {
14495     attribute {
14496     prefix: 'xmlns';
14497     local-name: 'xml';
14498     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14499     }
14500     }
14501     }
14502     @@XMLTest:
14503     @@@QName: xp.names.xml.prefix.2.test
14504     @@@DEnt:
14505     @@@@test:value:
14506     <a xmlns:xml="a"/>
14507     @@@c:erred: <[[xp|nsc-reserved-prefix-xml]]> { (1, 1)..(1, 18); }
14508     @@XMLTest:
14509     @@@QName: xp.names.xml.prefix.3.test
14510     @@@DEnt:
14511     @@@@test:value:
14512     <a xmlns:a="http://www.w3.org/XML/1998/namespace"
14513     />
14514     @@@c:erred: <[[xp|nsc-reserved-namespace-name-xml]]> { (1, 1)..(2, 2); }
14515     @@XMLTest:
14516     @@@QName: xp.names.xml.prefix.4.test
14517     @@@DEnt:
14518     @@@@test:value:
14519     <a xml:lang="ja"/>
14520     @@@test:domTree:
14521     document {
14522     element {
14523     attribute {
14524     prefix: 'xml';
14525     local-name: 'lang';
14526     namespace-uri: 'http://www.w3.org/XML/1998/namespace';
14527     }
14528     }
14529     }
14530    
14531     @@XMLTest:
14532     @@@QName: xp.names.prefix.declared.1.test
14533     @@@DEnt:
14534     @@@@test:value:
14535     <!DOCTYPE a [
14536     <!ATTLIST a
14537     b:c CDATA "d"
14538     >
14539     ]>
14540     <a/>
14541     @@@c:erred: <[[xp|nsc-prefix-declared]]> { (6, 1)..(6, 4); }
14542    
14543     @@XMLTest:
14544     @@@QName: xp.names.xmlns.reserved.1.test
14545     @@@DEnt:
14546     @@@@test:value:
14547     <a xmlns:xmlns="http://www.w3.org/2000/xmlns/"
14548     />
14549     @@@c:erred: <[[xp|nsc-reserved-prefix-xmlns]]> { (1, 1)..(2, 2); }
14550     @@@c:erred: <[[xp|nsc-reserved-namespace-name-xmlns]]> { (1, 1)..(2, 2); }
14551     @@XMLTest:
14552     @@@QName: xp.names.xmlns.reserved.2.test
14553     @@@DEnt:
14554     @@@@test:value:
14555     <a xmlns:xmlns="a"
14556     />
14557     @@@c:erred: <[[xp|nsc-reserved-prefix-xmlns]]> { (1, 1)..(2, 2); }
14558     @@XMLTest:
14559     @@@QName: xp.names.xmlns.reserved.3.test
14560     @@@DEnt:
14561     @@@@test:value:
14562     <a xmlns:a="http://www.w3.org/2000/xmlns/"
14563     />
14564     @@@c:erred: <[[xp|nsc-reserved-namespace-name-xmlns]]> { (1, 1)..(2, 2); }
14565    
14566     @@XMLTest:
14567     @@@QName: xp.names.default.1.test
14568     @@@DEnt:
14569     @@@@test:value:
14570     <!DOCTYPE a [
14571     <!ATTLIST a
14572     xmlns CDATA "http://1.example/">
14573     ]>
14574     <a/>
14575     @@@test:domTree:
14576     document {
14577     document-type {
14578     element-type-definition {
14579     node-name: 'a';
14580     attribute-definition {
14581     node-name: 'xmlns';
14582     node-value: 'http://1.example/';
14583     }
14584     }
14585     }
14586     element {
14587     prefix: null;
14588     local-name: 'a';
14589     namespace-uri: 'http://1.example/';
14590     attribute {
14591     prefix: null;
14592     local-name: 'xmlns';
14593     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14594     value: 'http://1.example/';
14595     specified: false;
14596     }
14597     }
14598     }
14599     @@XMLTest:
14600     @@@QName: xp.names.default.2.test
14601     @@@DEnt:
14602     @@@@test:value:
14603     <!DOCTYPE a [
14604     <!ATTLIST a
14605     xmlns CDATA "http://1.example/">
14606     ]>
14607     <a xmlns="http://2.example/"/>
14608     @@@test:domTree:
14609     document {
14610     document-type {
14611     element-type-definition {
14612     node-name: 'a';
14613     attribute-definition {
14614     node-name: 'xmlns';
14615     node-value: 'http://1.example/';
14616     }
14617     }
14618     }
14619     element {
14620     prefix: null;
14621     local-name: 'a';
14622     namespace-uri: 'http://2.example/';
14623     attribute {
14624     prefix: null;
14625     local-name: 'xmlns';
14626     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14627     value: 'http://2.example/';
14628     specified: true;
14629     }
14630     }
14631     }
14632     @@XMLTest:
14633     @@@QName: xp.names.default.3.test
14634     @@@DEnt:
14635     @@@@test:value:
14636     <!DOCTYPE b:a [
14637     <!ATTLIST b:a
14638     xmlns:b CDATA "http://1.example/">
14639     ]>
14640     <b:a/>
14641     @@@test:domTree:
14642     document {
14643     document-type {
14644     element-type-definition {
14645     node-name: 'b:a';
14646     attribute-definition {
14647     node-name: 'xmlns:b';
14648     node-value: 'http://1.example/';
14649     }
14650     }
14651     }
14652     element {
14653     prefix: 'b';
14654     local-name: 'a';
14655     namespace-uri: 'http://1.example/';
14656     attribute {
14657     prefix: 'xmlns';
14658     local-name: 'b';
14659     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14660     value: 'http://1.example/';
14661     specified: false;
14662     }
14663     }
14664     }
14665     @@XMLTest:
14666     @@@QName: xp.names.default.4.test
14667     @@@DEnt:
14668     @@@@test:value:
14669     <!DOCTYPE b:a [
14670     <!ATTLIST b:a
14671     xmlns:b CDATA "http://1.example/">
14672     ]>
14673     <b:a xmlns:b="http://2.example/"/>
14674     @@@test:domTree:
14675     document {
14676     document-type {
14677     element-type-definition {
14678     node-name: 'b:a';
14679     attribute-definition {
14680     node-name: 'xmlns:b';
14681     node-value: 'http://1.example/';
14682     }
14683     }
14684     }
14685     element {
14686     prefix: 'b';
14687     local-name: 'a';
14688     namespace-uri: 'http://2.example/';
14689     attribute {
14690     prefix: 'xmlns';
14691     local-name: 'b';
14692     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14693     value: 'http://2.example/';
14694     specified: true;
14695     }
14696     }
14697     }
14698     @@XMLTest:
14699     @@@QName: xp.names.default.5.test
14700     @@@DEnt:
14701     @@@@test:value:
14702     <!DOCTYPE a [
14703     <!ATTLIST a
14704     xmlns:b CDATA "http://1.example/"
14705     b:c CDATA "http://1.example/">
14706     ]>
14707     <a xmlns:b="http://2.example/"/>
14708     @@@test:domTree:
14709     document {
14710     document-type {
14711     element-type-definition {
14712     node-name: 'a';
14713     attribute-definition {
14714     node-name: 'xmlns:b';
14715     text-content: 'http://1.example/';
14716     }
14717     attribute-definition {
14718     node-name: 'b:c';
14719     text-content: 'http://1.example/';
14720     }
14721     }
14722     }
14723     element {
14724     prefix: null;
14725     local-name: 'a';
14726     namespace-uri: null;
14727     attribute {
14728     prefix: 'xmlns';
14729     local-name: 'b';
14730     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14731     value: 'http://2.example/';
14732     specified: true;
14733     }
14734     attribute {
14735     prefix: 'b';
14736     local-name: 'c';
14737     namespace-uri: 'http://2.example/';
14738     specified: false;
14739     }
14740     }
14741     }
14742    
14743     @@XMLTest:
14744     @@@QName: xp.names.unique.1.test
14745     @@@DEnt:
14746     @@@@test:value:
14747     <a
14748     xmlns:b="http://2.example/"
14749     xmlns:c="http://2.example/"
14750     b:d=""
14751     c:d=""
14752     />
14753     @@@c:erred: <[[xp|nswf-unique-att-spec-expanded-name]]> { (1, 1)..(6, 2); }
14754     @@XMLTest:
14755     @@@QName: xp.names.unique.2.test
14756     @@@DEnt:
14757     @@@@test:value:
14758     <!DOCTYPE a [
14759     <!ATTLIST a
14760     c:d CDATA ""
14761     >
14762     ]>
14763     <a
14764     xmlns:b="http://2.example/"
14765     xmlns:c="http://2.example/"
14766     b:d=""
14767     />
14768     @@@c:erred: <[[xp|nswf-unique-att-spec-expanded-name]]> { (6, 1)..(10, 2);}
14769     @@XMLTest:
14770     @@@QName: xp.names.unique.3.test
14771     @@@DEnt:
14772     @@@@test:value:
14773     <!DOCTYPE a [
14774     <!ATTLIST a
14775     c:d CDATA "value1"
14776     >
14777     ]>
14778     <a
14779     xmlns:c="http://2.example/"
14780     c:d="value2"
14781     />
14782     @@@test:domTree:
14783     document {
14784     document-type { }
14785     element {
14786     attribute {
14787     prefix: 'xmlns';
14788     local-name: 'c';
14789     namespace-uri: 'http://www.w3.org/2000/xmlns/';
14790     specified: true;
14791     }
14792     attribute {
14793     prefix: 'c';
14794     local-name: 'd';
14795     namespace-uri: 'http://2.example/';
14796     value: 'value2';
14797     specified: true;
14798     }
14799     }
14800     }
14801    
14802     @@XMLTest:
14803     @@@QName: xp.names.normalize.1.test
14804     @@@DEnt:
14805     @@@@test:value:
14806     <!DOCTYPE a [
14807     <!ATTLIST a
14808     xmlns NMTOKEN #IMPLIED
14809     >
14810     ]>
14811     <a xmlns=" "/>
14812     @@@test:domTree:
14813     document {
14814     document-type { }
14815     element {
14816     namespace-uri: null;
14817     prefix: null;
14818     local-name: 'a';
14819     }
14820     }
14821     @@XMLTest:
14822     @@@QName: xp.names.normalize.2.test
14823     @@@DEnt:
14824     @@@@test:value:
14825     <!DOCTYPE a [
14826     <!ATTLIST a
14827     xmlns NMTOKEN #IMPLIED
14828     >
14829     ]>
14830     <a xmlns=" about:blank "/>
14831     @@@test:domTree:
14832     document {
14833     document-type { }
14834     element {
14835     namespace-uri: 'about:blank';
14836     prefix: null;
14837     local-name: 'a';
14838     }
14839     }
14840     @@XMLTest:
14841     @@@QName: xp.names.normalize.3.test
14842     @@@DEnt:
14843     @@@@test:value:
14844     <!DOCTYPE a:a [
14845     <!ATTLIST a:a
14846     xmlns:a NMTOKEN #IMPLIED
14847     >
14848     ]>
14849     <a:a xmlns:a=" about:blank "/>
14850     @@@test:domTree:
14851     document {
14852     document-type { }
14853     element {
14854     namespace-uri: 'about:blank';
14855     prefix: 'a';
14856     local-name: 'a';
14857     }
14858     }
14859    
14860 wakaba 1.29 @@XMLTest:
14861     @@@QName: xp.no.baseuri.test
14862     @@@DEnt:
14863     @@@@test:value:
14864     <p/>
14865     @@@test:domTree:
14866     document {
14867     document-uri: null;
14868     base-uri: null;
14869     element {
14870     node-name: 'p';
14871     base-uri: null;
14872     }
14873     }
14874     @@XMLTest:
14875     @@@QName: xp.docuri.no.baseuri.test
14876     @@@DEnt:
14877     @@@@test:uri:
14878     http://www.example.com/
14879     @@@@test:value:
14880     <p/>
14881     @@@test:domTree:
14882     document {
14883     document-uri: 'http://www.example.com/';
14884     base-uri: 'http://www.example.com/';
14885     element {
14886     node-name: 'p';
14887     base-uri: 'http://www.example.com/';
14888     }
14889     }
14890     @@XMLTest:
14891     @@@QName: xp.docuri.baseuri.test
14892     @@@DEnt:
14893     @@@@test:uri:
14894     http://www.example.com/
14895     @@@@test:baseURI:
14896     ftp://ftp.example.com/
14897     @@@@test:value:
14898     <p/>
14899     @@@test:domTree:
14900     document {
14901     document-uri: 'http://www.example.com/';
14902     base-uri: 'ftp://ftp.example.com/';
14903     element {
14904     node-name: 'p';
14905     base-uri: 'ftp://ftp.example.com/';
14906     }
14907     }
14908     @@XMLTest:
14909     @@@QName: xp.doctype.baseuri.test
14910     @@@DEnt:
14911     @@@@test:uri:
14912     http://www.example.com/
14913     @@@@test:baseURI:
14914     ftp://ftp.example.com/
14915     @@@@test:value:
14916     <!DOCTYPE p SYSTEM "sys">
14917     <p/>
14918     @@@test:domTree:
14919     document {
14920     document-uri: 'http://www.example.com/';
14921     base-uri: 'ftp://ftp.example.com/';
14922     document-type {
14923     system-id: 'sys';
14924     manakai-declaration-base-uri: 'ftp://ftp.example.com/';
14925     }
14926     element {
14927     node-name: 'p';
14928     base-uri: 'ftp://ftp.example.com/';
14929     }
14930     }
14931     @@XMLTest:
14932     @@@QName: xp.entdecl.baseuri.test
14933     @@@DEnt:
14934     @@@@test:uri:
14935     http://www.example.com/
14936     @@@@test:baseURI:
14937     ftp://ftp.example.com/
14938     @@@@test:value:
14939     <!DOCTYPE p [
14940     <!ENTITY ent SYSTEM "ent">
14941     ]>
14942     <p/>
14943     @@@test:domTree:
14944     document {
14945     document-uri: 'http://www.example.com/';
14946     base-uri: 'ftp://ftp.example.com/';
14947     document-type {
14948     general-entity {
14949     node-name: 'ent';
14950     manakai-declaration-base-uri: 'ftp://ftp.example.com/';
14951     }
14952     }
14953     element {
14954     node-name: 'p';
14955     base-uri: 'ftp://ftp.example.com/';
14956     }
14957     }
14958     @@XMLTest:
14959     @@@QName: xp.notdecl.baseuri.test
14960     @@@DEnt:
14961     @@@@test:uri:
14962     http://www.example.com/
14963     @@@@test:baseURI:
14964     ftp://ftp.example.com/
14965     @@@@test:value:
14966     <!DOCTYPE p [
14967     <!NOTATION not SYSTEM "not">
14968     ]>
14969     <p/>
14970     @@@test:domTree:
14971     document {
14972     document-uri: 'http://www.example.com/';
14973     base-uri: 'ftp://ftp.example.com/';
14974     document-type {
14975     notation {
14976     node-name: 'not';
14977     manakai-declaration-base-uri: 'ftp://ftp.example.com/';
14978     }
14979     }
14980     element {
14981     node-name: 'p';
14982     base-uri: 'ftp://ftp.example.com/';
14983     }
14984     }
14985     @@XMLTest:
14986     @@@QName: xp.doctype.intsubset.pi.baseuri.test
14987     @@@DEnt:
14988     @@@@test:uri:
14989     http://www.example.com/
14990     @@@@test:baseURI:
14991     ftp://ftp.example.com/
14992     @@@@test:value:
14993     <!DOCTYPE p [
14994     <?pi?>
14995     ]>
14996     <p/>
14997     @@@test:domTree:
14998     document {
14999     document-uri: 'http://www.example.com/';
15000     base-uri: 'ftp://ftp.example.com/';
15001     document-type {
15002     pi {
15003     node-name: 'pi';
15004     base-uri: 'ftp://ftp.example.com/';
15005     }
15006     }
15007     element {
15008     node-name: 'p';
15009     base-uri: 'ftp://ftp.example.com/';
15010     }
15011     }
15012    
15013 wakaba 1.30 @@XMLTest:
15014     @@@QName: xp.xmlid.attr.test
15015     @@@DEnt:
15016     @@@@test:value:
15017     <p xml:id="idv"/>
15018 wakaba 1.34 @@@cfg:xml-id: 1
15019 wakaba 1.30 @@@test:domTree:
15020     document {
15021     element {
15022     attribute {
15023     node-name: 'xml:id';
15024     value: 'idv';
15025     schema-type-info: TypeInfo ('http://www.w3.org/TR/REC-xml',
15026     'ID');
15027     specified: true;
15028     }
15029     }
15030     }
15031     @@XMLTest:
15032 wakaba 1.34 @@@QName: xp.xmlid.attr.disabled.test
15033     @@@DEnt:
15034     @@@@test:value:
15035     <p xml:id="idv"/>
15036     @@@cfg:xml-id: 0
15037     @@@test:domTree:
15038     document {
15039     element {
15040     attribute {
15041     node-name: 'xml:id';
15042     value: 'idv';
15043     schema-type-info: TypeInfo (null, null);
15044     specified: true;
15045     }
15046     }
15047     }
15048     @@XMLTest:
15049 wakaba 1.30 @@@QName: xp.xmlid.attr.norm.test
15050     @@@DEnt:
15051     @@@@test:value:
15052     <p xml:id=" $u000Aidv "/>
15053 wakaba 1.34 @@@cfg:xml-id: 1
15054 wakaba 1.30 @@@test:domTree:
15055     document {
15056     element {
15057     attribute {
15058     node-name: 'xml:id';
15059     value: 'idv';
15060     schema-type-info: TypeInfo ('http://www.w3.org/TR/REC-xml',
15061     'ID');
15062     specified: true;
15063     }
15064     }
15065     }
15066     @@XMLTest:
15067 wakaba 1.34 @@@QName: xp.xmlid.attr.norm.disabled.test
15068     @@@DEnt:
15069     @@@@test:value:
15070     <p xml:id=" $u000Aidv "/>
15071     @@@cfg:xml-id: 0
15072     @@@test:domTree:
15073     document {
15074     element {
15075     attribute {
15076     node-name: 'xml:id';
15077     value: ' idv ';
15078     schema-type-info: TypeInfo (null, null);
15079     specified: true;
15080     }
15081     }
15082     }
15083     @@XMLTest:
15084 wakaba 1.30 @@@QName: xp.xmlid.attrdef.test
15085     @@@DEnt:
15086     @@@@test:value:
15087     <!DOCTYPE p [
15088     <!ATTLIST p xml:id ID #IMPLIED>
15089     ]>
15090     <p/>
15091 wakaba 1.34 @@@cfg:xml-id: 1
15092     @@@test:domTree:
15093     document {
15094     document-type {
15095     element-type-definition {
15096     node-name: 'p';
15097     attribute-definition {
15098     node-name: 'xml:id';
15099     declared-type: const (ID_ATTR);
15100     default-type: const (IMPLIED_DEFAULT);
15101     }
15102     }
15103     }
15104     element { }
15105     }
15106     @@XMLTest:
15107     @@@QName: xp.xmlid.attrdef.disabled.test
15108     @@@DEnt:
15109     @@@@test:value:
15110     <!DOCTYPE p [
15111     <!ATTLIST p xml:id ID #IMPLIED>
15112     ]>
15113     <p/>
15114     @@@cfg:xml-id: 0
15115 wakaba 1.30 @@@test:domTree:
15116     document {
15117     document-type {
15118     element-type-definition {
15119     node-name: 'p';
15120     attribute-definition {
15121     node-name: 'xml:id';
15122     declared-type: const (ID_ATTR);
15123     default-type: const (IMPLIED_DEFAULT);
15124     }
15125     }
15126     }
15127     element { }
15128     }
15129     @@XMLTest:
15130     @@@QName: xp.xmlid.attrdef.defaultattr.test
15131     @@@DEnt:
15132     @@@@test:value:
15133     <!DOCTYPE p [
15134     <!ATTLIST p xml:id ID "idv"><!-- invalid -->
15135     ]>
15136     <p/>
15137 wakaba 1.34 @@@cfg:xml-id: 1
15138     @@@test:domTree:
15139     document {
15140     document-type {
15141     element-type-definition {
15142     node-name: 'p';
15143     attribute-definition {
15144     node-name: 'xml:id';
15145     declared-type: const (ID_ATTR);
15146     default-type: const (EXPLICIT_DEFAULT);
15147     node-value: 'idv';
15148     }
15149     }
15150     }
15151     element {
15152     attribute {
15153     node-name: 'xml:id';
15154     schema-type-info: TypeInfo ('http://www.w3.org/TR/REC-xml',
15155     'ID');
15156     value: 'idv';
15157     specified: false;
15158     }
15159     }
15160     }
15161     @@XMLTest:
15162     @@@QName: xp.xmlid.attrdef.defaultattr.disabled.test
15163     @@@DEnt:
15164     @@@@test:value:
15165     <!DOCTYPE p [
15166     <!ATTLIST p xml:id ID "idv"><!-- invalid -->
15167     ]>
15168     <p/>
15169     @@@cfg:xml-id: 0
15170 wakaba 1.30 @@@test:domTree:
15171     document {
15172     document-type {
15173     element-type-definition {
15174     node-name: 'p';
15175     attribute-definition {
15176     node-name: 'xml:id';
15177     declared-type: const (ID_ATTR);
15178     default-type: const (EXPLICIT_DEFAULT);
15179     node-value: 'idv';
15180     }
15181     }
15182     }
15183     element {
15184     attribute {
15185     node-name: 'xml:id';
15186     schema-type-info: TypeInfo ('http://www.w3.org/TR/REC-xml',
15187     'ID');
15188     value: 'idv';
15189     specified: false;
15190     }
15191     }
15192     }
15193    
15194 wakaba 1.34 @@XMLTest:
15195     @@@QName: xp.general.entity.unused.1.test
15196     @@@DEnt:
15197     @@@@test:value:
15198     <!DOCTYPE p [
15199     <!ENTITY mylt "<">
15200     ]>
15201     <p/>
15202     @@@cfg:entity-replacement-tree: 0
15203     @@@test:domTree:
15204     document {
15205     document-type {
15206     general-entity {
15207     node-name: 'mylt';
15208     }
15209     }
15210     element { }
15211     }
15212     @@XMLTest:
15213     @@@QName: xp.general.entity.unused.2.test
15214     @@@DEnt:
15215     @@@@test:value:
15216     <!DOCTYPE p [
15217     <!ENTITY mylt "<">
15218     ]>
15219     <p/>
15220     @@@cfg:entity-replacement-tree: 1
15221     @@@c:erred: <[[xp|wf-syntax-error]]> { (1, 1)..(1, 2); }
15222    
15223 wakaba 1.35 @@XMLTest:
15224     @@@QName: xp.dtdecl.readonly.test
15225     @@@DEnt:
15226     @@@@test:value:
15227     <!DOCTYPE p>
15228     <p/>
15229     @@@test:domTree:
15230     document {
15231     document-type {
15232     manakai-read-only: true;
15233     }
15234     element {
15235     manakai-read-only: false;
15236     }
15237     manakai-read-only: false;
15238     }
15239     @@XMLTest:
15240     @@@QName: xp.entity.decl.readonly.1.test
15241     @@@DEnt:
15242     @@@@test:value:
15243     <!DOCTYPE p [
15244     <!ENTITY ent "val">
15245     ]>
15246     <p/>
15247     @@@cfg:entity-replacement-tree: 1
15248     @@@test:domTree:
15249     document {
15250     document-type {
15251     general-entity {
15252     node-name: 'ent';
15253     manakai-read-only: true;
15254     has-replacement-tree: true;
15255     }
15256     manakai-read-only: true;
15257     }
15258     element {
15259     manakai-read-only: false;
15260     }
15261     manakai-read-only: false;
15262     }
15263     @@XMLTest:
15264     @@@QName: xp.entity.decl.readonly.2.test
15265     @@@DEnt:
15266     @@@@test:value:
15267     <!DOCTYPE p [
15268     <!ENTITY ent "val">
15269     ]>
15270     <p/>
15271     @@@test:domTree:
15272     document {
15273     document-type {
15274     general-entity {
15275     node-name: 'ent';
15276     manakai-read-only: true;
15277     }
15278     manakai-read-only: true;
15279     }
15280     element {
15281     manakai-read-only: false;
15282     }
15283     manakai-read-only: false;
15284     }
15285     @@XMLTest:
15286     @@@QName: xp.notation.decl.readonly.test
15287     @@@DEnt:
15288     @@@@test:value:
15289     <!DOCTYPE p [
15290     <!NOTATION ent SYSTEM "val">
15291     ]>
15292     <p/>
15293     @@@test:domTree:
15294     document {
15295     document-type {
15296     notation {
15297     node-name: 'ent';
15298     manakai-read-only: true;
15299     }
15300     manakai-read-only: true;
15301     }
15302     element {
15303     manakai-read-only: false;
15304     }
15305     manakai-read-only: false;
15306     }
15307     @@XMLTest:
15308     @@@QName: xp.dtd.pi.readonly.test
15309     @@@DEnt:
15310     @@@@test:value:
15311     <!DOCTYPE p [
15312     <?pi content?>
15313     ]>
15314     <p/>
15315     @@@test:domTree:
15316     document {
15317     document-type {
15318     pi {
15319     node-name: 'pi';
15320     manakai-read-only: true;
15321     }
15322     manakai-read-only: true;
15323     }
15324     element {
15325     manakai-read-only: false;
15326     }
15327     manakai-read-only: false;
15328     }
15329     @@XMLTest:
15330     @@@QName: xp.dtd.attlist.decl.readonly.test
15331     @@@DEnt:
15332     @@@@test:value:
15333     <!DOCTYPE p [
15334     <!ATTLIST p
15335     attr CDATA #IMPLIED
15336     >
15337     ]>
15338     <p/>
15339     @@@test:domTree:
15340     document {
15341     document-type {
15342     element-type-definition {
15343     node-name: 'p';
15344     attribute-definition {
15345     node-name: 'attr';
15346     manakai-read-only: true;
15347     }
15348     manakai-read-only: true;
15349     }
15350     manakai-read-only: true;
15351     }
15352     element {
15353     manakai-read-only: false;
15354     }
15355     manakai-read-only: false;
15356     }
15357     @@XMLTest:
15358     @@@QName: xp.general.entity.reference.readonly.1.test
15359     @@@DEnt:
15360     @@@@test:value:
15361     <!DOCTYPE p [
15362     <!ENTITY ent "val">
15363     ]>
15364     <p>&ent;</p>
15365     @@@test:domTree:
15366     document {
15367     document-type {
15368     general-entity {
15369     node-name: 'ent';
15370     manakai-read-only: true;
15371     }
15372     manakai-read-only: true;
15373     }
15374     element {
15375     general-entity-reference {
15376     text {
15377     manakai-read-only: true;
15378     }
15379     manakai-read-only: true;
15380     }
15381     manakai-read-only: false;
15382     }
15383     manakai-read-only: false;
15384     }
15385     @@XMLTest:
15386     @@@QName: xp.general.entity.reference.readonly.2.test
15387     @@@DEnt:
15388     @@@@test:value:
15389     <!DOCTYPE p [
15390     <!ENTITY ent "val">
15391     ]>
15392     <p attr="&ent;"/>
15393     @@@test:domTree:
15394     document {
15395     document-type {
15396     general-entity {
15397     node-name: 'ent';
15398     manakai-read-only: true;
15399     }
15400     manakai-read-only: true;
15401     }
15402     element {
15403     attribute {
15404     node-name: 'attr';
15405     general-entity-reference {
15406     text {
15407     manakai-read-only: true;
15408     }
15409     manakai-read-only: true;
15410     }
15411     manakai-read-only: false;
15412     }
15413     manakai-read-only: false;
15414     }
15415     manakai-read-only: false;
15416     }
15417     @@XMLTest:
15418     @@@QName: xp.general.entity.reference.readonly.3.test
15419     @@@DEnt:
15420     @@@@test:value:
15421     <!DOCTYPE p [
15422     <!ENTITY ent1 "val">
15423     <!ENTITY ent2 "&ent1;">
15424     ]>
15425     <p>&ent2;</p>
15426     @@@test:domTree:
15427     document {
15428     document-type {
15429     general-entity {
15430     node-name: 'ent1';
15431     manakai-read-only: true;
15432     }
15433     general-entity {
15434     node-name: 'ent2';
15435     manakai-read-only: true;
15436     }
15437     manakai-read-only: true;
15438     }
15439     element {
15440     general-entity-reference {
15441     general-entity-reference {
15442     text {
15443     manakai-read-only: true;
15444     }
15445     manakai-read-only: true;
15446     }
15447     manakai-read-only: true;
15448     }
15449     manakai-read-only: false;
15450     }
15451     manakai-read-only: false;
15452     }
15453    
15454 wakaba 1.26 @@PerlDef:
15455 wakaba 1.42 my $impl = $Message::DOM::ImplementationRegistry->get_dom_implementation ({
15456 wakaba 1.26 'Core' => '3.0',
15457     'XML' => '3.0',
15458     'XMLVersion' => ['1.0', '1.1'],
15459     });
15460    
15461     for my $test_data (@$TestData) {
15462 wakaba 1.34 my $parser = <Class::ManakaiXMLParser>->new ($impl);
15463    
15464 wakaba 1.26 $test->start_new_test ($test_data->{uri});
15465     my $doc_ent = $test_data->{entity}->{$test_data->{root_uri}};
15466     my $not_ok;
15467    
15468 wakaba 1.34 ## -- DOM Configuration Parameters
15469    
15470     my $pcfg = $parser->dom_config;
15471     for (keys %{$test_data->{dom_config}}) {
15472     $pcfg->set_parameter ($_ => $test_data->{dom_config}->{$_});
15473     }
15474    
15475     $pcfg->set_parameter ('error-handler' => sub ($$) {
15476 wakaba 1.26 my (undef, $err) = @_;
15477     my $err_type = $err->type;
15478     if ($test_data->{dom_error}->{$err_type}) {
15479     $test->assert_error_equals
15480     (actual_value => $err,
15481     expected_hash => shift @{$test_data->{dom_error}
15482     ->{$err_type}});
15483     } else { # Uncatched error
15484     warn $err;
15485     unless ($err->severity == <C::c|DOMError.SEVERITY_WARNING>) {
15486     $test->failure_comment ('Unexpected error |'.$err->type.'|');
15487     $not_ok = true;
15488     }
15489     }
15490     return true; # continue as far as possible
15491     });
15492    
15493 wakaba 1.34 ## -- Input Data
15494    
15495 wakaba 1.27 my $input = {string_data => \$doc_ent->{<Q::test:value>},
15496     system_id => $doc_ent->{<Q::test:uri>},
15497     base_uri => $doc_ent->{<Q::test:baseURI>}};
15498 wakaba 1.34
15499     ## -- Test and Result
15500    
15501 wakaba 1.26 if ($test_data->{dom_tree}) { # Successful test
15502 wakaba 1.31 my $doc;
15503 wakaba 1.26 try {
15504 wakaba 1.31 $doc = $parser->parse ($input);
15505 wakaba 1.26 $test->assert_dom_tree_equals
15506     (actual_value => $doc,
15507     expected_hash => $test_data->{dom_tree});
15508     for (values %{$test_data->{dom_error}||{}}) {
15509     if (@$_) {
15510     $test->failure_comment
15511     (@$_.' |DOMError|s of type |'.
15512     $_->[0]->{type}->{value}.'| are not reported');
15513     $not_ok = true;
15514     }
15515     }
15516     $not_ok ? $test->not_ok : $test->ok;
15517 wakaba 1.31 undef $doc;
15518 wakaba 1.26 } catch Message::Util::IF::DTException with {
15519 wakaba 1.31 require 'manakai/mndebug.pl';
15520     manakai::mndebug::dump ($doc);
15521 wakaba 1.26 } catch Message::DOM::IF::LSException with {
15522     # not_ok
15523     } otherwise {
15524     my $err = shift;
15525     warn $err;
15526     $test->not_ok;
15527     };
15528     } else {
15529 wakaba 1.31 my $doc;
15530 wakaba 1.26 try {
15531 wakaba 1.31 $doc = $parser->parse ($input);
15532 wakaba 1.26 } catch Message::Util::IF::DTException with {
15533 wakaba 1.31 require 'manakai/mndebug.pl';
15534     manakai::mndebug::dump ($doc);
15535 wakaba 1.26 } catch Message::DOM::IF::LSException with {
15536     #
15537     } otherwise {
15538     my $err = shift;
15539     warn $err;
15540     $test->not_ok;
15541     };
15542     for (values %{$test_data->{dom_error}||{}}) {
15543     if (@$_) {
15544     $test->failure_comment
15545     (@$_.' |DOMError|s of type |'.
15546     $_->[0]->{type}->{value}.'| are not reported');
15547     $not_ok = true;
15548     }
15549     }
15550     $not_ok ? $test->not_ok : $test->ok;
15551 wakaba 1.12 }
15552 wakaba 1.5 }
15553 wakaba 1.6
15554 wakaba 1.37 @XMLTests:
15555     @@QName: xp.byteStream.tests
15556    
15557     @@XMLTest:
15558     @@@QName: xp.labeled.utf-8.test
15559     @@@DEnt:
15560     @@@@xp:encoding: utf-8
15561     @@@@test:value:
15562     <p/>
15563     @@@test:domTree:
15564     document {
15565     input-encoding: 'utf-8';
15566     xml-encoding: null;
15567     element {
15568     node-name: 'p';
15569     }
15570     }
15571     @@XMLTest:
15572     @@@QName: xp.labeled.utf-16.be.test
15573     @@@DEnt:
15574     @@@@xp:encoding: utf-16
15575     @@@@test:value:
15576     $u00FE$u00FF$u0000<$u0000p$u0000/$u0000>
15577     @@@test:domTree:
15578     document {
15579     xml-encoding: null;
15580     input-encoding: 'utf-16';
15581     element {
15582     node-name: 'p';
15583     }
15584     }
15585     @@XMLTest:
15586     @@@QName: xp.labeled.utf-16.le.test
15587     @@@DEnt:
15588     @@@@xp:encoding: utf-16
15589     @@@@test:value:
15590     $u00FF$u00FE<$u0000p$u0000/$u0000>$u0000
15591     @@@test:domTree:
15592     document {
15593     xml-encoding: null;
15594     input-encoding: 'utf-16';
15595     element {
15596     node-name: 'p';
15597     }
15598     }
15599     @@XMLTest:
15600     @@@QName: xp.labeled.utf-16.nobom.test
15601     @@@DEnt:
15602     @@@@xp:encoding: utf-16
15603     @@@@test:value:
15604     <$u0000p$u0000/$u0000>$u0000
15605     @@@c:erred: <[[xp|fatal-utf-16-no-bom]]> {}
15606     @@XMLTest:
15607     @@@QName: xp.labeled.unknown.test
15608     @@@DEnt:
15609     @@@@xp:encoding: x-unknown-encoding-name
15610     @@@@test:value:
15611     <p/>
15612     @@@c:erred: <[[xp|fatal-unprocessable-encoding]]> {}
15613     @@XMLTest:
15614     @@@QName: xp.unlabeled.encdecl.unknown.test
15615     @@@DEnt:
15616     @@@@test:value:
15617     <?xml version="1.0" encoding="x-unknown-encoding-name"?>
15618     <p/>
15619     # @@@c:erred: <[[xp|fatal-unprocessable-encoding]]> {}
15620     @@@c:erred: <[[xp|fatal-encoding-mismatch]]> {}
15621     @@XMLTest:
15622     @@@QName: xp.labeled.utf-8.illegal.test
15623     @@@DEnt:
15624     @@@@xp:encoding: utf-8
15625     @@@@test:value:
15626     <p/$u00A0>
15627     @@@c:erred: <[[xp|fatal-illegal-byte-sequence]]> {}
15628     @@XMLTest:
15629     @@@QName: xp.unlabeled.encdecl.utf-8.illegal.test
15630     @@@DEnt:
15631     @@@@test:value:
15632     <?xml version="1.0" encoding="utf-8"?>
15633     <p/$u00A0>
15634     @@@c:erred: <[[xp|fatal-illegal-byte-sequence]]> {}
15635     @@XMLTest:
15636     @@@QName: xp.unlabeled.utf-8.illegal.test
15637     @@@DEnt:
15638     @@@@test:value:
15639     <p/$u00A0>
15640     @@@c:erred: <[[xp|fatal-illegal-byte-sequence]]> {}
15641     @@XMLTest:
15642     @@@QName: xp.mismatch.encdecl-as-utf-16.utf-8.test
15643     @@@DEnt:
15644     @@@@test:value:
15645     <?xml version="1.0" encoding="utf-16"?>
15646     <p/>
15647     @@@c:erred: <[[xp|fatal-encoding-mismatch]]> {}
15648     @@XMLTest:
15649     @@@QName: xp.mismatch.labeled-as-utf-16.utf-8.test
15650     @@@DEnt:
15651     @@@@xp:encoding: utf-16
15652     @@@@test:value:
15653     <p/>
15654     @@@c:erred: <[[xp|fatal-utf-16-no-bom]]> {}
15655     @@XMLTest:
15656     @@@QName: xp.labeled-as-utf-8.encdecl-utf-16.test
15657     @@@DEnt:
15658     @@@@xp:encoding: utf-8
15659     @@@@test:value:
15660     <?xml version="1.0" encoding="utf-16"?>
15661     <p/>
15662     @@@test:domTree:
15663     document {
15664     xml-encoding: 'utf-16';
15665     input-encoding: 'utf-8';
15666     element { }
15667     }
15668    
15669     @@PerlDef:
15670 wakaba 1.42 my $impl = $Message::DOM::ImplementationRegistry->get_dom_implementation ({
15671 wakaba 1.37 'Core' => '3.0',
15672     'XML' => '3.0',
15673     'XMLVersion' => ['1.0', '1.1'],
15674     });
15675    
15676     for my $test_data (@$TestData) {
15677     my $parser = <Class::ManakaiXMLParser>->new ($impl);
15678    
15679     $test->start_new_test ($test_data->{uri});
15680     my $doc_ent = $test_data->{entity}->{$test_data->{root_uri}};
15681     my $not_ok;
15682    
15683     ## -- DOM Configuration Parameters
15684    
15685     my $pcfg = $parser->dom_config;
15686     for (keys %{$test_data->{dom_config}}) {
15687     $pcfg->set_parameter ($_ => $test_data->{dom_config}->{$_});
15688     }
15689    
15690     $pcfg->set_parameter ('error-handler' => sub ($$) {
15691     my (undef, $err) = @_;
15692     my $err_type = $err->type;
15693     if ($test_data->{dom_error}->{$err_type}) {
15694     $test->assert_error_equals
15695     (actual_value => $err,
15696     expected_hash => shift @{$test_data->{dom_error}
15697     ->{$err_type}});
15698     } else { # Uncatched error
15699     warn $err;
15700     unless ($err->severity == <C::c|DOMError.SEVERITY_WARNING>) {
15701     $test->failure_comment ('Unexpected error |'.$err->type.'|');
15702     $not_ok = true;
15703     }
15704     }
15705     return false;
15706     });
15707    
15708     ## -- Input Data
15709    
15710     open my $byte, '<', \$doc_ent->{<Q::test|value>};
15711     my $input = {byte_stream => $byte,
15712     system_id => $doc_ent->{<Q::test:uri>},
15713     base_uri => $doc_ent->{<Q::test:baseURI>},
15714     encoding => $doc_ent->{<Q::xp|encoding>}};
15715    
15716     ## -- Test and Result
15717    
15718     if ($test_data->{dom_tree}) { # Successful test
15719     my $doc;
15720     try {
15721     $doc = $parser->parse ($input);
15722     $test->assert_dom_tree_equals
15723     (actual_value => $doc,
15724     expected_hash => $test_data->{dom_tree});
15725     for (values %{$test_data->{dom_error}||{}}) {
15726     if (@$_) {
15727     $test->failure_comment
15728     (@$_.' |DOMError|s of type |'.
15729     $_->[0]->{type}->{value}.'| are not reported');
15730     $not_ok = true;
15731     }
15732     }
15733     $not_ok ? $test->not_ok : $test->ok;
15734     undef $doc;
15735     } catch Message::Util::IF::DTException with {
15736     require 'manakai/mndebug.pl';
15737     manakai::mndebug::dump ($doc);
15738     } catch Message::DOM::IF::LSException with {
15739     # not_ok
15740     } otherwise {
15741     my $err = shift;
15742     warn $err;
15743     $test->not_ok;
15744     };
15745     } else {
15746     my $doc;
15747     try {
15748     $doc = $parser->parse ($input);
15749     } catch Message::Util::IF::DTException with {
15750     require 'manakai/mndebug.pl';
15751     manakai::mndebug::dump ($doc);
15752     } catch Message::DOM::IF::LSException with {
15753     #
15754     } otherwise {
15755     my $err = shift;
15756     warn $err;
15757     $test->not_ok;
15758     };
15759     for (values %{$test_data->{dom_error}||{}}) {
15760     if (@$_) {
15761     $test->failure_comment
15762     (@$_.' |DOMError|s of type |'.
15763     $_->[0]->{type}->{value}.'| are not reported');
15764     $not_ok = true;
15765     }
15766     }
15767     $not_ok ? $test->not_ok : $test->ok;
15768     }
15769     }
15770    
15771    
15772 wakaba 1.6 @ResourceDef:
15773 wakaba 1.19 @@QName: getEmptyEntityState
15774     @@rdf:type: DISPerl|InlineCode
15775     @@ForCheck: ManakaiDOM|ForClass
15776     @@PerlDef:
15777     {reptxt => \'', line => 1, column => 1, pos => 0,
15778 wakaba 1.27 is_externally_declared => true, name => $name,
15779     fh => do {
15780     open my $empty, '<', \'';
15781     $empty;
15782     },
15783     close_file => sub { }}
15784 wakaba 1.19
15785     @ResourceDef:
15786 wakaba 1.6 @@QName: getCopyOfEntityState
15787     @@rdf:type: DISPerl|InlineCode
15788     @@ForCheck: ManakaiDOM|ForClass
15789     @@PerlDef:
15790     {%{$self->{$entity_type}->{$entity_name}},
15791 wakaba 1.27 line => 1, column => 1, pos => 0,
15792     fh => do {
15793     require IO::String;
15794     IO::String->new
15795     (${$self->{$entity_type}->{$entity_name}->{reptxt}});
15796     ## TODO: External entities.
15797     },
15798     close_file => sub { }}
15799 wakaba 1.1 ##ManakaiXMLParser
15800 wakaba 1.5
15801     ElementTypeBinding:
15802 wakaba 1.27 @Name: Test
15803     @ElementType:
15804     dis:ResourceDef
15805     @ShadowContent:
15806     @@ForCheck: ManakaiDOM|ForClass
15807     @@rdf:type: test|StandaloneTest
15808    
15809     ElementTypeBinding:
15810 wakaba 1.5 @Name: XMLTests
15811     @ElementType:
15812     dis:ResourceDef
15813     @ShadowContent:
15814     @@ForCheck: ManakaiDOM|ForClass
15815     @@rdf:type: test|ParserTestSet
15816    
15817     ElementTypeBinding:
15818     @Name: XMLTest
15819     @ElementType:
15820     dis:ResourceDef
15821     @ShadowContent:
15822     @@ForCheck: ManakaiDOM|ForClass
15823     @@rdf:type: test|ParserTest
15824    
15825     ElementTypeBinding:
15826     @Name: DEnt
15827     @ElementType:
15828     dis:ResourceDef
15829     @ShadowContent:
15830     @@rdf:type: test|RootEntity
15831    
15832     ElementTypeBinding:
15833     @Name: Ent
15834     @ElementType:
15835     dis:ResourceDef
15836     @ShadowContent:
15837     @@rdf:type: test|Entity
15838 wakaba 1.1
15839 wakaba 1.3 ResourceDef:
15840     @QName: xp|get-location-from-token
15841     @rdf:type: DISPerl|BlockCode
15842     @enDesc:
15843     Creates a <IF::DOMCore:DOMLocator> object from a token.
15844     @PerlDef:
15845 wakaba 1.14 my $__d = $token->{type} ne '#EOF'
15846     ? $token->{location}->{char_d}
15847     : 0;
15848 wakaba 1.15 $__d -= $token->{location_d} if $token->{location_d};
15849 wakaba 1.3 $result = {
15850 wakaba 1.14 utf32_offset => $token->{location}->{pos} - $__d,
15851     line_number => $token->{location}->{line},
15852     column_number => $token->{location}->{column} - $__d,
15853 wakaba 1.3 };
15854 wakaba 1.14 $result->{utf32_offset} = 0 if $result->{utf32_offset} < 0;
15855     $result->{column_number} = 0 if $result->{column_number} < 0;
15856     ## 0 or 1, which should be?
15857 wakaba 1.1
15858     ElementTypeBinding:
15859     @Name: RuleDef
15860     @ElementType:
15861     dis:ResourceDef
15862     @ShadowContent:
15863     @@ForCheck: ManakaiDOM|ForClass
15864     @@rdf:type: Muf2003|RuleDefClass
15865    
15866     ElementTypeBinding:
15867     @Name: RuleParam
15868     @ElementType:
15869     dis:ResourceDef
15870     @ShadowContent:
15871     @@rdf:type: Muf2003|RuleParameter
15872    
15873     ElementTypeBinding:
15874     @Name: enImplNote
15875     @ElementType:
15876     dis:ImplNote
15877     @ShadowContent:
15878     @@lang:en
15879    
15880     ElementTypeBinding:
15881 wakaba 1.24 @Name: WFErrDef
15882 wakaba 1.1 @ElementType:
15883     dis:ResourceDef
15884     @ShadowContent:
15885     @@rdf:type: DOMCore|DOMErrorType
15886     @@ecore:textFormatter: ManakaiXMLParserExceptionFormatter
15887 wakaba 1.24 @@c:severity: c|SEVERITY_FATAL_ERROR
15888 wakaba 1.1
15889 wakaba 1.3 ElementTypeBinding:
15890 wakaba 1.24 @Name: FatalErrDef
15891 wakaba 1.3 @ElementType:
15892     dis:ResourceDef
15893     @ShadowContent:
15894     @@rdf:type: DOMCore|DOMErrorType
15895     @@ecore:textFormatter: ManakaiXMLParserExceptionFormatter
15896 wakaba 1.24 @@c:severity: c|SEVERITY_FATAL_ERROR
15897    
15898     ElementTypeBinding:
15899 wakaba 1.26 @Name: NSFatalErrDef
15900     @ElementType:
15901     dis:ResourceDef
15902     @ShadowContent:
15903     @@rdf:type: c|DOMErrorType
15904     @@ecore:textFormatter: ManakaiXMLParserExceptionFormatter
15905     @@c:severity: c|SEVERITY_FATAL_ERROR
15906    
15907     ElementTypeBinding:
15908     @Name: NSCErrDef
15909     @ElementType:
15910     dis:ResourceDef
15911     @ShadowContent:
15912     @@rdf:type: c|DOMErrorType
15913     @@ecore:textFormatter: ManakaiXMLParserExceptionFormatter
15914     @@c:severity: c|SEVERITY_FATAL_ERROR
15915    
15916     ElementTypeBinding:
15917 wakaba 1.24 @Name: VCErrDef
15918     @ElementType:
15919     dis:ResourceDef
15920     @ShadowContent:
15921     @@rdf:type: c|DOMErrorType
15922     @@ecore:textFormatter: ManakaiXMLParserExceptionFormatter
15923     @@c:severity: c|SEVERITY_ERROR
15924    
15925     ElementTypeBinding:
15926     @Name: ErrDef
15927     @ElementType:
15928     dis:ResourceDef
15929     @ShadowContent:
15930     @@rdf:type: c|DOMErrorType
15931     @@ecore:textFormatter: ManakaiXMLParserExceptionFormatter
15932     @@c:severity: c|SEVERITY_ERROR
15933 wakaba 1.3
15934 wakaba 1.16 ElementTypeBinding:
15935 wakaba 1.24 @Name: WarnDef
15936 wakaba 1.16 @ElementType:
15937     dis:ResourceDef
15938     @ShadowContent:
15939 wakaba 1.24 @@rdf:type: c|DOMErrorType
15940 wakaba 1.16 @@ecore:textFormatter: ManakaiXMLParserExceptionFormatter
15941 wakaba 1.24 @@c:severity: c|SEVERITY_WARNING
15942 wakaba 1.16
15943 wakaba 1.3 WFErrDef:
15944     @QName: xp|wf-syntax-error
15945     @enDesc:
15946     The entity does not match to the production rule; it is not
15947     well-formed.
15948     @enMufDef:
15949     |%xp-error-token-type;|%xp-error-token-value
15950     (prefix => { (|}, suffix => {|)}); is not
15951     allowed%xp-error-lines (prefix => { (|}, suffix => {|)});
15952     @ecore:hasParameter:
15953     @@@: xp|error-token
15954     @@enDesc:
15955     The token that is not allowed.
15956    
15957     WFErrDef:
15958     @QName: xp|wf-pi-target-is-xml
15959     @enDesc:
15960     A processing instruction has its <CODE::PITarget> of
15961     <XML::xml> (in any case) which is not allowed.
15962     @enMufDef:
15963     Processing instruction target name cannot be |%p
15964     (name => {<Q::xp|name>});|
15965     @ecore:hasParameter:
15966     @@@: xp|error-token
15967     @@enDesc:
15968     The token that contains the name.
15969     @ecore:hasParameter:
15970     @@@: xp|name
15971     @@enDesc:
15972     A string that is specified as target name of the
15973     processing instruction.
15974     @ecore:hasParameter: xp|parent
15975    
15976     WFErrDef:
15977     @QName: xp|wf-no-end-tag
15978     @enDesc:
15979     An end-tag is not found.
15980     @enMufDef:
15981     End-tag |</%p (name => {<Q::xp|expected-element-type>});>| is required
15982     @ecore:hasParameter: xp|error-token
15983     @ecore:hasParameter:
15984     @@@: xp|node
15985     @@enDesc:
15986     The element node that is not closed.
15987     @ecore:hasParameter:
15988     @@@: xp|expected-element-type
15989     @@enDesc:
15990     The element type name of the element that is not closed.
15991    
15992     WFErrDef:
15993     @QName: xp|wf-unsupported-xml-version
15994     @enDesc:
15995     The XML version specified in the version declaration is not supported.
15996     @enMufDef:
15997     XML version |%p (name => {<Q::infoset|version>});| is not supported
15998     @ecore:hasParameter: xp|bad-token
15999     @ecore:hasParameter:
16000     @@@: xp|parent
16001     @@enDesc:
16002     The document node.
16003     @ecore:hasParameter:
16004     @@@: infoset|version
16005     @@enDesc:
16006     The specified XML version.
16007    
16008     WFErrDef:
16009     @QName: xp|wf-malformed-enc-name
16010     @enDesc:
16011     An <XA::encoding> pseudo-attribute value does not match
16012     to the procduction rule <CODE::EncName>.
16013     @enMufDef:
16014     Encoding name |%p (name => {<Q::xp|name>});| is not allowed
16015     @ecore:hasParameter: xp|error-token
16016     @ecore:hasParameter:
16017     @@@: xp|parent
16018     @@enDesc: The document node.
16019     @ecore:hasParameter:
16020     @@@: xp|name
16021     @@enDesc:
16022     The <XA::encoding> value.
16023    
16024     WFErrDef:
16025     @QName: xp|wf-malformed-xml-standalone
16026     @enDesc:
16027     An <XA::standalone> pseudo-attribute value is neither <XML::yes>
16028     or <XML::no>.
16029     @enMufDef:
16030     |standalone| pseudo-attribute value |%p (name => {<Q::xp|name>});|
16031     is not allowed
16032     @ecore:hasParameter: xp|error-token
16033     @ecore:hasParameter:
16034     @@@: xp|parent
16035     @@enDesc: The document node.
16036     @ecore:hasParameter:
16037     @@@: xp|name
16038     @@enDesc:
16039     The <XA::standalone> value.
16040    
16041     WFErrDef:
16042     @QName: xp|wf-legal-literal-character
16043     @enDesc:
16044     Each character in XML entity must match to the production
16045     rule <CODE::Char - RestrictedChar>.
16046     @enMufDef:
16047     Character %character-code-point
16048     (v => {<Q::xp|character-number>}); is not allowed
16049     @ecore:hasParameter:
16050     @@@: xp|character-number
16051     @@enDesc:
16052     The code position of the character being referred.
16053    
16054     WFErrDef:
16055 wakaba 1.26 @QName: xp|wf-invalid-character-in-node-name
16056     @c:errorType:
16057     @@@: wf-invalid-character-in-node-name
16058     @@ContentType: DISCore|String
16059     @enDesc:
16060     If a name contains a character that is not a name character
16061     in the XML version in use, or if the first character of a name
16062     is not a name start character in the XML version in use.
16063    
16064     {NOTE::
16065     When an invalid character is encountered in an entity
16066     where a <CODE::Name> is expected, what type of error
16067     is issued is implementation dependent: <Q::xp|wf-syntax-error>,
16068     <Q::xp|wf-pi-target-is-xml> or other error might be reported.
16069     }
16070    
16071     {NOTE::
16072     This error type is defined in DOM Level 3 Core and Load and Save
16073     modules and redefined herein for the purpose of XML parser.
16074     }
16075     @enMufDef:
16076     Character %character-code-point
16077     (v => {<Q::xp|character-number>}); is not allowed in name
16078     @ecore:hasParameter: xp|error-token
16079     @ecore:hasParameter:
16080     @@@: xp|character-number
16081     @@enDesc:
16082     The code position of the character being referred.
16083     @ecore:hasParameter:
16084     @@@: infoset|version
16085     @@enDesc:
16086     The version of XML in use.
16087    
16088     WFErrDef:
16089 wakaba 1.25 @QName: xp|wf-pes-in-internal-subset
16090     @enDesc:
16091     In the internal subset of the DTD, parameter entity references
16092     <kwd:MUST-NOT> occur within markup declarations.
16093     @enMufDef:
16094     Parameter entity reference |%percent;%param (name => {<Q::xp|name>});;|
16095     cannot occur within a markup declaration
16096     @ecore:hasParameter: xp|error-token
16097     @ecore:hasParameter:
16098     @@@: xp|name
16099     @@enDesc:
16100     The name of the parameter entity.
16101    
16102     WFErrDef:
16103 wakaba 1.3 @QName: xp|wf-element-type-match
16104 wakaba 1.1 @enDesc:
16105 wakaba 1.3 The <CODE::Name> in an element's end-tag must match the element type
16106     in the start-tag.
16107     @enMufDef:
16108     End-tag |</%p (name => {<Q::xp|actual-element-type>});>| does
16109     not match to start-tag |<%p (name => {<Q::xp|expected-element-type>});>|
16110     @ecore:hasParameter: xp|error-token
16111     @ecore:hasParameter:
16112     @@@: xp|node
16113     @@enDesc:
16114     The current opening element node.
16115     @ecore:hasParameter:
16116     @@@: xp|expected-element-type
16117     @@enDesc:
16118     The element type name of the current element.
16119     @ecore:hasParameter:
16120     @@@: xp|actual-element-type
16121     @@enDesc:
16122     The <CODE::Name> occurs in the end-tag.
16123    
16124     WFErrDef:
16125     @QName: xp|wf-unique-att-spec
16126     @enDesc:
16127     An attribute name <kwd:MUST-NOT> appear more than once in
16128     the same start-tag or empty-element tag.
16129 wakaba 1.1 @enMufDef:
16130 wakaba 1.3 Attribute |%p (name => {<Q::xp|name>});| is specified more
16131     than once in the same tag
16132     @ecore:hasParameter: xp|error-token
16133     @ecore:hasParameter:
16134     @@@: xp|name
16135     @@enDesc:
16136     The name of the attribute.
16137 wakaba 1.18
16138     WFErrDef:
16139     @QName: xp|wf-no-external-entity-references
16140     @enDesc:
16141     Attribute values <kwd:MUST-NOT> contain direct or indirect
16142     entity references to external entities.
16143     @enMufDef:
16144     External entity |%p (name => {<Q::xp|name>});| is referenced
16145     in an attribute value literal
16146     @ecore:hasParameter: xp|error-token
16147     @ecore:hasParameter:
16148     @@@: xp|name
16149     @@enDesc:
16150     The name of the entity.
16151    
16152     WFErrDef:
16153     @QName: xp|wf-no-lt-in-attribute-values
16154     @enDesc:
16155     The replacement text of any entity referred to directly or indirectly
16156     in an attribute value literal <kwd:MUST-NOT> contain a
16157     <CHAR::LESS-THAN SIGN>.
16158     @enMufDef:
16159     Entity replacement text cannot contain a
16160     |LESS-THAN SIGN| since it is referenced from an attribute
16161     value literal
16162     @ecore:hasParameter: xp|error-token
16163 wakaba 1.3
16164 wakaba 1.25 WarnDef:
16165     @QName: xp|warning-attribute-definition-ignored
16166     @enDesc:
16167     An attribute definition is ignored because the same attribute
16168     is declared before.
16169     @enMufDef:
16170     Attribute definition for |%p (name => {<Q::xp|name>});| is ignored
16171     @ecore:hasParameter: xp|error-token
16172     @ecore:hasParameter:
16173     @@@: xp|name
16174     @@enDesc:
16175     The name of the attribute.
16176    
16177 wakaba 1.3 WFErrDef:
16178     @QName: xp|wf-legal-character
16179     @enDesc:
16180     Characters referred to using character references <kwd:MUST>
16181     match the production for <CODE::Char>.
16182     @enMufDef:
16183     Reference to character %character-code-point
16184     (v => {<Q::xp|character-number>}); is not allowed
16185     @ecore:hasParameter: xp|error-token
16186     @ecore:hasParameter:
16187     @@@: xp|character-number
16188     @@enDesc:
16189     The code position of the character being referred.
16190     @ecore:hasParameter:
16191     @@@: xp|parent
16192     @@enDesc:
16193     The parent node in which the character reference has
16194     occurred, if available.
16195 wakaba 1.19
16196     WFErrDef:
16197     @QName: xp|wf-entity-declared
16198     @enDesc:
16199     {P:: In a document
16200    
16201     - without any DTD,
16202    
16203     - with only an internal DTD subset that contains no parameter
16204     entity references, or
16205    
16206     - with <XML::standalone="yes">,
16207    
16208     for an entity reference that does not occur within the external
16209     subset or a parameter entity, the <CODE::Name> given in the
16210     entity reference <kwd:MUST> match the <CODE::Name> does not
16211     occur within the external subset or a parameter entity,
16212     except that five predefined character entities need not
16213     be declared. The declaration of a general entity <kwd:MUST>
16214     precede any reference to it which appears in a default value
16215     in an attribute list declaration.
16216     @enMufDef:
16217     Entity |%p (name => {<Q::xp|name>});| must be declared
16218     in the internal subset
16219 wakaba 1.23 @ecore:hasParameter: xp|error-token
16220     @ecore:hasParameter:
16221     @@@: xp|name
16222     @@enDesc:
16223     The name of the entity.
16224    
16225     WFErrDef:
16226     @QName: xp|wf-parsed-entity
16227     @enDesc:
16228     An entity reference <kwd:MUST-NOT> contain the name of an
16229     unparsed entity.
16230     @enMufDef:
16231     Entity |%p (name => {<Q::xp|name>});| is an unparsed entity
16232     @ecore:hasParameter: xp|error-token
16233     @ecore:hasParameter:
16234     @@@: xp|name
16235     @@enDesc:
16236     The name of the entity.
16237    
16238     WFErrDef:
16239     @QName: xp|wf-no-recursion
16240     @enDesc:
16241     A parsed entity <kwd:MUST-NOT> contain a recursive reference
16242     to itself, either directly or indirectly.
16243     @enMufDef:
16244     Entity |%p (name => {<Q::xp|name>});| is recursively referenced
16245 wakaba 1.19 @ecore:hasParameter: xp|error-token
16246     @ecore:hasParameter:
16247     @@@: xp|name
16248     @@enDesc:
16249     The name of the entity.
16250 wakaba 1.16
16251     FatalErrDef:
16252     @QName: xp|fatal-xml11-end-of-line-in-xml-declaration
16253     @enDesc:
16254     An end-of-line character <CODE::U+0085> or <CODE::U+2028> is appeared
16255     within an XML declaration or text declaration.
16256     @enMufDef:
16257     End-of-line character %character-code-point
16258     (v => {<Q::xp|character-number>}); cannot be used within the
16259     XML or text declaration
16260     @ecore:hasParameter:
16261     @@@: xp|character-number
16262     @@enDesc:
16263     The code position of the end-of-line character.
16264 wakaba 1.24
16265     ErrDef:
16266     @QName: xp|error-internal-predefined-entity
16267     @enDesc:
16268     A general entity declaration whose <CODE::Name> equals to one
16269     of predefined entities <kwd:MUST> declare it as an internal entity.
16270     @enMufDef:
16271     Entity |%p (name => {<Q::xp|name>});| must be declared as an
16272     internal entity
16273     @ecore:hasParameter: xp|error-token
16274     @ecore:hasParameter:
16275     @@@: xp|name
16276     @@enDesc:
16277     The name of the entity.
16278    
16279     ErrDef:
16280     @QName: xp|error-malformed-predefined-entity
16281     @enDesc:
16282     A general entity declaration whose <CODE::Name> equals to one
16283     of predefined entities <kwd:MUST> declare it as a data
16284     character for the entity.
16285     @enMufDef:
16286     Entity declaration for |%p (name => {<Q::xp|name>});|
16287     (replacement text |%p (name => {<Q::xp|replacement-text>});|) is malformed
16288     @ecore:hasParameter: xp|error-token
16289     @ecore:hasParameter:
16290     @@@: xp|name
16291     @@enDesc:
16292     The name of the entity.
16293     @ecore:hasParameter:
16294     @@@: xp|replacement-text
16295     @@enDesc:
16296     The replacement text of the entity declaration.
16297    
16298     WarnDef:
16299     @QName: xp|warning-entity-declaration-ignored
16300     @enDesc:
16301     An entity declaration is ignored because the same entity
16302     is declared before.
16303     @enMufDef:
16304     Entity declaration for |%p (name => {<Q::xp|name>});| is ignored
16305     @ecore:hasParameter: xp|error-token
16306     @ecore:hasParameter:
16307     @@@: xp|name
16308     @@enDesc:
16309     The name of the entity.
16310    
16311     VCErrDef:
16312     @QName: xp|vc-unique-notation-name
16313     @enDesc:
16314     A <CODE::Name> <kwd:MUST-NOT> be declared in more than
16315     one notation declaration.
16316     @enMufDef:
16317     Notation |%p (name => {<Q::xp|name>});| is already declared
16318     @ecore:hasParameter: xp|error-token
16319     @ecore:hasParameter:
16320     @@@: xp|name
16321     @@enDesc:
16322     The name of the notation.
16323 wakaba 1.25
16324     WarnDef:
16325     @QName: xp|warning-entity-declaration-not-processed
16326     @enDesc:
16327     An entity declaration is not processed because there
16328     is a reference to parameter entity before the declaration
16329     and the entity is not read.
16330     @enMufDef:
16331     Entity declaration for |%p (name => {<Q::xp|name>});| is not processed
16332     @ecore:hasParameter: xp|error-token
16333     @ecore:hasParameter:
16334     @@@: xp|name
16335     @@enDesc:
16336     The name of the entity.
16337    
16338     WarnDef:
16339     @QName: xp|warning-attribute-definition-not-processed
16340     @enDesc:
16341     An attribute definition is not processed because there
16342     is a reference to parameter entity before the declaration
16343     and the entity is not read.
16344     @enMufDef:
16345     Attribute definition for |%p (name => {<Q::xp|name>});| is not processed
16346     @ecore:hasParameter: xp|error-token
16347     @ecore:hasParameter:
16348     @@@: xp|name
16349     @@enDesc:
16350     The name of the attribute.
16351 wakaba 1.26
16352 wakaba 1.37 FatalErrDef:
16353     @QName: xp|fatal-illegal-byte-sequence
16354     @enDesc:
16355     An XML entity is determined to be in a certain encoding but
16356     contains byte sequences that are not legal in that encoding.
16357     @enMufDef:
16358     Illegal byte sequence
16359     @enImplNote: dump
16360     @ecore:hasParameter: xp|byte-sequence
16361     @ecore:hasParameter: xp|code-state
16362    
16363     XWParam:
16364     @QName: xp|byte-sequence
16365     @enDesc:
16366     A reference to the byte string that contains an error.
16367    
16368     XWParam:
16369     @QName: xp|code-state
16370     @enDesc:
16371     A string that identifies the state defined in the coded character set
16372     in which an error is encoutnered.
16373    
16374     WarnDef:
16375     @QName: xp|warning-unassigned-code-point
16376     @enDesc:
16377     If the entity contains an unassigned code point.
16378     @enMufDef:
16379     Unassigned code point found
16380     @enImplNote: dump
16381     @ecore:hasParameter: xp|byte-sequence
16382    
16383     FatalErrDef:
16384     @QName: xp|fatal-unprocessable-encoding
16385     @enDesc:
16386     When an XML processor encounters an entity with an encoding
16387     that is unable to process.
16388     @enMufDef:
16389     Encoding <%p (name => {<Q::xp|charset-uri>});>
16390     %p (name => {<Q::xp|encoding>}, prefix => {(}, suffix => {) });is
16391     not supported
16392     @ecore:hasParameter: xp|encoding
16393     @ecore:hasParameter: xp|charset-uri
16394    
16395     XWParam:
16396     @QName: xp|encoding
16397     @enDesc:
16398     The XML name of the encoding.
16399     @multipleProperties: DISCore|Single
16400     @dataType: DISCore|String
16401     @DISCore:resourceType: DISSource|ResourceProperty
16402    
16403     XWParam:
16404     @QName: xp|charset-uri
16405     @enDesc:
16406     The URI that identifies the encoding.
16407    
16408     FatalErrDef:
16409     @QName: xp|fatal-utf-16-no-bom
16410     @enDesc:
16411     If the encoding of an entity is UTF-16 but it does not
16412     contains <CHAR::BOM>.
16413     @enMufDef:
16414     The entity contains no BOM
16415    
16416     FatalErrDef:
16417     @QName: xp|fatal-encoding-mismatch
16418     @enDesc:
16419     If an entity including an encoding declaration
16420     in an encoding other than that named in the declaration.
16421     @enMufDef:
16422     The entity is labeled as <%p (name => {<Q::xp|charset-uri>});>
16423     %p (name => {<Q::xp|encoding>}, prefix => {(}, suffix => {) });but
16424     it is wrong
16425     @ecore:hasParameter: xp|encoding
16426     @ecore:hasParameter: xp|charset-uri
16427    
16428     WarnDef:
16429     @QName: xp|warn-unknown-decode-error
16430     @enDesc:
16431     Unknown message from the decoder.
16432     @enMufDef:
16433     Encoding decoder error: <%p (name => {<Q::xp|error-type>});>
16434     @ecore:hasParameter: xp|error-type
16435     @ecore:hasParameter: xp|error-param
16436    
16437     XWParam:
16438     @QName: xp|error-type
16439     @enDesc:
16440     A DOM URI that identifies the error type.
16441    
16442     XWParam:
16443     @QName: xp|error-param
16444     @enDesc:
16445     A <Q::xp|error-type>-dependent set of error descriptions.
16446    
16447 wakaba 1.26 NSFatalErrDef:
16448     @QName: xp|nswf-legal-ncname
16449     @enDesc:
16450     <CODE::Name>s other than element type names and attribute names
16451     <kwd:MUST> be <CODE::NCName>s.
16452     @enMufDef:
16453     <CODE::Name> |%p (name => {<Q::xp|name>});| is not an <CODE::NCName>
16454     @ecore:hasParameter: xp|error-token
16455     @ecore:hasParameter:
16456     @@@: xp|name
16457     @@enDesc:
16458     The name.
16459     @ecore:hasParameter:
16460     @@@: infoset|version
16461     @@enDesc:
16462     The version of XML in use.
16463    
16464     NSFatalErrDef:
16465     @QName: xp|nswf-legal-qname
16466     @enDesc:
16467     An element type name or an attribute name <kwd:MUST> be a
16468     <CODE::QName>.
16469     @enMufDef:
16470     <CODE::Name> |%p (name => {<Q::xp|name>});| is not a <CODE::QName>
16471     @ecore:hasParameter: xp|error-token
16472     @ecore:hasParameter:
16473     @@@: xp|name
16474     @@enDesc:
16475     The name.
16476     @ecore:hasParameter:
16477     @@@: infoset|version
16478     @@enDesc:
16479     The version of XML in use.
16480    
16481     NSCErrDef:
16482     @QName: xp|nsc-reserved-prefix-xml
16483     @enDesc:
16484     The prefix <XML::xml> <kwd:MUST-NOT> be undeclared or bound
16485     to any namespace name other than <URI::http://www.w3.org/XML/1998/namespace>.
16486     @enMufDef:
16487     Namespace prefix |xml| cannot be bound to namespace
16488     name |%p (name => {<Q::infoset|namespaceName>});|
16489     @ecore:hasParameter: xp|error-token
16490     @ecore:hasParameter:
16491     @@@: infoset|prefix
16492     @@enDesc:
16493     The namespace prefix.
16494     @ecore:hasParameter:
16495     @@@: infoset|namespaceName
16496     @@enDesc:
16497     The namespace name bound to or an empty string for undeclaring.
16498    
16499     NSCErrDef:
16500     @QName: xp|nsc-reserved-namespace-name-xml
16501     @enDesc:
16502     Namespace prefixes other than <XML::xml> <kwd:MUST-NOT> be bound
16503     to the namespace name <URI::http://www.w3.org/XML/1998/namespace>.
16504     @enMufDef:
16505     Namespace prefix |%p (name => {<Q::infoset|prefix>});| cannot be
16506     bound to namespace name |http://www.w3.org/XML/1998/namespace|
16507     @enImplNote:
16508     The XMLNames spec does not prohibit the URI bound to
16509     the default namespace (!)
16510     @ecore:hasParameter: xp|error-token
16511     @ecore:hasParameter:
16512     @@@: infoset|prefix
16513     @@enDesc:
16514     The namespace prefix or <DOM::null> for default namespace.
16515     @ecore:hasParameter:
16516     @@@: infoset|namespaceName
16517     @@enDesc:
16518     The namespace name bound to.
16519    
16520     NSCErrDef:
16521     @QName: xp|nsc-reserved-prefix-xmlns
16522     @enDesc:
16523     The prefix <XML::xmlns> <kwd:MUST-NOT> be declared or undeclared.
16524     @enMufDef:
16525     Namespace prefix |xmlns| cannot be declared or undeclared
16526     @ecore:hasParameter: xp|error-token
16527     @ecore:hasParameter:
16528     @@@: infoset|prefix
16529     @@enDesc:
16530     The namespace prefix.
16531     @ecore:hasParameter:
16532     @@@: infoset|namespaceName
16533     @@enDesc:
16534     The namespace name bound to or an empty string for undeclaring.
16535    
16536     NSCErrDef:
16537     @QName: xp|nsc-reserved-namespace-name-xmlns
16538     @enDesc:
16539     Namespace prefixes <kwd:MUST-NOT> be bound
16540     to the namespace name <URI::http://www.w3.org/2000/xmlns/>.
16541     @enMufDef:
16542     Namespace prefix |%p (name => {<Q::infoset|prefix>});| cannot be
16543     bound to namespace name |http://www.w3.org/2000/xmlns/|
16544     @enImplNote:
16545     The XMLNames spec does not prohibit the URI bound to
16546     the default namespace (!)
16547     @ecore:hasParameter: xp|error-token
16548     @ecore:hasParameter:
16549     @@@: infoset|prefix
16550     @@enDesc:
16551     The namespace prefix or <DOM::null> for default namespace.
16552     @ecore:hasParameter:
16553     @@@: infoset|namespaceName
16554     @@enDesc:
16555     The namespace name bound to.
16556    
16557     NSCErrDef:
16558     @QName: xp|nsc-prefix-declared
16559     @enDesc:
16560     A namespace prefix other than <XML::xml> or <XML::xmlns>
16561     <kwd:MUST> have been declared in a namespace declaration
16562     attribute in either the start or empty element tag of the
16563     element where the prefix is used or in an ancestor
16564     element. Furthermore, the attribute value in the innermost
16565     such declaration <kwd:MUST-NOT> be an empty string.
16566     @enMufDef:
16567     Namespace prefix |%p (name => {<Q::infoset|prefix>});| in
16568     qualified name |%p (name => {<Q::xp|name>});| is not declared
16569     @ecore:hasParameter: xp|error-token
16570     @ecore:hasParameter:
16571     @@@: infoset|prefix
16572     @@enDesc:
16573     The namespace prefix.
16574     @ecore:hasParameter:
16575     @@@: xp|name
16576     @@enDesc:
16577     The qualified name.
16578    
16579     NSFatalErrDef:
16580     @QName: xp|nswf-empty-namespace-name
16581     @enDesc:
16582     If the XML version of the document is 1.0 and the
16583     normalized value of the prefixed namespace declaration attribute is empty.
16584     @enMufDef:
16585     Namespace |%p (name => {<Q::infoset|prefix>});| cannot be
16586     undeclared in XML 1.0
16587     @ecore:hasParameter: xp|error-token
16588     @ecore:hasParameter:
16589     @@@: infoset|prefix
16590     @@enDesc:
16591     The namespace prefix.
16592     @ecore:hasParameter:
16593     @@@: infoset|namespaceName
16594     @@enDesc:
16595     An empty string.
16596    
16597     NSFatalErrDef:
16598     @QName: xp|nswf-unique-att-spec-expanded-name
16599     @enDesc:
16600     No element may have two attributes that have qualified name
16601     with the same local part and with namespace prefixes
16602     that have been bound to namespace names that are identical.
16603     @enMufDef:
16604     Attribute |%p (name => {<Q::infoset|localName>});| in
16605     namespace |%p (name => {<Q::infoset|namespaceName>});| is
16606     attached to the same element more than once (as
16607     |%p (name => {<Q::xp|name>});| and
16608     |%p (name => {<Q::xp|another-attribute-name>});|)
16609     @enImplNote:
16610     The XMLNames spec doesn't mention default attributes
16611     for this constraint...
16612     @ecore:hasParameter: xp|error-token
16613     @ecore:hasParameter:
16614     @@@: infoset|localName
16615     @@enDesc:
16616     The local part of the attribute.
16617     @ecore:hasParameter:
16618     @@@: infoset|namespaceName
16619     @@enDesc:
16620     The namespace URI of the attribute.
16621     @ecore:hasParameter:
16622     @@@: xp|name
16623     @@enDesc:
16624     The name, i.e. a qualified name consist of <Q::infoset:localName>
16625     and <Q::infoset:namespaceName> parameter values.
16626     @ecore:hasParameter:
16627     @@@: xp|another-attribute-name
16628     @@enDesc:
16629     Another attribute qualified name expanded to the same expanded name
16630     as <Q::xp|name>.
16631    
16632     XWParam:
16633     @QName: xp|another-attribute-name
16634 wakaba 1.24
16635     XWParam:
16636     @QName: xp|replacement-text
16637     @enDesc:
16638     The replacement text.
16639 wakaba 1.1
16640 wakaba 1.3 XWParam:
16641 wakaba 1.1 @QName: xp|error-token
16642     @enDesc:
16643     The token where the parser found an error.
16644    
16645 wakaba 1.3 XWParam:
16646     @QName: xp|name
16647     @enDesc:
16648     A name.
16649    
16650     XWParam:
16651     @QName: xp|parent
16652     @enDesc:
16653     The parent node in which the error occurs.
16654    
16655     XWParam:
16656     @QName: xp|node
16657     @enDesc:
16658     The current node.
16659    
16660     XWParam:
16661     @QName: xp|actual-element-type
16662     @enDesc:
16663     The actual element type name occured in the source.
16664    
16665     XWParam:
16666     @QName: xp|expected-element-type
16667 wakaba 1.1 @enDesc:
16668 wakaba 1.3 The element type name expected.
16669    
16670     XWParam:
16671     @QName: xp|character-number
16672     @enDesc:
16673     The character code position.
16674    
16675     ElementTypeBinding:
16676     @Name: XWParam
16677     @ElementType:
16678     dis:ResourceDef
16679     @ShadowContent:
16680     @@For: =ManakaiDOM|all
16681     @@rdf:type: ecore|Parameter
16682 wakaba 1.1
16683     ElementTypeBinding:
16684     @Name:enMufDef
16685     @ElementType:
16686     ecore:defaultMessage
16687     @ShadowContent:
16688     @@lang:en
16689     @@ContentType:
16690     lang:muf
16691    
16692     ResourceDef:
16693     @QName: DOMImpl
16694     @AliasFor: DOMCore|DOMImplementation
16695    
16696 wakaba 1.27 ResourceDef:
16697     @QName: LSInput
16698     @AliasFor: DOMLS|LSInput
16699    
16700     ResourceDef:
16701     @QName: LSParser
16702     @AliasFor: DOMLS|LSParser
16703    
16704 wakaba 1.1 ElementTypeBinding:
16705     @Name: Attr
16706     @ElementType:
16707     dis:ResourceDef
16708     @ShadowContent:
16709     @@rdf:type: DISLang|Attribute
16710    
16711     ElementTypeBinding:
16712     @Name: Get
16713     @ElementType:
16714     dis:ResourceDef
16715     @ShadowContent:
16716     @@rdf:type: DISLang|AttributeGet
16717    
16718     ElementTypeBinding:
16719     @Name: Set
16720     @ElementType:
16721     dis:ResourceDef
16722     @ShadowContent:
16723     @@rdf:type: DISLang|AttributeSet
16724    
16725     ElementTypeBinding:
16726     @Name: enDesc
16727     @ElementType:
16728     dis:Description
16729     @ShadowContent:
16730     @@lang:en
16731    
16732     ElementTypeBinding:
16733     @Name: Method
16734     @ElementType:
16735     dis:ResourceDef
16736     @ShadowContent:
16737     @@rdf:type: DISLang|Method
16738    
16739     ElementTypeBinding:
16740     @Name: Return
16741     @ElementType:
16742     dis:ResourceDef
16743     @ShadowContent:
16744     @@rdf:type: DISLang|MethodReturn
16745    
16746     ElementTypeBinding:
16747     @Name: Param
16748     @ElementType:
16749     dis:ResourceDef
16750     @ShadowContent:
16751     @@rdf:type: DISLang|MethodParameter
16752    
16753     ElementTypeBinding:
16754     @Name: PerlDef
16755     @ElementType:
16756     dis:Def
16757     @ShadowContent:
16758     @@ContentType: lang|Perl
16759    
16760     ElementTypeBinding:
16761 wakaba 1.27 @Name: PerlDefC
16762     @ElementType:
16763     dis:Def
16764     @ShadowContent:
16765     @@ContentType: lang|Perl
16766    
16767     ElementTypeBinding:
16768 wakaba 1.1 @Name: PropDef
16769     @ElementType:
16770     dis:ResourceDef
16771     @ShadowContent:
16772     @@rdf:type: rdf|Property
16773    
16774     ClsDef:
16775     @ClsQName: ManakaiXMLParserExceptionFormatter
16776    
16777     @ClsISA: ecore|MUErrorFormatter||ManakaiDOM|Perl
16778    
16779     @RuleDef:
16780     @@Name: xp-error-token-type
16781     @@enDesc:
16782     The type of the token the parser is encountered.
16783    
16784     @@Method:
16785     @@@Name: after
16786     @@@Param:
16787     @@@@Name: name
16788     @@@@Type: DOMString
16789     @@@@enDesc: The name of the method.
16790     @@@Param:
16791     @@@@Name: p
16792     @@@@Type: DISPerl|HASH
16793     @@@@enDesc: The set of the parameters to the method.
16794     @@@Param:
16795     @@@@Name: o
16796     @@@@Type: DISPerl|HASH
16797     @@@@enDesc: The option value.
16798     @@@Return:
16799     @@@@PerlDef:
16800     $p->{-result} = $o->{<H::xp|error-token>}->{type}
16801     if defined $o->{<H::xp|error-token>}->{type};
16802    
16803     @RuleDef:
16804     @@Name: xp-error-token-value
16805     @@enDesc:
16806     The value of the token the parser is encountered, if any.
16807    
16808     @@Method:
16809     @@@Name: after
16810     @@@Param:
16811     @@@@Name: name
16812     @@@@Type: DOMString
16813     @@@@enDesc: The name of the method.
16814     @@@Param:
16815     @@@@Name: p
16816     @@@@Type: DISPerl|HASH
16817     @@@@enDesc: The set of the parameters to the method.
16818     @@@Param:
16819     @@@@Name: o
16820     @@@@Type: DISPerl|HASH
16821     @@@@enDesc: The option value.
16822     @@@Return:
16823     @@@@PerlDef:
16824     $p->{-result} = $o->{<H::xp|error-token>}->{value}
16825     if defined $o->{<H::xp|error-token>}->{value};
16826    
16827     @RuleDef:
16828     @@Name: xp-error-lines
16829     @@enDesc:
16830     A copy of fragment of the source text that contains the line
16831     where the error occurred, if available.
16832    
16833     @@Method:
16834     @@@Name: after
16835     @@@Param:
16836     @@@@Name: name
16837     @@@@Type: DOMString
16838     @@@@enDesc: The name of the method.
16839     @@@Param:
16840     @@@@Name: p
16841     @@@@Type: DISPerl|HASH
16842     @@@@enDesc: The set of the parameters to the method.
16843     @@@Param:
16844     @@@@Name: o
16845     @@@@Type: DISPerl|HASH
16846     @@@@enDesc: The option value.
16847     @@@Return:
16848     @@@@PerlDef:
16849     my $pos = $o-><AG::DOMCore|DOMError.location>
16850     -><AG::DOMCore|DOMLocator.utf32Offset>;
16851 wakaba 1.27 my $src = $o->{<H::ecore|object>}->{entity}->[-1]->{reptxt};
16852     if (defined $src and $pos > -1) {
16853 wakaba 1.1 my $start = $pos;
16854     $start = rindex ($$src, "\x0A", $start - 1) for 0..2;
16855     $start++;
16856     my $end = $pos;
16857     $end = index ($$src, "\x0A", $end + 1) for 0..2;
16858     $end = length $$src if $end < 0;
16859     $p->{-result} = substr $$src, $start, $end - $start;
16860     }
16861 wakaba 1.3
16862     @RuleDef:
16863     @@Name: character-code-point
16864     @@enDesc:
16865     The character code position, in <CODE::U+<VAR::HHHH>> notation.
16866    
16867     @@Method:
16868     @@@Name: after
16869     @@@Param:
16870     @@@@Name: name
16871     @@@@Type: DOMString
16872     @@@@enDesc: The name of the method.
16873     @@@Param:
16874     @@@@Name: p
16875     @@@@Type: DISPerl|HASH
16876     @@@@enDesc: The set of the parameters to the method.
16877     @@@Param:
16878     @@@@Name: o
16879     @@@@Type: DISPerl|HASH
16880     @@@@enDesc: The option value.
16881     @@@RuleParam:
16882     @@@@Name: v
16883     @@@@Type: DISPerl|Number
16884     @@@@enDesc:
16885     The name of the error parameter that contains the character code.
16886     @@@Return:
16887     @@@@PerlDef:
16888     $p->{-result} = sprintf 'U+%04X', $o->{$p->{v}};
16889 wakaba 1.1 ##XMLParserExceptionFormatter
16890 wakaba 1.27
16891     ElementTypeBinding:
16892     @Name: CParam
16893     @ElementType:
16894     dis:ResourceDef
16895     @ShadowContent:
16896     @@rdf:type:
16897     @@@@: c|DOMConfigurationParameter
16898     @@rdf:type:
16899 wakaba 1.33 @@@@: DISSource|ResourceProperty
16900 wakaba 1.27 @@@For: =ManakaiDOM|all
16901 wakaba 1.33 @@subsetOf:
16902     @@@@: c|anyDOMConfigurationParameter
16903     @@@For: =ManakaiDOM|all
16904 wakaba 1.34 @@multipleProperties:
16905     @@@@: DISCore|Single
16906     @@@For: =ManakaiDOM|all
16907 wakaba 1.27
16908     ElementTypeBinding:
16909     @Name: CParamApp
16910     @ElementType:
16911     dis:ResourceDef
16912     @ShadowContent:
16913     @@rdf:type:
16914     @@@@: c|DOMConfigurationParameterApplication
16915 wakaba 1.30
16916 wakaba 1.34 ElementTypeBinding:
16917     @Name: boolCParam
16918     @ElementType:
16919     dis:ResourceDef
16920     @ShadowContent:
16921     @@DISCore:resourceType:
16922     @@@@: c|DOMConfigurationParameter
16923     @@DISCore:resourceType:
16924     @@@@: DISSource|ResourceProperty
16925     @@@For: =ManakaiDOM|all
16926     @@Type: idl|boolean||ManakaiDOM|all
16927     @@subsetOf:
16928     @@@@: c|anyDOMConfigurationParameter
16929     @@@For: =ManakaiDOM|all
16930     @@multipleProperties:
16931     @@@@: DISCore|Single
16932     @@@For: =ManakaiDOM|all
16933     @@dataType:
16934     @@@@: DISCore|Boolean
16935     @@@For: =ManakaiDOM|all
16936    
16937 wakaba 1.30 CParamApp:
16938     @QName: xml-id
16939     @c:domConfigurationParameter: cfg|xml-id
16940     @c:targetType: xp|ManakaiXMLParser
16941 wakaba 1.34 @TrueCase:
16942     @@c:isSupported: 1
16943     @FalseCase:
16944     @@c:isSupported: 1
16945 wakaba 1.27
16946     CParamApp:
16947     @QName: error-handler
16948     @c:domConfigurationParameter: c|error-handler
16949     @c:targetType: xp|ManakaiXMLParser
16950 wakaba 1.34
16951     boolCParam:
16952     @QName: cfg|entity-replacement-tree
16953     @DOMLS:lsKey:
16954     @@@: erep
16955     @@For: =ManakaiDOM|all
16956     @Type: idl|boolean||ManakaiDOM|all
16957     @c:targetType: xp|ManakaiXMLParser
16958     @IsSupportRequired: 1
16959     @c:isSupported: 1
16960     @TrueCase:
16961     @@c:isSupported: 1
16962     @@enDesc:
16963     The parser <kwd:MUST> cnstruct the replacement subtree of
16964 wakaba 1.35 a general parsed <IF::tx|Entity> node if the replacement text
16965 wakaba 1.34 for the node is available.
16966    
16967     If this value is set to the parameter, then a fatal error
16968     might be reported even if the entire document is well-formed
16969     in case a general parsed entity has replacement text that is
16970     not well-formed when evaluated as if it has been referenced
16971     in the content of an element, except that undeclared namespace prefixes
16972     do not result in namespace well-formedness error.
16973     @FalseCase:
16974     @@IsDefault: 1
16975     @@c:isSupported: 1
16976     @@IsSupportRequired: 1
16977     @@enDesc:
16978 wakaba 1.35 The parser don't have to construct <IF::tx|Entity> replacement
16979 wakaba 1.34 subtrees.
16980    
16981     @Test:
16982     @@QName: cfg.entity-replacement-tree.test
16983     @@PerlDef:
16984     my $xp;
16985     __CODE{createParserForTest:: $xp => $xp}__;
16986     my $cfg = $xp-><AG::LSInput.domConfig>;
16987    
16988     my $pname = <Q::cfg|entity-replacement-tree>;
16989    
16990     $test->id ('default.false');
16991     $test->assert_false ($cfg-><M::c|DOMConfiguration.getParameter> ($pname));
16992    
16993     $test->id ('false.to.true');
16994     $cfg-><M::c|DOMConfiguration.setParameter> ($pname => true);
16995     $test->assert_false ($cfg-><M::c|DOMConfiguration.getParameter> ($pname));
16996    
16997     $test->id ('true.to.false');
16998     $cfg-><M::c|DOMConfiguration.setParameter> ($pname => false);
16999     $test->assert_false ($cfg-><M::c|DOMConfiguration.getParameter> ($pname));
17000    
17001     $test->id ('reset');
17002     $cfg-><M::c|DOMConfiguration.setParameter> ($pname => true);
17003     $cfg-><M::c|DOMConfiguration.setParameter> ($pname => null);
17004     $test->assert_false ($cfg-><M::c|DOMConfiguration.getParameter> ($pname));
17005 wakaba 1.27
17006     CParam:
17007     @QName: xp|ls-input-to-input-file
17008     @DOMLS:lsKey:
17009     @@@: i2i
17010     @@For: =ManakaiDOM|all
17011     @Type: ManakaiDOMLSInputToInputFile
17012     @c:targetType: xp|ManakaiXMLParser
17013     @IsSupportRequired: 1
17014     @c:isSupported: 1
17015     @enDesc:
17016     An <IF::LSInput> to Perl filehandle converter.
17017    
17018     @Method:
17019     @@rdf:type: c|DOMConfigurationParameterDefaultGetter
17020     @@Param:
17021     @@@Name: name
17022     @@@Type: DOMString
17023     @@@dis:actualType: c|DOMConfigurationParameterName
17024     @@@enDesc: The parameter name.
17025     @@Return:
17026     @@@Type: ManakaiDOMLSInputToInputFile
17027     @@@enDesc:
17028     The default resolver.
17029     @@@PerlDefC:
17030 wakaba 1.37 # resolveLSInput
17031 wakaba 1.27 $r = sub {
17032 wakaba 1.37 my ($self, $impl, $input, $parser, $errorHandler) = @_;
17033 wakaba 1.27 ## As defined in DOM Level 3 LS |LSInput| interface
17034    
17035     my $r = {};
17036    
17037     __DEEP{
17038    
17039     FH: {
17040     ## 1. |characterStream|
17041     my $v = $input-><AG::LSInput.characterStream>;
17042     if (defined $v) {
17043     $r->{filehandle} = $v;
17044     last FH;
17045     }
17046    
17047     ## 2. |byteStream|
17048     $v = $input-><AG::LSInput.byteStream>;
17049     if (defined $v) {
17050 wakaba 1.37 require Message::Charset::Encode;
17051     my $mceimpl = $impl-><M::f|GetFeature.getFeature>
17052     (<Q::fe|MCEncode>, '1.0');
17053     my $encode = $input-><AG::LSInput.encoding>;
17054     my $encode_uri = defined $encode
17055     ? $mceimpl-><M::mce|MCEncodeImplementation
17056     .getURIFromCharsetName>
17057     (<Q::cs|xmlName>, $encode)
17058     : <Q::xml-auto-charset:>;
17059     $r->{filehandle} = $mceimpl-><M::mce|MCEncodeImplementation
17060     .createMCDecodeHandle>
17061     ($encode_uri, $v, sub {
17062     my ($self, $fh, $type, %opt) = @_;
17063     my $continue = true;
17064     if ($type eq <Q::cs|illegal-octets-error>) {
17065     $continue = __c|ERROR{xp|fatal-illegal-byte-sequence::
17066     xp|byte-sequence => {$opt{octets}},
17067     ecore|object => {$parser},
17068     }__;
17069     } elsif ($type eq <Q::cs|unassigned-code-point-error>) {
17070     $continue = __c|ERROR{xp|warning-unassigned-code-point::
17071     xp|byte-sequence => {$opt{octets}},
17072     ecore|object => {$parser},
17073     }__;
17074     $opt{octets} = \"\x{FFFD}";
17075     } elsif ($type eq <Q::cs|invalid-state-error>) {
17076     $continue = __c|ERROR{xp|fatal-illegal-byte-sequence::
17077     xp|code-state => {$opt{state}},
17078     ecore|object => {$parser},
17079     }__;
17080     } elsif ($type eq <Q::cs|charset-not-supported-error>) {
17081     $continue = __c|ERROR{xp|fatal-unprocessable-encoding::
17082     xp|encoding => {$encode},
17083     xp|charset-uri => {$opt{charset_uri}},
17084     ecore|object => {$parser},
17085     }__;
17086     } elsif ($type eq <Q::cs|no-bom-error>) {
17087     if ($opt{charset_uri} eq <Q::cs|XML.utf-16>) {
17088     $continue = __c|ERROR{xp|fatal-utf-16-no-bom::
17089     ecore|object => {$parser},
17090     }__;
17091     } else {
17092     $continue = __c|ERROR{xp|fatal-illegal-byte-sequence::
17093     xp|code-state => 'bom',
17094     ecore|object => {$parser},
17095     }__;
17096     }
17097     } elsif ($type eq <Q::cs|charset-name-mismatch-error>) {
17098     $continue = __c|ERROR{xp|fatal-encoding-mismatch::
17099     xp|encoding => {$encode},
17100     xp|charset-uri => {$opt{charset_uri}},
17101     ecore|object => {$parser},
17102     }__;
17103     } else {
17104     $continue = __c|ERROR{xp|warn-unknown-decode-error::
17105     xp|error-type => {$type},
17106     xp|error-param => {\%opt},
17107     ecore|object => {$parser},
17108     }__;
17109     }
17110     unless ($continue) {
17111     __EXCEPTION{DOMLS|PARSE_ERR::
17112     ecore|object => {$parser},
17113     }__;
17114     }
17115     });
17116     $r->{input_encoding}
17117     = $r->{filehandle}-><AG::mce|MCDecodeHandle.inputEncoding>
17118     if defined $r->{filehandle};
17119     last FH;
17120 wakaba 1.27 }
17121    
17122     ## 3. |stringData|
17123     $v = $input-><AG::LSInput.stringData>;
17124     if (defined $v) {
17125     require IO::String;
17126     $r->{filehandle} = IO::String->new ($v);
17127     last FH;
17128     }
17129    
17130     ## 4. |systemId|
17131     ## TODO:
17132     ## resolve relative URI
17133     ## open
17134     ## set document_uri
17135    
17136     ## 5. |publicId|
17137     ## The default resolver does not support only-|publicId| input.
17138    
17139     return null;
17140     } # FH
17141    
17142     DURI: {
17143     last DURI if defined $r->{document_uri};
17144    
17145     my $v = $input-><AG::LSInput.systemId>;
17146     if (defined $v) {
17147 wakaba 1.29 $r->{base_uri} = $input-><AG::LSInput.baseURI>
17148     unless defined $r->{base_uri};
17149     if (defined $r->{base_uri}) {
17150 wakaba 1.41 $r->{document_uri} = $impl->create_uri_reference (\$v)
17151 wakaba 1.29 -><M::urigen|URIReference.getAbsoluteReference>
17152     ($r->{base_uri})
17153     -><AG::urigen|URIReference.uriReference>;
17154     } else {
17155     $r->{document_uri} = $v;
17156     }
17157 wakaba 1.27 last DURI;
17158     }
17159    
17160     ## TODO: pubid -> pubid URN -> document_uri
17161     } # DURI
17162    
17163     BURI: {
17164     last BURI if defined $r->{base_uri};
17165    
17166     my $v = $input-><AG::LSInput.baseURI>;
17167     if (defined $v) {
17168     $r->{base_uri} = $v;
17169     last BURI;
17170     }
17171    
17172     if (defined $r->{document_uri}) {
17173     $r->{base_uri} = $r->{document_uri};
17174     }
17175     } # BURI
17176    
17177 wakaba 1.37 $r->{input_encoding} = $input-><AG::LSInput.encoding>
17178     unless defined $r->{input_encoding};
17179    
17180 wakaba 1.27 }__;
17181    
17182     ## ISSUE: Is |certifiedText| required by parsers?
17183    
17184     return $r;
17185     };
17186     @Method:
17187     @@rdf:type: c|DOMConfigurationParameterSetter
17188     @@Param:
17189     @@@Name: name
17190     @@@Type: DOMString
17191     @@@dis:actualType: c|DOMConfigurationParameterName
17192     @@@enDesc: The parameter name.
17193     @@Param:
17194     @@@Name: value
17195     @@@Type: DOMMain|DOMUserData
17196     @@@dis:actualType: ManakaiDOMLSInputToInputFile
17197     @@@enDesc: The new value.
17198     @@Return:
17199     @@@Type: idl|void||ManakaiDOM|all
17200     @@@PerlDefC:
17201     $self->[1]->{<H::xp|ls-input-to-input-file>} = $value;
17202     @@enImplNote:
17203     Implied input processor converts non-blessed code references
17204     into a <Class::ManakaiDOMLSInputToInputFile> object.
17205     @Method:
17206     @@rdf:type: c|DOMConfigurationParameterChecker
17207     @@Param:
17208     @@@Name: name
17209     @@@Type: DOMString
17210     @@@dis:actualType: c|DOMConfigurationParameterName
17211     @@@enDesc: The parameter name.
17212     @@Param:
17213     @@@Name: value
17214     @@@Type: DOMMain|DOMUserData
17215     #@@@dis:actualType: ManakaiDOMLSInputToInputFile
17216     @@@enDesc: The new value.
17217     @@Return:
17218     @@@Type: idl|boolean||ManakaiDOM|all
17219     @@@PerlDefC:
17220     $r = UNIVERSAL::isa ($value, 'CODE') or
17221     UNIVERSAL::isa ($value, <ClassName::ManakaiDOMLSInputToInputFile>);
17222    
17223     @@Test:
17224     @@@QName: cp.ls-input-to-input-file.test
17225     @@@PerlDefC:
17226     my $xp;
17227     __CODE{createParserForTest:: $xp => $xp}__;
17228     my $cfg = $xp-><AG::LSInput.domConfig>;
17229    
17230     my $cp = <Q::xp|ls-input-to-input-file>;
17231    
17232     $test->id ('default');
17233     my $default = $cfg-><M::c|DOMConfiguration.getParameter> ($cp);
17234     $test->assert_isa ($default,
17235     <ClassName::ManakaiDOMLSInputToInputFile>);
17236    
17237     $test->id ('set');
17238     my $sub1 = sub { };
17239     $cfg-><M::c|DOMConfiguration.setParameter> ($cp => $sub1);
17240     my $sub2 = $cfg-><M::c|DOMConfiguration.getParameter> ($cp);
17241     $test->assert_isa ($sub2, <ClassName::ManakaiDOMLSInputToInputFile>);
17242     $test->assert_equals ($sub2, $sub1);
17243    
17244     $test->id ('reset');
17245     $cfg-><M::c|DOMConfiguration.setParameter> ($cp => null);
17246     my $sub3 = $cfg-><M::c|DOMConfiguration.getParameter> ($cp);
17247     $test->assert_isa ($sub3, <ClassName::ManakaiDOMLSInputToInputFile>);
17248     $test->assert_equals ($sub3, $default);
17249 wakaba 1.29
17250     @@Test:
17251     @@@QName: cp.ls-input-to-input-file.default.test
17252     @@@PerlDefC:
17253     my $xp;
17254     __CODE{createParserForTest:: $xp => $xp}__;
17255     my $cfg = $xp-><AG::LSInput.domConfig>;
17256     my $cp = <Q::xp|ls-input-to-input-file>;
17257     my $default = $cfg-><M::c|DOMConfiguration.getParameter> ($cp);
17258    
17259     my $err = sub {}; # dummy error handler
17260    
17261     my $cs = \*STDOUT; # dummy input
17262    
17263     $test->id ('cs.sysid');
17264     my $r1 = $default->resolve_ls_input ({
17265     character_stream => $cs,
17266     system_id => q<http://example.com/sysid>,
17267     }, $err);
17268     $test->assert_equals
17269     ($r1->document_uri, q<http://example.com/sysid>);
17270     $test->assert_equals
17271     ($r1->base_uri, q<http://example.com/sysid>);
17272    
17273     $test->id ('cs.baseuri.sysid');
17274     my $r1 = $default->resolve_ls_input ({
17275     character_stream => $cs,
17276     system_id => q<sysid>,
17277     base_uri => q<http://example.com/>,
17278     }, $err);
17279     $test->assert_equals
17280     ($r1->document_uri, q<http://example.com/sysid>);
17281     $test->assert_equals
17282     ($r1->base_uri, q<http://example.com/>);
17283 wakaba 1.27 ##ls-input-to-input-file
17284    
17285     ClsDef:
17286     @ClsQName: ManakaiDOMLSInputToInputFile
17287     @enDesc:
17288     An <Class::ManakaiDOMLSInputToInputFile> object is used to covert
17289     a <IF::LSInput> object into a Perl filehandle.
17290    
17291     {ISSUE::
17292     In which module this class should be placed?
17293    
17294     Better interface name?
17295     }
17296    
17297     @enDesc:
17298     @@ddid: perl
17299     @@@:
17300     For Perl binding, any parameter that accepts
17301     a <Class::ManakaiDOMLSInputToInputFile> would also accept a Perl code
17302     reference (subroutine reference). The code reference
17303     will be blessed as a <Class::ManakaiDOMLSInputToInputFile> whose
17304     <M::ManakaiDOMLSInputToInputFile.resolveLSInput> method invokes the code.
17305    
17306     @ResourceDef:
17307     @@rdf:type: DISLang|InputProcessor
17308     @@rdf:type: DISLang|OutputProcessor
17309     @@PerlDef:
17310     $INPUT = bless $INPUT, <ClassName::ManakaiDOMLSInputToInputFile>
17311     if ref $INPUT eq 'CODE';
17312    
17313     @Method:
17314     @@Name: resolveLSInput
17315     @@enDesc:
17316     Converts a <IF::LSInput> into a Perl filehandle.
17317     @@Param:
17318 wakaba 1.37 @@@Name: impl
17319     @@@Type: f|MinimumImplementation
17320     @@@enDesc:
17321     The implementation object.
17322     @@Param:
17323 wakaba 1.27 @@@Name: input
17324     @@@Type: LSInput
17325     @@@enDesc:
17326     The input.
17327     @@Param:
17328 wakaba 1.37 @@@Name: parser
17329     @@@Type: LSParser
17330     @@@enDesc:
17331     The parser.
17332     @@Param:
17333 wakaba 1.27 @@@Name: errorHandler
17334     @@@Type: c|DOMErrorHandler
17335     @@@enDesc:
17336     An error handler. If the method encounters an error
17337     or warning, it <kwd:MAY> notify it to application
17338     via this handler.
17339     @@Return:
17340     @@@Type: ManakaiDOMInputFile
17341     @@@enDesc:
17342     A <Class::ManakaiDOMInputFile> object created from <P::input>.
17343     @@@nullCase:
17344     @@@@enDesc:
17345     If the method was unable to resolve the <P::input>.
17346    
17347     {ISSUE::
17348     Should we allow the method to throw exceptions?
17349     }
17350     @@@PerlDef:
17351     __DEEP{
17352 wakaba 1.37 $r = $self->($self, $impl, $input, $parser, $errorHandler);
17353 wakaba 1.27 }__;
17354     @@@enImplNote:
17355     Notet that the input / output processor for <CODE::$input>
17356     and return value might or might not be inserted in
17357     the <Perl::$self> code.
17358     ##LSInputToInputFile
17359    
17360     ClsDef:
17361     @ClsQName: ManakaiDOMInputFile
17362     @enDesc:
17363     A set of information on the input, including filehandle.
17364    
17365     @enDesc:
17366     @@ddid: perl
17367     @@@:
17368     For Perl binding, any parameter that accepts
17369     a <Class::ManakaiDOMInputFile> would also accept a Perl hash reference.
17370     If a hash reference is given to parameter that expects
17371     a <Class::ManakaiDOMInputFile> object, then it
17372     bless the hash with the class.
17373    
17374     Each attributes defined
17375     in the class is associated to the hash value with the
17376     key equals to the attribut name. Each method defined in
17377     the class will invoke the code reference retrieved
17378     from the hash by the key equals to the method name.
17379    
17380     If there is no value in the hash for an attribute,
17381     then its value is <DOM::null>.
17382    
17383     @ResourceDef:
17384     @@rdf:type: DISLang|InputProcessor
17385     @@rdf:type: DISLang|OutputProcessor
17386     @@PerlDef:
17387     $INPUT = bless $INPUT, <ClassName::ManakaiDOMInputFile>
17388     if ref $INPUT eq 'HASH';
17389    
17390     @Attr:
17391     @@Name: filehandle
17392     @@Type: DISPerl|filehandle||ManakaiDOM|all
17393     @@enDesc:
17394     The input filehandle.
17395    
17396     It <kwd:MUST> be an <Perl::open>ed (and not <Perl::close>d)
17397     filehandle. Note that
17398     it does not have to be associated with an actual file
17399     in the local file system.
17400    
17401     It <kwd:MUST> return a character (rather than byte)
17402     by <Perl::getc>.
17403     @@Get:
17404     @@@PerlDef: $r = $self->{filehandle};
17405     @@Set:
17406     @@@PerlDef: $self->{filehandle} = $given;
17407    
17408     @Attr:
17409     @@Name: baseURI
17410     @@enDesc:
17411     The base URI of the input.
17412    
17413     It <kwd:MUST> be an absolute DOM URI or <DOM::null>.
17414     Otherwise, the result is undefined.
17415     @@Type: DOMString
17416     @@nullCase:
17417     @@@enDesc:
17418     If the base URI is not available.
17419     @@Get:
17420     @@@PerlDef: $r = $self->{base_uri};
17421     @@Set:
17422     @@@PerlDef: $self->{base_uri} = $given;
17423    
17424     @Attr:
17425     @@Name: documentURI
17426     @@enDesc:
17427     The URI of the document.
17428    
17429     It <kwd:MUST> be an absolute DOM URI or <DOM::null>.
17430     Otherwise, the result is undefined.
17431     @@Type: DOMString
17432     @@nullCase:
17433     @@@enDesc:
17434     If the document URI is not available.
17435     @@Get:
17436     @@@PerlDef: $r = $self->{document_uri};
17437     @@Set:
17438     @@@PerlDef: $self->{document_uri} = $given;
17439 wakaba 1.37
17440     @Attr:
17441     @@Name: inputEncoding
17442     @@enDesc:
17443     The input encoding name.
17444     @@Type: DOMString
17445     @@nullCase:
17446     @@@enDesc:
17447     If the input encoding name is not available.
17448     @@Get:
17449     @@@PerlDef: $r = $self->{input_encoding};
17450     @@Set:
17451     @@@PerlDef: $self->{input_encoding} = $given;
17452 wakaba 1.27
17453     @Method:
17454     @@Name: close
17455     @@enDesc:
17456     Closes the file.
17457    
17458     Since when the Perl's destructor is invoked is unreliable,
17459     this method is explicitly called when the file is no longer
17460     in use.
17461    
17462     If the <Class::ManakaiDOMInputFile> is given as a hash
17463     reference and whose value for <CODE::close> is not defined,
17464     then the statement <Perl::close $filehandle> is done
17465     (where <Perl::$filehandle> is the <A::ManakaiDOMInputFile.filehandle>
17466     value).
17467     @@Return:
17468     @@@PerlDef:
17469     __DEEP{
17470     if ($self->{close}) {
17471     $self->{close}->($self);
17472     } else {
17473 wakaba 1.38 $self->{filehandle}->close;
17474 wakaba 1.27 }
17475     }__;
17476     ##ManakaiDOMInputFile
17477    
17478    
17479    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24