/[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.16 - (show annotations) (download)
Fri Feb 10 08:10:26 2006 UTC (18 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.15: +949 -128 lines
++ manakai/lib/Message/Util/DIS/ChangeLog	10 Feb 2006 08:09:55 -0000
2006-02-10  Wakaba  <wakaba@suika.fam.cx>

	* DPG.dis (statement_to_code): |unshift-current-token| attribute
	is supported for embeded |pg:ruleRefStatement|.

++ manakai/lib/Message/DOM/ChangeLog	10 Feb 2006 08:08:03 -0000
2006-02-10  Wakaba  <wakaba@suika.fam.cx>

	* XMLParser.dis (xp:fatal-xml11-end-of-line-in-xml-declaration): New
	fatal error.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24