187 |
@@Value: |
@@Value: |
188 |
@@@is-null:1 |
@@@is-null:1 |
189 |
|
|
190 |
|
ElementTypeBinding: |
191 |
|
@Name: TrueCase |
192 |
|
@ElementType: |
193 |
|
dis:ResourceDef |
194 |
|
@ShadowContent: |
195 |
|
@@rdf:type: |
196 |
|
ManakaiDOM:InCase |
197 |
|
@@Value: |
198 |
|
@@@@: 1 |
199 |
|
@@@ContentType: DISCore|Boolean |
200 |
|
@@Type: idl|boolean||ManakaiDOM|all |
201 |
|
|
202 |
|
ElementTypeBinding: |
203 |
|
@Name: FalseCase |
204 |
|
@ElementType: |
205 |
|
dis:ResourceDef |
206 |
|
@ShadowContent: |
207 |
|
@@rdf:type: |
208 |
|
ManakaiDOM:InCase |
209 |
|
@@Value: |
210 |
|
@@@@: 0 |
211 |
|
@@@ContentType: DISCore|Boolean |
212 |
|
@@Type: idl|boolean||ManakaiDOM|all |
213 |
|
|
214 |
ResourceDef: |
ResourceDef: |
215 |
@QName: LSParser |
@QName: LSParser |
216 |
@AliasFor: DOMLS|LSParser |
@AliasFor: DOMLS|LSParser |
243 |
might be far from the ones obtained when the error would not |
might be far from the ones obtained when the error would not |
244 |
be found. |
be found. |
245 |
|
|
246 |
|
@Test: |
247 |
|
@@QName: Perl.open.utf8.strref.1.test |
248 |
|
@@enDesc: |
249 |
|
Does PerlIO works as intended? |
250 |
|
@@PerlDef: |
251 |
|
my $s = qq<\x{3001}\x0A\x{10001}>; |
252 |
|
#open my $a, '<'.':utf8', \$s; |
253 |
|
require IO::String; |
254 |
|
my $a = IO::String->new ($s); |
255 |
|
$test->assert_num_equals |
256 |
|
(actual_value => ord getc $a, |
257 |
|
expected_value => 0x3001); |
258 |
|
$test->assert_num_equals |
259 |
|
(actual_value => ord getc $a, |
260 |
|
expected_value => 0x000A); |
261 |
|
$test->assert_num_equals |
262 |
|
(actual_value => ord getc $a, |
263 |
|
expected_value => 0x10001); |
264 |
|
$a->ungetc (0x10001); |
265 |
|
$test->assert_num_equals |
266 |
|
(actual_value => ord getc $a, |
267 |
|
expected_value => 0x10001); |
268 |
|
$test->assert_null (getc $a); |
269 |
|
close $a; |
270 |
|
@Test: |
271 |
|
@@QName: Perl.open.8859.strref.2.test |
272 |
|
@@enDesc: |
273 |
|
Does PerlIO works as intended? |
274 |
|
@@PerlDef: |
275 |
|
my $s = qq<\x{0080}\x0A\x{00A9}>; |
276 |
|
#open my $a, '<', \$s; |
277 |
|
require IO::String; |
278 |
|
my $a = IO::String->new ($s); |
279 |
|
$test->assert_num_equals |
280 |
|
(actual_value => ord getc $a, |
281 |
|
expected_value => 0x0080); |
282 |
|
$test->assert_num_equals |
283 |
|
(actual_value => ord getc $a, |
284 |
|
expected_value => 0x000A); |
285 |
|
$test->assert_num_equals |
286 |
|
(actual_value => ord getc $a, |
287 |
|
expected_value => 0x00A9); |
288 |
|
$a->ungetc (0x00A9); |
289 |
|
$test->assert_num_equals |
290 |
|
(actual_value => ord getc $a, |
291 |
|
expected_value => 0x00A9); |
292 |
|
$test->assert_null (getc $a); |
293 |
|
close $a; |
294 |
|
|
295 |
@Attr: |
@Attr: |
296 |
@@Name: domConfig |
@@Name: domConfig |
297 |
@@enDesc: |
@@enDesc: |
304 |
__CODE{DOMCore|getConfigObject:: |
__CODE{DOMCore|getConfigObject:: |
305 |
$target => $self, |
$target => $self, |
306 |
$targetHash => $self, |
$targetHash => $self, |
307 |
$targetType => {<IFName::LSParser>}, |
$targetType => {<ClassName::xp|ManakaiXMLParser>}, |
308 |
$result => $r, |
$result => $r, |
309 |
}__; |
}__; |
310 |
|
|
311 |
|
@Attr: |
312 |
|
@@ForCheck: ManakaiDOM|ForClass |
313 |
|
@@Name: async |
314 |
|
@@enDesc: |
315 |
|
Whether the parser is asynchronous or not. |
316 |
|
@@Type: idl|boolean||ManakaiDOM|all |
317 |
|
@@Get: |
318 |
|
@@@FalseCase: |
319 |
|
@@@@enDesc: |
320 |
|
The parser does not in asynchronous mode. |
321 |
|
@@@PerlDef: \ |
322 |
|
@@Test: |
323 |
|
@@@QName: XMLParser.async.test |
324 |
|
@@@PerlDef: |
325 |
|
my $xp; |
326 |
|
__CODE{createParserForTest:: $xp => $xp}__; |
327 |
|
|
328 |
|
$test->assert_false ($xp-><AG::DOMLS|LSParser.async>); |
329 |
|
|
330 |
|
@Attr: |
331 |
|
@@ForCheck: ManakaiDOM|ForClass |
332 |
|
@@Name: busy |
333 |
|
@@enDesc: |
334 |
|
Whether the parser is currently busy loading a document or not. |
335 |
|
@@Type: idl|boolean||ManakaiDOM|all |
336 |
|
@@Get: |
337 |
|
@@@TrueCase: |
338 |
|
@@@@enDesc: |
339 |
|
The parser is currently busy. |
340 |
|
@@@FalseCase: |
341 |
|
@@@@enDesc: |
342 |
|
The parser is not busy. |
343 |
|
@@@PerlDef: |
344 |
|
$r = $self->{<H::DOMLS|busy>}; |
345 |
|
|
346 |
|
@enImplNote: |
347 |
|
@@ddid: abort |
348 |
|
@@@: |
349 |
|
{ISSUE:: |
350 |
|
LSParser.abort: |
351 |
|
|
352 |
|
Is it required to support even in synchronous mode? |
353 |
|
} |
354 |
|
|
355 |
|
{TODO:: |
356 |
|
LSParser.filter |
357 |
|
} |
358 |
|
|
359 |
|
@ResourceDef: |
360 |
|
@@QName: createParserForTest |
361 |
|
@@ForCheck: ManakaiDOM|ForClass |
362 |
|
@@rdf:type: DISPerl|BlockCode |
363 |
|
@@PerlDef: |
364 |
|
require Message::DOM::GenericLS; |
365 |
|
$xp = <Class::ManakaiXMLParser> |
366 |
|
->new (<Class::gls|ManakaiGLSImplementation>->_new, ''); |
367 |
|
|
368 |
@Method: |
@Method: |
369 |
@@ManakaiDOM:isForInternal:1 |
@@ManakaiDOM:isForInternal:1 |
370 |
@@ForCheck: ManakaiDOM|ForClass |
@@ForCheck: ManakaiDOM|ForClass |
393 |
}, $self; |
}, $self; |
394 |
|
|
395 |
@Method: |
@Method: |
396 |
@@Name: parseString |
@@Name: parseURI |
397 |
@@enImplNote: |
@@enDesc: |
398 |
Non-standard - to be removed |
Parses an XML document identified by a DOM URI. |
399 |
|
|
400 |
|
It is equivalent to <M::.parse> method with its <P::input> |
401 |
|
parameter set to a <IF::LSInput> object whose |
402 |
|
<A::LSInput.systemId> set to <P::uri>. |
403 |
@@Param: |
@@Param: |
404 |
@@@Name: sourceText |
@@@Name: uri |
405 |
@@@Type: DOMString |
@@@Type: DOMString |
406 |
|
@@@enDesc: |
407 |
|
The DOM URI of the XML document to be read. |
408 |
@@Return: |
@@Return: |
409 |
@@@Type: Document |
@@@Type: Document |
410 |
|
@@@enDesc: |
411 |
|
The newly created and populated <IF::Document> node. |
412 |
|
@@@dx:raises: |
413 |
|
@@@@@: ManakaiDOMLS|MDOMLS_BUSY |
414 |
|
@@@@enDesc: |
415 |
|
If <A::LSParser.busy> is <DOM::true>. |
416 |
|
@@@dx:raises: |
417 |
|
@@@@@: DOMLS|PARSE_ERR |
418 |
|
@@@@enDesc: |
419 |
|
If the <IF::LSParser> was unable to load the document. |
420 |
@@@PerlDef: |
@@@PerlDef: |
421 |
|
__DEEP{ |
422 |
|
$r = $self-><M::LSParser.parse> ({system_id => $uri}); |
423 |
|
}__; |
424 |
|
|
425 |
|
@Method: |
426 |
|
@@Name: parse |
427 |
|
@@enDesc: |
428 |
|
Parses an XML document from a resource identified |
429 |
|
by a <IF::LSInput>. |
430 |
|
@@Param: |
431 |
|
@@@Name: input |
432 |
|
@@@Type: LSInput |
433 |
|
@@@enDesc: |
434 |
|
The <IF::LSInput> from which the source of the document |
435 |
|
is to be read. |
436 |
|
@@Return: |
437 |
|
@@@Type: Document |
438 |
|
@@@enDesc: |
439 |
|
The newly created and populated <IF::Document> node. |
440 |
|
@@@dx:raises: |
441 |
|
@@@@@: ManakaiDOMLS|MDOMLS_BUSY |
442 |
|
@@@@enDesc: |
443 |
|
If the <A::LSParser.busy> is <DOM::true>. |
444 |
|
@@@dx:raises: |
445 |
|
@@@@@: DOMLS|PARSE_ERR |
446 |
|
@@@@enDesc: |
447 |
|
If the <IF::LSParser> was unable to load the document. |
448 |
|
@@@PerlDef: |
449 |
|
if ($self->{<H::DOMLS|busy>}) { |
450 |
|
__EXCEPTION{ManakaiDOMLS|MDOMLS_BUSY}__; |
451 |
|
} |
452 |
|
local $self->{<H::DOMLS|busy>} = true; |
453 |
|
|
454 |
|
my $in; |
455 |
|
__DEEP{ |
456 |
|
$self->{parser_cfg} = $self-><AG::LSParser.domConfig>; |
457 |
|
## Parser's |domConfig| object. |
458 |
|
$self->{in_in} = $self->{parser_cfg} |
459 |
|
-><M::c|DOMConfiguration.getParameter> |
460 |
|
(<Q::xp|ls-input-to-input-file>); |
461 |
|
$in = $self->{in_in}-><M::ManakaiDOMLSInputToInputFile.resolveLSInput> |
462 |
|
($input, |
463 |
|
$self->{parser_cfg} |
464 |
|
-><M::c|DOMConfiguration.getParameter> |
465 |
|
('error-handler')); |
466 |
|
}__; |
467 |
|
unless (defined $in) { |
468 |
|
__c|ERROR{DOMLS|no-input-specified:: |
469 |
|
MDOMX:param-name => 'input', |
470 |
|
}__; |
471 |
|
__CODE{ParseError}__; |
472 |
|
} |
473 |
|
|
474 |
|
require IO::Handle; |
475 |
|
|
476 |
$self->{char} = []; |
$self->{char} = []; |
477 |
$self->{token} = []; |
$self->{token} = []; |
478 |
$self->{entity} = [{ |
$self->{entity} = [{ |
479 |
reptxt => \$sourceText, |
fh => $in-><AG::ManakaiDOMInputFile.filehandle>, |
480 |
|
base_uri => $in-><AG::ManakaiDOMInputFile.baseURI>, |
481 |
|
doc_uri => $in-><AG::ManakaiDOMInputFile.documentURI>, |
482 |
line => 1, |
line => 1, |
483 |
column => 1, |
column => 1, |
484 |
pos => 0, |
pos => 0, |
485 |
|
close_file => sub { $in-><M::ManakaiDOMInputFile.close> }, |
486 |
|
reptxt => \'', |
487 |
|
is_external_entity => true, |
488 |
}]; |
}]; |
489 |
|
## Entity stack. |
490 |
$self->{location} = $self->{entity}->[-1]; |
$self->{location} = $self->{entity}->[-1]; |
491 |
|
## Parsing location object as required by DPG. |
492 |
|
## It must always be equal to |{entity}->[-1]|. |
493 |
$self->{entity_char} = []; |
$self->{entity_char} = []; |
494 |
|
## Stack for |{char}| stacks analog to |{entity}| stack. |
495 |
$self->{entity_token} = []; |
$self->{entity_token} = []; |
496 |
|
## Stack for |{token}| stacks analog to |{entity}| stack. |
497 |
$self->{xml_version} = '1.0'; |
$self->{xml_version} = '1.0'; |
498 |
|
## Document XML version: either |1.0| or |1.1|. |
499 |
$self->{standalone} = false; |
$self->{standalone} = false; |
500 |
|
## True iff |standalone=yes| is explicitly specified. |
501 |
$self->{has_xref} = false; |
$self->{has_xref} = false; |
502 |
|
## There is an unread external entity. |
503 |
|
$self->{dont_process} = false; |
504 |
|
## So, don't process |ENTITY| and |ATTLIST| declarations. |
505 |
$self->{general_entity} = { |
$self->{general_entity} = { |
506 |
lt => {is_predefined => true}, |
lt => {is_predefined => true}, |
507 |
gt => {is_predefined => true}, |
gt => {is_predefined => true}, |
509 |
quot => {is_predefined => true}, |
quot => {is_predefined => true}, |
510 |
apos => {is_predefined => true}, |
apos => {is_predefined => true}, |
511 |
}; |
}; |
512 |
|
## Declared general entities. |
513 |
$self->{param_entity} = {}; |
$self->{param_entity} = {}; |
514 |
|
## Declared parameter entities. |
515 |
$self->{attr} = {}; |
$self->{attr} = {}; |
516 |
# $self->{attr}->{$element_type_name}->{$attr_name} = $attr_def |
# $self->{attr}->{$element_type_name}->{$attr_name} = $attr_def |
517 |
$self->{dont_process} = false; |
## Declared attributes. |
|
## Don't process |ENTITY| and |ATTLIST| declarations. |
|
518 |
|
|
519 |
__DEEP{ |
__DEEP{ |
520 |
$r = $self->{<H::c|implementation>}-><M::DOMImpl.createDocument>; |
$r = $self->{<H::c|implementation>}-><M::DOMImpl.createDocument>; |
521 |
$self->{doc} = $r; |
$self->{doc} = $r; |
522 |
$self->{doc_cfg} = $r-><AG::Document.domConfig>; |
## |Document| object. |
523 |
CORE::delete $self->{docx}; |
CORE::delete $self->{docx}; |
524 |
|
## |DocumentXDoctype| object (if necessary). |
525 |
|
$self->{doc_cfg} = $r-><AG::Document.domConfig>; |
526 |
|
## |Document|'s configuration. |
527 |
CORE::delete $self->{dtdef}; |
CORE::delete $self->{dtdef}; |
528 |
|
## |DocumentTypeDefinition| object (if created). |
529 |
CORE::delete $self->{dtdecl}; |
CORE::delete $self->{dtdecl}; |
530 |
|
## |DocumentTypeDeclaration| object (if created). |
531 |
|
|
532 |
$r-><AS::Document.strictErrorChecking> (false); |
$r-><AS::Document.strictErrorChecking> (false); |
533 |
## NOTE: Any checks such as |Name| validity done by |
## NOTE: Any checks such as |Name| validity done by |
564 |
## Document entity -> |Document| node |
## Document entity -> |Document| node |
565 |
$self->_parse_DocumentEntity; |
$self->_parse_DocumentEntity; |
566 |
|
|
567 |
|
for (@{$self->{entity}}) { |
568 |
|
$_->{close_file}->(); |
569 |
|
## NOTE: There should be only the document entity. |
570 |
|
} |
571 |
|
|
572 |
## Replacement tree for general |Entity| nodes |
## Replacement tree for general |Entity| nodes |
573 |
my @ent = values %{$self->{general_entity}}; |
my @ent = values %{$self->{general_entity}}; |
574 |
for my $ent (@ent) { |
for my $ent (@ent) { |
584 |
## TODO: External entity support |
## TODO: External entity support |
585 |
$self->_parse_InternalGeneralParsedEntity ($ent->{node}); |
$self->_parse_InternalGeneralParsedEntity ($ent->{node}); |
586 |
$ent->{node}-><AS::x|Entity.hasReplacementTree> (true); |
$ent->{node}-><AS::x|Entity.hasReplacementTree> (true); |
587 |
|
$self->{entity}->[-1]->{close_file}->(); |
588 |
## ISSUE: Should errors detected by this phase result |
## ISSUE: Should errors detected by this phase result |
589 |
## in |DOMLS:PARSE_ERR| exception thrown? |
## in |DOMLS:PARSE_ERR| exception thrown? |
590 |
} |
} |
618 |
if (@{$self->{char}}) { |
if (@{$self->{char}}) { |
619 |
$r = shift @{$self->{char}}; |
$r = shift @{$self->{char}}; |
620 |
} else { |
} else { |
|
no warnings 'substr'; |
|
|
## substr outside length warnings at the end of the string |
|
621 |
GETCHAR: { |
GETCHAR: { |
622 |
my $char = substr (${$self->{entity}->[-1]->{reptxt}}, |
no warnings 'closed'; # getc() on closed filehandle warning |
623 |
$self->{entity}->[-1]->{pos}, 1); |
my $ent = $self->{entity}->[-1]; |
624 |
|
my $char = getc $ent->{fh}; |
625 |
|
|
626 |
if (defined $char and length $char) { |
if (defined $char and length $char) { |
627 |
$self->{entity}->[-1]->{pos}++; |
$ent->{pos}++; |
628 |
$r = ord $char; |
$r = ord $char; |
629 |
if ($r == 0x000A) { |
if ($r == 0x000A) { |
630 |
$self->{entity}->[-1]->{line}++; |
$ent->{line}++; |
631 |
$self->{entity}->[-1]->{column} = 1; |
$ent->{column} = 1; |
632 |
} elsif ($r == 0x000D) { |
} elsif ($r == 0x000D) { |
633 |
my $next_char = substr (${$self->{entity}->[-1]->{reptxt}}, |
my $next_char = getc $ent->{fh}; |
|
$self->{entity}->[-1]->{pos}, 1); |
|
634 |
if ($next_char eq "\x0A") { |
if ($next_char eq "\x0A") { |
635 |
$self->{entity}->[-1]->{pos}++; |
if ($ent->{is_external_entity}) { |
636 |
$self->{entity}->[-1]->{line}++; |
$ent->{pos}++; |
637 |
$self->{entity}->[-1]->{column} = 1; |
$ent->{line}++; |
638 |
|
$ent->{column} = 1; |
639 |
|
$r = 0x000A; # ^ U+000D U+000A -> U+000A ^ |
640 |
|
} else { # Internal entity |
641 |
|
$ent->{column}++; |
642 |
|
## Line number will be increased by next |shiftChar|. |
643 |
|
$ent->{fh}->ungetc (0x000A); |
644 |
|
#$r = 0x000D; # ^ U+000D U+000A -> U+000D ^ U+000A |
645 |
|
# no change |
646 |
|
} |
647 |
} elsif ($next_char eq "\x85") { |
} elsif ($next_char eq "\x85") { |
648 |
if ($self->{xml_version} eq '1.1') { |
if ($self->{xml_version} eq '1.1') { |
649 |
if ($self->{entity}->[-1]->{no_xml11_eol}) { |
if ($ent->{is_external_entity}) { |
650 |
my $location = { |
if ($ent->{no_xml11_eol}) { |
651 |
utf32_offset => $self->{entity}->[-1]->{pos} - 1, |
my $location = { |
652 |
line_number => $self->{entity}->[-1]->{line}, |
utf32_offset => $ent->{pos} - 1, |
653 |
column_number => $self->{entity}->[-1]->{column}, |
line_number => $ent->{line}, |
654 |
}; |
column_number => $ent->{column}, |
655 |
my $continue = __DOMCore:ERROR{ |
}; |
656 |
xp|fatal-xml11-end-of-line-in-xml-declaration:: |
my $continue = __c|ERROR{ |
657 |
DOMCore|location => {$location}, |
xp|fatal-xml11-end-of-line-in-xml-declaration:: |
658 |
xp|character-number => {$r}, |
c|location => {$location}, |
659 |
}__; |
xp|character-number => {$r}, |
660 |
unless ($continue) { |
}__; |
661 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
unless ($continue) { |
662 |
} |
__CODE{ParseError}__; |
663 |
} # no_xml11_eol |
} |
664 |
$self->{entity}->[-1]->{pos}++; |
} # no_xml11_eol |
665 |
$self->{entity}->[-1]->{line}++; |
$ent->{pos}++; |
666 |
$self->{entity}->[-1]->{column} = 1; |
$ent->{line}++; |
667 |
} else { |
$ent->{column} = 1; |
668 |
|
$r = 0x000A; # ^ U+000D U+0085 -> U+000A ^ |
669 |
|
} else { # internal entity |
670 |
|
$ent->{column}++; |
671 |
|
## Line number will be increased by next |shiftChar|. |
672 |
|
$ent->{fh}->ungetc (0x0085); |
673 |
|
#$r = 0x000D; # ^ U+000D U+0085 -> U+000D ^ U+0085 |
674 |
|
# no change |
675 |
|
} |
676 |
|
} else { # XML 1.0 |
677 |
## |no_xml11_eol| will be tested later. |
## |no_xml11_eol| will be tested later. |
678 |
$self->{entity}->[-1]->{column}++; |
$ent->{column}++; |
679 |
## Line number will be increased by next |shiftChar| call. |
## Line number will be increased by next |shiftChar|. |
680 |
|
$ent->{fh}->ungetc (0x0085); |
681 |
|
$r = 0x000A if $ent->{is_external_entity}; |
682 |
|
# external: ^ U+000D U+0085 -> U+000A ^ U+0085 |
683 |
|
# internal: ^ U+000D U+0085 -> U+000D ^ U+0085 (as is) |
684 |
} |
} |
685 |
} else { |
} else { # neither U+000A nor U+0085 |
686 |
$self->{entity}->[-1]->{line}++; |
$ent->{line}++; |
687 |
$self->{entity}->[-1]->{column} = 1; |
$ent->{column} = 1; |
688 |
|
$ent->{fh}->ungetc (ord $next_char); |
689 |
|
$r = 0x000A if $ent->{is_external_entity}; |
690 |
|
# external: ^ U+000D _ -> U+000A ^ _ |
691 |
|
# internal: ^ U+000D _ -> U+000D ^ _ (as is) |
692 |
} |
} |
693 |
$r = 0x000A; |
} elsif ($r == 0x0085 or $r == 0x2028) { |
694 |
|
if ($ent->{no_xml11_eol}) { |
695 |
|
my $location = { |
696 |
|
utf32_offset => $ent->{pos} - 1, |
697 |
|
line_number => $ent->{line}, |
698 |
|
column_number => $ent->{column}, |
699 |
|
}; |
700 |
|
my $continue = __c|ERROR{ |
701 |
|
xp|fatal-xml11-end-of-line-in-xml-declaration:: |
702 |
|
c|location => {$location}, |
703 |
|
xp|character-number => {$r}, |
704 |
|
}__; |
705 |
|
unless ($continue) { |
706 |
|
__CODE{ParseError}__; |
707 |
|
} |
708 |
|
} # no_xml11_eol |
709 |
|
$r = 0x000A if $self->{xml_version} eq '1.1' and |
710 |
|
$ent->{is_external_entity}; |
711 |
|
## Even in XML 1.0 it increases the line number. |
712 |
|
$ent->{line}++; |
713 |
|
$ent->{column} = 1; |
714 |
} elsif ( |
} elsif ( |
715 |
not ((0x0020 <= $r and $r <= 0x007E) or |
not ((0x0020 <= $r and $r <= 0x007E) or |
716 |
(0x00A0 <= $r and $r <= 0xD7FF) or |
(0x00A0 <= $r and $r <= 0xD7FF) or |
717 |
(0xE000 <= $r and $r <= 0xFFFD) or |
(0xE000 <= $r and $r <= 0xFFFD) or |
718 |
(0x10000 <= $r and $r <= 0x10FFFF)) and |
(0x10000 <= $r and $r <= 0x10FFFF)) and |
719 |
$r != 0x0009 and $r != 0x0085 and |
$r != 0x0009 and |
720 |
not ($self->{xml_version} eq '1.0' and |
not (($self->{xml_version} eq '1.0' or |
721 |
(0x007F <= $r and $r <= 0x009F)) |
not $ent->{is_external_entity}) and |
722 |
|
(0x007F <= $r and $r <= 0x009F)) and |
723 |
|
not ($self->{xml_version} eq '1.1' and |
724 |
|
not $ent->{is_external_entity} and |
725 |
|
0x0001 <= $r and $r <= 0x001F) |
726 |
) { |
) { |
727 |
my $location = { |
my $location = { |
728 |
utf32_offset => $self->{entity}->[-1]->{pos} - 1, |
utf32_offset => $ent->{pos} - 1, |
729 |
line_number => $self->{entity}->[-1]->{line}, |
line_number => $ent->{line}, |
730 |
column_number => $self->{entity}->[-1]->{column}, |
column_number => $ent->{column}, |
731 |
}; |
}; |
732 |
my $continue = __DOMCore:ERROR{xp|wf-legal-literal-character:: |
my $continue = __c|ERROR{xp|wf-legal-literal-character:: |
733 |
DOMCore|location => {$location}, |
c|location => {$location}, |
734 |
xp|character-number => {$r}, |
xp|character-number => {$r}, |
735 |
}__; |
}__; |
736 |
unless ($continue) { |
unless ($continue) { |
737 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
738 |
} |
} |
739 |
$self->{entity}->[-1]->{column}++; |
$ent->{column}++; |
740 |
} elsif ($r == 0x0085 or $r == 0x2028) { |
} else { # XML |Char| |
741 |
if ($self->{entity}->[-1]->{no_xml11_eol}) { |
$ent->{column}++; |
|
my $location = { |
|
|
utf32_offset => $self->{entity}->[-1]->{pos} - 1, |
|
|
line_number => $self->{entity}->[-1]->{line}, |
|
|
column_number => $self->{entity}->[-1]->{column}, |
|
|
}; |
|
|
my $continue = __DOMCore:ERROR{ |
|
|
xp|fatal-xml11-end-of-line-in-xml-declaration:: |
|
|
DOMCore|location => {$location}, |
|
|
xp|character-number => {$r}, |
|
|
}__; |
|
|
unless ($continue) { |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
|
|
} |
|
|
} # no_xml11_eol |
|
|
$r = 0x000A if $self->{xml_version} eq '1.1'; |
|
|
## Even in XML 1.0 it increases the line number. |
|
|
$self->{entity}->[-1]->{line}++; |
|
|
$self->{entity}->[-1]->{column} = 1; |
|
|
} else { |
|
|
$self->{entity}->[-1]->{column}++; |
|
742 |
} |
} |
743 |
} else { |
} else { |
744 |
$r = -1; |
$r = -1; |
1039 |
xp|error-token => {$bad_token}, |
xp|error-token => {$bad_token}, |
1040 |
}__; |
}__; |
1041 |
unless ($continue) { |
unless ($continue) { |
1042 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1043 |
} |
} |
1044 |
} |
} |
1045 |
$self->{doc}-><AS::Document.xmlVersion> ($ver); |
$self->{doc}-><AS::Document.xmlVersion> ($ver); |
1099 |
xp|error-token => {$bad_token}, |
xp|error-token => {$bad_token}, |
1100 |
}__; |
}__; |
1101 |
unless ($continue) { |
unless ($continue) { |
1102 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1103 |
} |
} |
1104 |
} |
} |
1105 |
$self->{doc}-><AS::Document.xmlEncoding> ($ver); |
$self->{doc}-><AS::Document.xmlEncoding> ($ver); |
1158 |
xp|error-token => {$bad_token}, |
xp|error-token => {$bad_token}, |
1159 |
}__; |
}__; |
1160 |
unless ($continue) { |
unless ($continue) { |
1161 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1162 |
} |
} |
1163 |
} |
} |
1164 |
if ($ver eq 'yes') { |
if ($ver eq 'yes') { |
1258 |
xp|parent => {$parent}, |
xp|parent => {$parent}, |
1259 |
}__; |
}__; |
1260 |
unless ($continue) { |
unless ($continue) { |
1261 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
1262 |
} |
} |
1263 |
} |
} |
1264 |
__CODE{checkNCName:: $name => $name}__; |
__CODE{checkNCName:: $name => $name}__; |
1321 |
xp|parent => {$doctype}, |
xp|parent => {$doctype}, |
1322 |
}__; |
}__; |
1323 |
unless ($continue) { |
unless ($continue) { |
1324 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
1325 |
} |
} |
1326 |
} |
} |
1327 |
__CODE{checkNCName:: $name => $name}__; |
__CODE{checkNCName:: $name => $name}__; |
1506 |
infoset|namespaceName => {$nsuri}, |
infoset|namespaceName => {$nsuri}, |
1507 |
}__; |
}__; |
1508 |
unless ($continue) { |
unless ($continue) { |
1509 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1510 |
} |
} |
1511 |
} elsif ($lname eq 'xmlns') { |
} elsif ($lname eq 'xmlns') { |
1512 |
my $location; |
my $location; |
1521 |
infoset|namespaceName => {$nsuri}, |
infoset|namespaceName => {$nsuri}, |
1522 |
}__; |
}__; |
1523 |
unless ($continue) { |
unless ($continue) { |
1524 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1525 |
} |
} |
1526 |
} |
} |
1527 |
if ($nsuri eq '') { |
if ($nsuri eq '') { |
1538 |
infoset|prefix => {$lname}, |
infoset|prefix => {$lname}, |
1539 |
}__; |
}__; |
1540 |
unless ($continue) { |
unless ($continue) { |
1541 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1542 |
} |
} |
1543 |
} |
} |
1544 |
} elsif ($nsuri eq <Q::xml:> and |
} elsif ($nsuri eq <Q::xml:> and |
1556 |
infoset|namespaceName => {$nsuri}, |
infoset|namespaceName => {$nsuri}, |
1557 |
}__; |
}__; |
1558 |
unless ($continue) { |
unless ($continue) { |
1559 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1560 |
} |
} |
1561 |
} elsif ($nsuri eq <Q::xmlns:>) { |
} elsif ($nsuri eq <Q::xmlns:>) { |
1562 |
my $location; |
my $location; |
1572 |
infoset|namespaceName => {$nsuri}, |
infoset|namespaceName => {$nsuri}, |
1573 |
}__; |
}__; |
1574 |
unless ($continue) { |
unless ($continue) { |
1575 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1576 |
} |
} |
1577 |
} |
} |
1578 |
$ns->{$lname} = $nsuri; |
$ns->{$lname} = $nsuri; |
1622 |
infoset|namespaceName => {<Q::xml:>}, |
infoset|namespaceName => {<Q::xml:>}, |
1623 |
}__; |
}__; |
1624 |
unless ($continue) { |
unless ($continue) { |
1625 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1626 |
} |
} |
1627 |
} elsif ($ns->{''} eq <Q::xmlns:>) { |
} elsif ($ns->{''} eq <Q::xmlns:>) { |
1628 |
my $location; |
my $location; |
1638 |
infoset|namespaceName => {<Q::xmlns:>}, |
infoset|namespaceName => {<Q::xmlns:>}, |
1639 |
}__; |
}__; |
1640 |
unless ($continue) { |
unless ($continue) { |
1641 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1642 |
} |
} |
1643 |
} |
} |
1644 |
} else { |
} else { |
1665 |
xp|name => {$type}, |
xp|name => {$type}, |
1666 |
}__; |
}__; |
1667 |
unless ($continue) { |
unless ($continue) { |
1668 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1669 |
} |
} |
1670 |
} |
} |
1671 |
} else { ## Default namespace |
} else { ## Default namespace |
1725 |
infoset|prefix => {$pfx}, |
infoset|prefix => {$pfx}, |
1726 |
}__; |
}__; |
1727 |
unless ($continue) { |
unless ($continue) { |
1728 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1729 |
} |
} |
1730 |
} |
} |
1731 |
my $attr = $el-><M::Element.getAttributeNodeNS> |
my $attr = $el-><M::Element.getAttributeNodeNS> |
1748 |
infoset|localName => {$lname}, |
infoset|localName => {$lname}, |
1749 |
}__; |
}__; |
1750 |
unless ($continue) { |
unless ($continue) { |
1751 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1752 |
} |
} |
1753 |
unless ($attr-><AG::t|Attr.specified>) { |
unless ($attr-><AG::t|Attr.specified>) { |
1754 |
## It is a default attribute |
## It is a default attribute |
1846 |
xp|node => {$node}, |
xp|node => {$node}, |
1847 |
}__; |
}__; |
1848 |
unless ($continue) { |
unless ($continue) { |
1849 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1850 |
} |
} |
1851 |
} |
} |
1852 |
} |
} |
1870 |
xp|node => {$node}, |
xp|node => {$node}, |
1871 |
}__; |
}__; |
1872 |
unless ($continue) { |
unless ($continue) { |
1873 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
1874 |
} |
} |
1875 |
$node = shift @{$nodes}; |
$node = shift @{$nodes}; |
1876 |
} |
} |
2039 |
xp|name => {$atqname}, |
xp|name => {$atqname}, |
2040 |
}__; |
}__; |
2041 |
unless ($continue) { |
unless ($continue) { |
2042 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2043 |
} |
} |
2044 |
} |
} |
2045 |
|
|
2218 |
xp|token => {$token}, |
xp|token => {$token}, |
2219 |
}__; |
}__; |
2220 |
unless ($continue) { |
unless ($continue) { |
2221 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2222 |
} |
} |
2223 |
|
|
2224 |
my $text = $self->{doc}-><M::Document.createTextNode> ('<'); |
my $text = $self->{doc}-><M::Document.createTextNode> ('<'); |
2286 |
xp|parent => {$parent}, |
xp|parent => {$parent}, |
2287 |
}__; |
}__; |
2288 |
unless ($continue) { |
unless ($continue) { |
2289 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2290 |
} |
} |
2291 |
} |
} |
2292 |
my $ncr = $doc-><M::Document.createTextNode> (chr $num); |
my $ncr = $doc-><M::Document.createTextNode> (chr $num); |
2325 |
xp|character-number => {$num}, |
xp|character-number => {$num}, |
2326 |
}__; |
}__; |
2327 |
unless ($continue) { |
unless ($continue) { |
2328 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2329 |
} |
} |
2330 |
} |
} |
2331 |
my $ncr = $doc-><M::Document.createTextNode> |
my $ncr = $doc-><M::Document.createTextNode> |
2371 |
xp|character-number => {$num}, |
xp|character-number => {$num}, |
2372 |
}__; |
}__; |
2373 |
unless ($continue) { |
unless ($continue) { |
2374 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2375 |
} |
} |
2376 |
} |
} |
2377 |
my $ncr = $self->{doc}-><M::Document.createTextNode> |
my $ncr = $self->{doc}-><M::Document.createTextNode> |
2413 |
xp|character-number => {$num}, |
xp|character-number => {$num}, |
2414 |
}__; |
}__; |
2415 |
unless ($continue) { |
unless ($continue) { |
2416 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2417 |
} |
} |
2418 |
} |
} |
2419 |
push @{$vals}, chr $num; |
push @{$vals}, chr $num; |
2452 |
xp|parent => {$parent}, |
xp|parent => {$parent}, |
2453 |
}__; |
}__; |
2454 |
unless ($continue) { |
unless ($continue) { |
2455 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2456 |
} |
} |
2457 |
} |
} |
2458 |
my $ncr = $doc-><M::Document.createTextNode> |
my $ncr = $doc-><M::Document.createTextNode> |
2492 |
xp|character-number => {$num}, |
xp|character-number => {$num}, |
2493 |
}__; |
}__; |
2494 |
unless ($continue) { |
unless ($continue) { |
2495 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2496 |
} |
} |
2497 |
} |
} |
2498 |
my $ncr = $doc-><M::Document.createTextNode> |
my $ncr = $doc-><M::Document.createTextNode> |
2538 |
xp|character-number => {$num}, |
xp|character-number => {$num}, |
2539 |
}__; |
}__; |
2540 |
unless ($continue) { |
unless ($continue) { |
2541 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2542 |
} |
} |
2543 |
} |
} |
2544 |
my $ncr = $self->{doc}-><M::Document.createTextNode> |
my $ncr = $self->{doc}-><M::Document.createTextNode> |
2579 |
xp|character-number => {$num}, |
xp|character-number => {$num}, |
2580 |
}__; |
}__; |
2581 |
unless ($continue) { |
unless ($continue) { |
2582 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2583 |
} |
} |
2584 |
} |
} |
2585 |
push @{$vals}, chr $num; |
push @{$vals}, chr $num; |
2651 |
xp|name => {$name}, |
xp|name => {$name}, |
2652 |
}__; |
}__; |
2653 |
unless ($continue) { |
unless ($continue) { |
2654 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2655 |
} |
} |
2656 |
} # Otherwise VC error |
} # Otherwise VC error |
2657 |
push @{$self->{entity}}, <Code::getEmptyEntityState:: |
push @{$self->{entity}}, <Code::getEmptyEntityState:: |
2673 |
xp|name => {$name}, |
xp|name => {$name}, |
2674 |
}__; |
}__; |
2675 |
unless ($continue) { |
unless ($continue) { |
2676 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2677 |
} |
} |
2678 |
} |
} |
2679 |
$er-><AS::x|EntityReference.isExpanded> |
$er-><AS::x|EntityReference.isExpanded> |
2694 |
xp|name => {$name}, |
xp|name => {$name}, |
2695 |
}__; |
}__; |
2696 |
unless ($continue) { |
unless ($continue) { |
2697 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
2698 |
} |
} |
2699 |
} # if unparsed entity |
} # if unparsed entity |
2700 |
|
|
2710 |
xp|name => {$name}, |
xp|name => {$name}, |
2711 |
}__; |
}__; |
2712 |
unless ($continue) { |
unless ($continue) { |
2713 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
2714 |
} |
} |
2715 |
$self->{entity}->[-1]->{reptxt} = \''; |
open my $empty, '<', \''; |
2716 |
|
$self->{entity}->[-1]->{fh} = $empty; |
2717 |
$er-><AS::x|EntityReference.isExpanded> (false); |
$er-><AS::x|EntityReference.isExpanded> (false); |
2718 |
} # recursive |
} # recursive |
2719 |
$ent->{is_opened} = true; |
$ent->{is_opened} = true; |
2734 |
if $self->{general_entity}->{$self->{entity}->[-1]->{name}}; |
if $self->{general_entity}->{$self->{entity}->[-1]->{name}}; |
2735 |
$self->{token} = pop @{$self->{entity_token}}; |
$self->{token} = pop @{$self->{entity_token}}; |
2736 |
$self->{char} = pop @{$self->{entity_char}}; |
$self->{char} = pop @{$self->{entity_char}}; |
2737 |
pop @{$self->{entity}}; |
pop (@{$self->{entity}})->{close_file}->(); |
2738 |
$self->{location} = $self->{entity}->[-1]; |
$self->{location} = $self->{entity}->[-1]; |
2739 |
} |
} |
2740 |
|
|
2813 |
xp|name => {$name}, |
xp|name => {$name}, |
2814 |
}__; |
}__; |
2815 |
unless ($continue) { |
unless ($continue) { |
2816 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2817 |
} |
} |
2818 |
} # Otherwise VC error |
} # Otherwise VC error |
2819 |
push @{$self->{entity}}, <Code::getEmptyEntityState:: |
push @{$self->{entity}}, <Code::getEmptyEntityState:: |
2835 |
xp|name => {$name}, |
xp|name => {$name}, |
2836 |
}__; |
}__; |
2837 |
unless ($continue) { |
unless ($continue) { |
2838 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2839 |
} |
} |
2840 |
} |
} |
2841 |
|
|
2851 |
xp|name => {$name}, |
xp|name => {$name}, |
2852 |
}__; |
}__; |
2853 |
unless ($continue) { |
unless ($continue) { |
2854 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
2855 |
} |
} |
2856 |
## NOTE: |xp:wf-parsed-entity| is not checked |
## NOTE: |xp:wf-parsed-entity| is not checked |
2857 |
} # if external entity |
} # if external entity |
2874 |
xp|name => {$name}, |
xp|name => {$name}, |
2875 |
}__; |
}__; |
2876 |
unless ($continue) { |
unless ($continue) { |
2877 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
2878 |
} |
} |
2879 |
$self->{entity}->[-1]->{reptxt} = \''; |
open my $empty, '<', \''; |
2880 |
|
$self->{entity}->[-1]->{fh} = $empty; |
2881 |
$er-><AS::x|EntityReference.isExpanded> (false); |
$er-><AS::x|EntityReference.isExpanded> (false); |
2882 |
} # recursive |
} # recursive |
2883 |
$ent->{is_opened} = true; |
$ent->{is_opened} = true; |
2899 |
if $self->{general_entity}->{$self->{entity}->[-1]->{name}}; |
if $self->{general_entity}->{$self->{entity}->[-1]->{name}}; |
2900 |
$self->{token} = pop @{$self->{entity_token}}; |
$self->{token} = pop @{$self->{entity_token}}; |
2901 |
$self->{char} = pop @{$self->{entity_char}}; |
$self->{char} = pop @{$self->{entity_char}}; |
2902 |
pop @{$self->{entity}}; |
pop (@{$self->{entity}})->{close_file}->(); |
2903 |
$self->{location} = $self->{entity}->[-1]; |
$self->{location} = $self->{entity}->[-1]; |
2904 |
} |
} |
2905 |
|
|
2976 |
xp|name => {$name}, |
xp|name => {$name}, |
2977 |
}__; |
}__; |
2978 |
unless ($continue) { |
unless ($continue) { |
2979 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
2980 |
} |
} |
2981 |
} # Otherwise VC error |
} # Otherwise VC error |
2982 |
push @{$self->{entity}}, <Code::getEmptyEntityState:: |
push @{$self->{entity}}, <Code::getEmptyEntityState:: |
2998 |
xp|name => {$name}, |
xp|name => {$name}, |
2999 |
}__; |
}__; |
3000 |
unless ($continue) { |
unless ($continue) { |
3001 |
__EXCEPTION{DOMLS|PARSE_ERR}__; |
__CODE{ParseError}__; |
3002 |
} |
} |
3003 |
} |
} |
3004 |
|
|
3014 |
xp|name => {$name}, |
xp|name => {$name}, |
3015 |
}__; |
}__; |
3016 |
unless ($continue) { |
unless ($continue) { |
3017 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
3018 |
} |
} |
3019 |
## NOTE: |xp:wf-parsed-entity| is not checked |
## NOTE: |xp:wf-parsed-entity| is not checked |
3020 |
} # if external entity |
} # if external entity |
3037 |
xp|name => {$name}, |
xp|name => {$name}, |
3038 |
}__; |
}__; |
3039 |
unless ($continue) { |
unless ($continue) { |
3040 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
3041 |
} |
} |
3042 |
$self->{entity}->[-1]->{reptxt} = \''; |
open my $empty, '<', \''; |
3043 |
|
$self->{entity}->[-1]->{fh} = $empty; |
3044 |
$er-><AS::x|EntityReference.isExpanded> (false); |
$er-><AS::x|EntityReference.isExpanded> (false); |
3045 |
} # recursive |
} # recursive |
3046 |
$ent->{is_opened} = true; |
$ent->{is_opened} = true; |
3062 |
if $self->{general_entity}->{$self->{entity}->[-1]->{name}}; |
if $self->{general_entity}->{$self->{entity}->[-1]->{name}}; |
3063 |
$self->{token} = pop @{$self->{entity_token}}; |
$self->{token} = pop @{$self->{entity_token}}; |
3064 |
$self->{char} = pop @{$self->{entity_char}}; |
$self->{char} = pop @{$self->{entity_char}}; |
3065 |
pop @{$self->{entity}}; |
pop (@{$self->{entity}})->{close_file}->(); |
3066 |
$self->{location} = $self->{entity}->[-1]; |
$self->{location} = $self->{entity}->[-1]; |
3067 |
} |
} |
3068 |
|
|
3242 |
c|location => {$location}, |
c|location => {$location}, |
3243 |
}__; |
}__; |
3244 |
unless ($continue) { |
unless ($continue) { |
3245 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
3246 |
} |
} |
3247 |
} |
} |
3248 |
|
|
3549 |
xp|name => {$v}, |
xp|name => {$v}, |
3550 |
}__; |
}__; |
3551 |
unless ($continue) { |
unless ($continue) { |
3552 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
3553 |
} |
} |
3554 |
} elsif ($self->{dont_process} and not $self->{standalone}) { |
} elsif ($self->{dont_process} and not $self->{standalone}) { |
3555 |
my $location; |
my $location; |
3564 |
xp|name => {$v}, |
xp|name => {$v}, |
3565 |
}__; |
}__; |
3566 |
unless ($continue) { |
unless ($continue) { |
3567 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
3568 |
} |
} |
3569 |
} else { |
} else { |
3570 |
$et-><M::ETDef.setAttributeDefinitionNode> ($at); |
$et-><M::ETDef.setAttributeDefinitionNode> ($at); |
3774 |
|
|
3775 |
my $is_param_entity; |
my $is_param_entity; |
3776 |
my $decl; |
my $decl; |
3777 |
lang:Perl { $decl = { name => '#ILLEGAL', reptxt => \'' }; } |
lang:Perl { |
3778 |
|
$decl = { |
3779 |
|
name => '#ILLEGAL', |
3780 |
|
reptxt => \'', |
3781 |
|
is_external_entity => false, |
3782 |
|
document_uri => $self->{location}->{document_uri}, |
3783 |
|
base_uri => $self->{location}->{base_uri}, |
3784 |
|
}; |
3785 |
|
} |
3786 |
|
|
3787 |
~? (PERO) { |
~? (PERO) { |
3788 |
~ (S) { } |
~ (S) { } |
3855 |
c|location => {$location}, |
c|location => {$location}, |
3856 |
}__; |
}__; |
3857 |
unless ($continue) { |
unless ($continue) { |
3858 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
3859 |
} |
} |
3860 |
} |
} |
3861 |
} |
} |
3893 |
xp|name => {$decl->{name}}, |
xp|name => {$decl->{name}}, |
3894 |
}__; |
}__; |
3895 |
unless ($continue) { |
unless ($continue) { |
3896 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
3897 |
} |
} |
3898 |
} elsif ( |
} elsif ( |
3899 |
not ({gt => true, apos => true, quot => true}->{$decl->{name}} and |
not ({gt => true, apos => true, quot => true}->{$decl->{name}} and |
3923 |
xp|replacement-text => {${$decl->{reptxt}}}, |
xp|replacement-text => {${$decl->{reptxt}}}, |
3924 |
}__; |
}__; |
3925 |
unless ($continue) { |
unless ($continue) { |
3926 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
3927 |
} |
} |
3928 |
} |
} |
3929 |
$self->{dtdecl}->{<H::mn:node>}->{{ |
$self->{dtdecl}->{<H::mn:node>}->{{ |
3945 |
xp|name => {$decl->{name}}, |
xp|name => {$decl->{name}}, |
3946 |
}__; |
}__; |
3947 |
unless ($continue) { |
unless ($continue) { |
3948 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
3949 |
} |
} |
3950 |
} |
} |
3951 |
} elsif ($self->{dont_process} and not $self->{standalone}) { |
} elsif ($self->{dont_process} and not $self->{standalone}) { |
3961 |
xp|name => {$decl->{name}}, |
xp|name => {$decl->{name}}, |
3962 |
}__; |
}__; |
3963 |
unless ($continue) { |
unless ($continue) { |
3964 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
3965 |
} |
} |
3966 |
} else { |
} else { |
3967 |
$self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'} |
$self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'} |
4045 |
xp|name => {$name}, |
xp|name => {$name}, |
4046 |
}__; |
}__; |
4047 |
unless ($continue) { |
unless ($continue) { |
4048 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
4049 |
} |
} |
4050 |
} else { |
} else { |
4051 |
$self->{dtdef}-><M::DTDef.setNotationNode> ($decl); |
$self->{dtdef}-><M::DTDef.setNotationNode> ($decl); |
4099 |
xp|name => {$name}, |
xp|name => {$name}, |
4100 |
}__; |
}__; |
4101 |
unless ($continue) { |
unless ($continue) { |
4102 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
4103 |
} |
} |
4104 |
} |
} |
4105 |
} |
} |
4200 |
xp|name => {$name}, |
xp|name => {$name}, |
4201 |
}__; |
}__; |
4202 |
unless ($continue) { |
unless ($continue) { |
4203 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
4204 |
} |
} |
4205 |
} |
} |
4206 |
} |
} |
5048 |
DOMCore|location => {$location}, |
DOMCore|location => {$location}, |
5049 |
}__; |
}__; |
5050 |
unless ($continue) { |
unless ($continue) { |
5051 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
5052 |
} |
} |
5053 |
} |
} |
5054 |
} // default |
} // default |
5055 |
|
|
5056 |
@ResourceDef: |
@ResourceDef: |
5057 |
@@ForCheck: ManakaiDOM|ForClass |
@@ForCheck: ManakaiDOM|ForClass |
5058 |
|
@@QName: ParseError |
5059 |
|
@@rdf:type: DISPerl|BlockCode |
5060 |
|
@@PerlDef: |
5061 |
|
__DEEP{ |
5062 |
|
for (@{$self->{entity}}) { |
5063 |
|
$_->{close_file}->(); |
5064 |
|
} |
5065 |
|
}__; |
5066 |
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
5067 |
|
|
5068 |
|
@ResourceDef: |
5069 |
|
@@ForCheck: ManakaiDOM|ForClass |
5070 |
@@QName: checkNCName |
@@QName: checkNCName |
5071 |
@@rdf:type: DISPerl|BlockCode |
@@rdf:type: DISPerl|BlockCode |
5072 |
@@PerlDef: |
@@PerlDef: |
5086 |
infoset|version => {$self->{xml_version}}, |
infoset|version => {$self->{xml_version}}, |
5087 |
}__; |
}__; |
5088 |
unless ($__continue) { |
unless ($__continue) { |
5089 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
5090 |
} |
} |
5091 |
} elsif (index ($name, ':') > -1) { |
} elsif (index ($name, ':') > -1) { |
5092 |
my $__location; |
my $__location; |
5101 |
infoset|version => {$self->{xml_version}}, |
infoset|version => {$self->{xml_version}}, |
5102 |
}__; |
}__; |
5103 |
unless ($__continue) { |
unless ($__continue) { |
5104 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
5105 |
} |
} |
5106 |
} |
} |
5107 |
|
|
5126 |
infoset|version => {$self->{xml_version}}, |
infoset|version => {$self->{xml_version}}, |
5127 |
}__; |
}__; |
5128 |
unless ($__continue) { |
unless ($__continue) { |
5129 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
5130 |
} |
} |
5131 |
} elsif (($self->{xml_version} eq '1.0' and |
} elsif (($self->{xml_version} eq '1.0' and |
5132 |
not <Code::DOMMain|testXML10QName:: $INPUT = $name>) or |
not <Code::DOMMain|testXML10QName:: $INPUT = $name>) or |
5144 |
infoset|version => {$self->{xml_version}}, |
infoset|version => {$self->{xml_version}}, |
5145 |
}__; |
}__; |
5146 |
unless ($__continue) { |
unless ($__continue) { |
5147 |
__EXCEPTION{DOMLS|PARSE_ERR:: |
__CODE{ParseError}__; |
|
}__; |
|
5148 |
} |
} |
5149 |
} |
} |
5150 |
|
|
5315 |
@@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 35); } /* U+009F */ |
@@@c:erred: <[[xp|wf-legal-literal-character]]> { (2, 35); } /* U+009F */ |
5316 |
|
|
5317 |
@@XMLTest: |
@@XMLTest: |
5318 |
|
@@@QName: xp.c0.internal.entity.xml11.1.test |
5319 |
|
@@@DEnt: |
5320 |
|
@@@@test:value: |
5321 |
|
<?xml version="1.1"?> |
5322 |
|
<!DOCTYPE a [ |
5323 |
|
<!ENTITY e "$ |
5324 |
|
	

$ |
5325 |
|
$ |
5326 |
|
"> |
5327 |
|
]><a/> |
5328 |
|
@@@test:domTree: |
5329 |
|
document { |
5330 |
|
document-type { |
5331 |
|
general-entity { |
5332 |
|
node-name: 'e'; |
5333 |
|
text-content: U+0001 U+0002 U+0003 U+0004 U+0005 |
5334 |
|
U+0006 U+0007 U+0008 U+0009 U+000A U+000B |
5335 |
|
U+000C U+000D U+000E U+000F |
5336 |
|
U+0010 U+0011 U+0012 U+0013 U+0014 U+0015 |
5337 |
|
U+0016 U+0017 U+0018 U+0019 U+001A U+001B |
5338 |
|
U+001C U+001D U+001E U+001F; |
5339 |
|
} |
5340 |
|
} |
5341 |
|
element { } |
5342 |
|
} |
5343 |
|
@@XMLTest: |
5344 |
|
@@@QName: xp.c1.internal.entity.xml11.1.test |
5345 |
|
@@@DEnt: |
5346 |
|
@@@@test:value: |
5347 |
|
<?xml version="1.1"?> |
5348 |
|
<!DOCTYPE a [ |
5349 |
|
<!ENTITY e "€‚ƒ„…†‡$ |
5350 |
|
ˆ‰Š‹ŒŽ$ |
5351 |
|
‘’“”•–—$ |
5352 |
|
˜™š›œžŸ"> |
5353 |
|
]><a/> |
5354 |
|
@@@test:domTree: |
5355 |
|
document { |
5356 |
|
document-type { |
5357 |
|
general-entity { |
5358 |
|
node-name: 'e'; |
5359 |
|
text-content: U+0080 U+0081 U+0082 U+0083 U+0084 U+0085 |
5360 |
|
U+0086 U+0087 U+0088 U+0089 U+008A U+008B |
5361 |
|
U+008C U+008D U+008E U+008F |
5362 |
|
U+0090 U+0091 U+0092 U+0093 U+0094 U+0095 |
5363 |
|
U+0096 U+0097 U+0098 U+0099 U+009A U+009B |
5364 |
|
U+009C U+009D U+009E U+009F U+007F; |
5365 |
|
} |
5366 |
|
} |
5367 |
|
element { } |
5368 |
|
} |
5369 |
|
|
5370 |
|
@@XMLTest: |
5371 |
@@@QName: xp.syntax.empty.test |
@@@QName: xp.syntax.empty.test |
5372 |
@@@DEnt: |
@@@DEnt: |
5373 |
@@@@test:value: \ |
@@@@test:value: \ |
7467 |
} |
} |
7468 |
element { } |
element { } |
7469 |
} |
} |
7470 |
|
|
7471 |
|
@@XMLTest: |
7472 |
|
@@@QName: xp.xml10.endofline.internal.1.test |
7473 |
|
@@@DEnt: |
7474 |
|
@@@@test:value: |
7475 |
|
<?xml version="1.0"?> |
7476 |
|
<!DOCTYPE a [ |
7477 |
|
<!ENTITY e "
 
 … 
 $ |
7478 |
|

… 
"> |
7479 |
|
]><a>&e;</a> |
7480 |
|
@@@test:domTree: |
7481 |
|
document { |
7482 |
|
xml-version: '1.0'; |
7483 |
|
document-type { |
7484 |
|
general-entity { |
7485 |
|
node-name: 'e'; |
7486 |
|
text-content: U+000D ' ' U+000A ' ' U+0085 ' ' |
7487 |
|
U+000D U+000A ' ' U+000D U+0085 ' ' U+2028; |
7488 |
|
} |
7489 |
|
} |
7490 |
|
element { |
7491 |
|
text-content: U+000D ' ' U+000A ' ' U+0085 ' ' |
7492 |
|
U+000D U+000A ' ' U+000D U+0085 ' ' U+2028; |
7493 |
|
} |
7494 |
|
} |
7495 |
|
@@XMLTest: |
7496 |
|
@@@QName: xp.xml11.endofline.internal.1.test |
7497 |
|
@@@DEnt: |
7498 |
|
@@@@test:value: |
7499 |
|
<?xml version="1.1"?> |
7500 |
|
<!DOCTYPE a [ |
7501 |
|
<!ENTITY e "
 
 … 
 $ |
7502 |
|

… 
"> |
7503 |
|
]><a>&e;</a> |
7504 |
|
@@@test:domTree: |
7505 |
|
document { |
7506 |
|
xml-version: '1.1'; |
7507 |
|
document-type { |
7508 |
|
general-entity { |
7509 |
|
node-name: 'e'; |
7510 |
|
text-content: U+000D ' ' U+000A ' ' U+0085 ' ' |
7511 |
|
U+000D U+000A ' ' U+000D U+0085 ' ' U+2028; |
7512 |
|
} |
7513 |
|
} |
7514 |
|
element { |
7515 |
|
text-content: U+000D ' ' U+000A ' ' U+0085 ' ' |
7516 |
|
U+000D U+000A ' ' U+000D U+0085 ' ' U+2028; |
7517 |
|
} |
7518 |
|
} |
7519 |
|
|
7520 |
@@XMLTest: |
@@XMLTest: |
7521 |
@@@QName: xp.noxmldecl.pi.pi.test |
@@@QName: xp.noxmldecl.pi.pi.test |
7522 |
@@@DEnt: |
@@@DEnt: |
12605 |
@@@@test:value: |
@@@@test:value: |
12606 |
<?xml version="1.1"?> |
<?xml version="1.1"?> |
12607 |
<!DOCTYPE a [ |
<!DOCTYPE a [ |
12608 |
<!ENTITY e PUBLIC " p $u0085$u000Aq" "s"> |
<!ENTITY e PUBLIC " p $u000D$u0085q" "s"> |
12609 |
]><a/> |
]><a/> |
12610 |
@@@test:domTree: |
@@@test:domTree: |
12611 |
document { |
document { |
14673 |
return true; # continue as far as possible |
return true; # continue as far as possible |
14674 |
}); |
}); |
14675 |
|
|
14676 |
|
my $input = {string_data => \$doc_ent->{<Q::test:value>}, |
14677 |
|
system_id => $doc_ent->{<Q::test:uri>}, |
14678 |
|
base_uri => $doc_ent->{<Q::test:baseURI>}}; |
14679 |
if ($test_data->{dom_tree}) { # Successful test |
if ($test_data->{dom_tree}) { # Successful test |
14680 |
try { |
try { |
14681 |
my $doc = $parser->parse_string ($doc_ent->{<H::test:value>}); |
my $doc = $parser->parse ($input); |
14682 |
$test->assert_dom_tree_equals |
$test->assert_dom_tree_equals |
14683 |
(actual_value => $doc, |
(actual_value => $doc, |
14684 |
expected_hash => $test_data->{dom_tree}); |
expected_hash => $test_data->{dom_tree}); |
14702 |
}; |
}; |
14703 |
} else { |
} else { |
14704 |
try { |
try { |
14705 |
my $doc = $parser->parse_string ($doc_ent->{<H::test:value>}); |
my $doc = $parser->parse ($input); |
14706 |
} catch Message::Util::IF::DTException with { |
} catch Message::Util::IF::DTException with { |
14707 |
# |
# |
14708 |
} catch Message::DOM::IF::LSException with { |
} catch Message::DOM::IF::LSException with { |
14730 |
@@ForCheck: ManakaiDOM|ForClass |
@@ForCheck: ManakaiDOM|ForClass |
14731 |
@@PerlDef: |
@@PerlDef: |
14732 |
{reptxt => \'', line => 1, column => 1, pos => 0, |
{reptxt => \'', line => 1, column => 1, pos => 0, |
14733 |
is_externally_declared => true, name => $name} |
is_externally_declared => true, name => $name, |
14734 |
|
fh => do { |
14735 |
|
open my $empty, '<', \''; |
14736 |
|
$empty; |
14737 |
|
}, |
14738 |
|
close_file => sub { }} |
14739 |
|
|
14740 |
@ResourceDef: |
@ResourceDef: |
14741 |
@@QName: getCopyOfEntityState |
@@QName: getCopyOfEntityState |
14743 |
@@ForCheck: ManakaiDOM|ForClass |
@@ForCheck: ManakaiDOM|ForClass |
14744 |
@@PerlDef: |
@@PerlDef: |
14745 |
{%{$self->{$entity_type}->{$entity_name}}, |
{%{$self->{$entity_type}->{$entity_name}}, |
14746 |
line => 1, column => 1, pos => 0} |
line => 1, column => 1, pos => 0, |
14747 |
|
fh => do { |
14748 |
|
require IO::String; |
14749 |
|
IO::String->new |
14750 |
|
(${$self->{$entity_type}->{$entity_name}->{reptxt}}); |
14751 |
|
## TODO: External entities. |
14752 |
|
}, |
14753 |
|
close_file => sub { }} |
14754 |
##ManakaiXMLParser |
##ManakaiXMLParser |
14755 |
|
|
14756 |
ElementTypeBinding: |
ElementTypeBinding: |
14757 |
|
@Name: Test |
14758 |
|
@ElementType: |
14759 |
|
dis:ResourceDef |
14760 |
|
@ShadowContent: |
14761 |
|
@@ForCheck: ManakaiDOM|ForClass |
14762 |
|
@@rdf:type: test|StandaloneTest |
14763 |
|
|
14764 |
|
ElementTypeBinding: |
14765 |
@Name: XMLTests |
@Name: XMLTests |
14766 |
@ElementType: |
@ElementType: |
14767 |
dis:ResourceDef |
dis:ResourceDef |
15562 |
@AliasFor: DOMCore|DOMImplementation |
@AliasFor: DOMCore|DOMImplementation |
15563 |
@For: ManakaiDOM|DOM |
@For: ManakaiDOM|DOM |
15564 |
|
|
15565 |
|
ResourceDef: |
15566 |
|
@QName: LSInput |
15567 |
|
@AliasFor: DOMLS|LSInput |
15568 |
|
@For: ManakaiDOM|DOM |
15569 |
|
|
15570 |
|
ResourceDef: |
15571 |
|
@QName: LSParser |
15572 |
|
@AliasFor: DOMLS|LSParser |
15573 |
|
@For: ManakaiDOM|DOM |
15574 |
|
|
15575 |
ElementTypeBinding: |
ElementTypeBinding: |
15576 |
@Name: Attr |
@Name: Attr |
15577 |
@ElementType: |
@ElementType: |
15631 |
@@ContentType: lang|Perl |
@@ContentType: lang|Perl |
15632 |
|
|
15633 |
ElementTypeBinding: |
ElementTypeBinding: |
15634 |
|
@Name: PerlDefC |
15635 |
|
@ElementType: |
15636 |
|
dis:Def |
15637 |
|
@ShadowContent: |
15638 |
|
@@ContentType: lang|Perl |
15639 |
|
|
15640 |
|
ElementTypeBinding: |
15641 |
@Name: PropDef |
@Name: PropDef |
15642 |
@ElementType: |
@ElementType: |
15643 |
dis:ResourceDef |
dis:ResourceDef |
15721 |
@@@@PerlDef: |
@@@@PerlDef: |
15722 |
my $pos = $o-><AG::DOMCore|DOMError.location> |
my $pos = $o-><AG::DOMCore|DOMError.location> |
15723 |
-><AG::DOMCore|DOMLocator.utf32Offset>; |
-><AG::DOMCore|DOMLocator.utf32Offset>; |
15724 |
if ($pos > -1) { |
my $src = $o->{<H::ecore|object>}->{entity}->[-1]->{reptxt}; |
15725 |
my $src = $o->{<H::ecore|object>}->{entity}->[-1]->{reptxt}; |
if (defined $src and $pos > -1) { |
15726 |
my $start = $pos; |
my $start = $pos; |
15727 |
$start = rindex ($$src, "\x0A", $start - 1) for 0..2; |
$start = rindex ($$src, "\x0A", $start - 1) for 0..2; |
15728 |
$start++; |
$start++; |
15760 |
@@@@PerlDef: |
@@@@PerlDef: |
15761 |
$p->{-result} = sprintf 'U+%04X', $o->{$p->{v}}; |
$p->{-result} = sprintf 'U+%04X', $o->{$p->{v}}; |
15762 |
##XMLParserExceptionFormatter |
##XMLParserExceptionFormatter |
15763 |
|
|
15764 |
|
ElementTypeBinding: |
15765 |
|
@Name: CParam |
15766 |
|
@ElementType: |
15767 |
|
dis:ResourceDef |
15768 |
|
@ShadowContent: |
15769 |
|
@@rdf:type: |
15770 |
|
@@@@: c|DOMConfigurationParameter |
15771 |
|
@@@For: ManakaiDOM|DOM |
15772 |
|
@@rdf:type: |
15773 |
|
@@@@: DISCore|Property |
15774 |
|
@@@For: =ManakaiDOM|all |
15775 |
|
@@For: ManakaiDOM|DOM3 |
15776 |
|
@@For: =ManakaiDOM|all |
15777 |
|
|
15778 |
|
ElementTypeBinding: |
15779 |
|
@Name: CParamApp |
15780 |
|
@ElementType: |
15781 |
|
dis:ResourceDef |
15782 |
|
@ShadowContent: |
15783 |
|
@@rdf:type: |
15784 |
|
@@@@: c|DOMConfigurationParameterApplication |
15785 |
|
@@@For: ManakaiDOM|DOM |
15786 |
|
@@For: ManakaiDOM|DOM3 |
15787 |
|
|
15788 |
|
CParamApp: |
15789 |
|
@QName: error-handler |
15790 |
|
@c:domConfigurationParameter: c|error-handler |
15791 |
|
@c:targetType: xp|ManakaiXMLParser |
15792 |
|
|
15793 |
|
CParam: |
15794 |
|
@QName: xp|ls-input-to-input-file |
15795 |
|
@DOMLS:lsKey: |
15796 |
|
@@@: i2i |
15797 |
|
@@For: =ManakaiDOM|all |
15798 |
|
@Type: ManakaiDOMLSInputToInputFile |
15799 |
|
@c:targetType: xp|ManakaiXMLParser |
15800 |
|
@IsSupportRequired: 1 |
15801 |
|
@c:isSupported: 1 |
15802 |
|
@enDesc: |
15803 |
|
An <IF::LSInput> to Perl filehandle converter. |
15804 |
|
|
15805 |
|
@Method: |
15806 |
|
@@rdf:type: c|DOMConfigurationParameterDefaultGetter |
15807 |
|
@@Param: |
15808 |
|
@@@Name: name |
15809 |
|
@@@Type: DOMString |
15810 |
|
@@@dis:actualType: c|DOMConfigurationParameterName |
15811 |
|
@@@enDesc: The parameter name. |
15812 |
|
@@Return: |
15813 |
|
@@@Type: ManakaiDOMLSInputToInputFile |
15814 |
|
@@@enDesc: |
15815 |
|
The default resolver. |
15816 |
|
@@@PerlDefC: |
15817 |
|
$r = sub { |
15818 |
|
my ($self, $input, $errorHandler) = @_; |
15819 |
|
## As defined in DOM Level 3 LS |LSInput| interface |
15820 |
|
|
15821 |
|
my $r = {}; |
15822 |
|
|
15823 |
|
__DEEP{ |
15824 |
|
|
15825 |
|
FH: { |
15826 |
|
## 1. |characterStream| |
15827 |
|
my $v = $input-><AG::LSInput.characterStream>; |
15828 |
|
if (defined $v) { |
15829 |
|
$r->{filehandle} = $v; |
15830 |
|
last FH; |
15831 |
|
} |
15832 |
|
|
15833 |
|
## 2. |byteStream| |
15834 |
|
$v = $input-><AG::LSInput.byteStream>; |
15835 |
|
if (defined $v) { |
15836 |
|
## TODO: Support byte filehandle |
15837 |
|
## |encoding| |
15838 |
|
## TODO: How to guess? |
15839 |
|
return null; |
15840 |
|
} |
15841 |
|
|
15842 |
|
## 3. |stringData| |
15843 |
|
$v = $input-><AG::LSInput.stringData>; |
15844 |
|
if (defined $v) { |
15845 |
|
require IO::String; |
15846 |
|
$r->{filehandle} = IO::String->new ($v); |
15847 |
|
last FH; |
15848 |
|
} |
15849 |
|
|
15850 |
|
## 4. |systemId| |
15851 |
|
## TODO: |
15852 |
|
## resolve relative URI |
15853 |
|
## open |
15854 |
|
## set document_uri |
15855 |
|
|
15856 |
|
## 5. |publicId| |
15857 |
|
## The default resolver does not support only-|publicId| input. |
15858 |
|
|
15859 |
|
return null; |
15860 |
|
} # FH |
15861 |
|
|
15862 |
|
DURI: { |
15863 |
|
last DURI if defined $r->{document_uri}; |
15864 |
|
|
15865 |
|
my $v = $input-><AG::LSInput.systemId>; |
15866 |
|
if (defined $v) { |
15867 |
|
$r->{document_uri} = $v; |
15868 |
|
last DURI; |
15869 |
|
} |
15870 |
|
|
15871 |
|
## TODO: pubid -> pubid URN -> document_uri |
15872 |
|
} # DURI |
15873 |
|
|
15874 |
|
BURI: { |
15875 |
|
last BURI if defined $r->{base_uri}; |
15876 |
|
|
15877 |
|
my $v = $input-><AG::LSInput.baseURI>; |
15878 |
|
if (defined $v) { |
15879 |
|
$r->{base_uri} = $v; |
15880 |
|
last BURI; |
15881 |
|
} |
15882 |
|
|
15883 |
|
if (defined $r->{document_uri}) { |
15884 |
|
$r->{base_uri} = $r->{document_uri}; |
15885 |
|
} |
15886 |
|
} # BURI |
15887 |
|
|
15888 |
|
}__; |
15889 |
|
|
15890 |
|
## ISSUE: Is |certifiedText| required by parsers? |
15891 |
|
|
15892 |
|
return $r; |
15893 |
|
}; |
15894 |
|
@Method: |
15895 |
|
@@rdf:type: c|DOMConfigurationParameterSetter |
15896 |
|
@@Param: |
15897 |
|
@@@Name: name |
15898 |
|
@@@Type: DOMString |
15899 |
|
@@@dis:actualType: c|DOMConfigurationParameterName |
15900 |
|
@@@enDesc: The parameter name. |
15901 |
|
@@Param: |
15902 |
|
@@@Name: value |
15903 |
|
@@@Type: DOMMain|DOMUserData |
15904 |
|
@@@dis:actualType: ManakaiDOMLSInputToInputFile |
15905 |
|
@@@enDesc: The new value. |
15906 |
|
@@Return: |
15907 |
|
@@@Type: idl|void||ManakaiDOM|all |
15908 |
|
@@@PerlDefC: |
15909 |
|
$self->[1]->{<H::xp|ls-input-to-input-file>} = $value; |
15910 |
|
@@enImplNote: |
15911 |
|
Implied input processor converts non-blessed code references |
15912 |
|
into a <Class::ManakaiDOMLSInputToInputFile> object. |
15913 |
|
@Method: |
15914 |
|
@@rdf:type: c|DOMConfigurationParameterChecker |
15915 |
|
@@Param: |
15916 |
|
@@@Name: name |
15917 |
|
@@@Type: DOMString |
15918 |
|
@@@dis:actualType: c|DOMConfigurationParameterName |
15919 |
|
@@@enDesc: The parameter name. |
15920 |
|
@@Param: |
15921 |
|
@@@Name: value |
15922 |
|
@@@Type: DOMMain|DOMUserData |
15923 |
|
#@@@dis:actualType: ManakaiDOMLSInputToInputFile |
15924 |
|
@@@enDesc: The new value. |
15925 |
|
@@Return: |
15926 |
|
@@@Type: idl|boolean||ManakaiDOM|all |
15927 |
|
@@@PerlDefC: |
15928 |
|
$r = UNIVERSAL::isa ($value, 'CODE') or |
15929 |
|
UNIVERSAL::isa ($value, <ClassName::ManakaiDOMLSInputToInputFile>); |
15930 |
|
|
15931 |
|
@@Test: |
15932 |
|
@@@QName: cp.ls-input-to-input-file.test |
15933 |
|
@@@PerlDefC: |
15934 |
|
my $xp; |
15935 |
|
__CODE{createParserForTest:: $xp => $xp}__; |
15936 |
|
my $cfg = $xp-><AG::LSInput.domConfig>; |
15937 |
|
|
15938 |
|
my $cp = <Q::xp|ls-input-to-input-file>; |
15939 |
|
|
15940 |
|
$test->id ('default'); |
15941 |
|
my $default = $cfg-><M::c|DOMConfiguration.getParameter> ($cp); |
15942 |
|
$test->assert_isa ($default, |
15943 |
|
<ClassName::ManakaiDOMLSInputToInputFile>); |
15944 |
|
|
15945 |
|
$test->id ('set'); |
15946 |
|
my $sub1 = sub { }; |
15947 |
|
$cfg-><M::c|DOMConfiguration.setParameter> ($cp => $sub1); |
15948 |
|
my $sub2 = $cfg-><M::c|DOMConfiguration.getParameter> ($cp); |
15949 |
|
$test->assert_isa ($sub2, <ClassName::ManakaiDOMLSInputToInputFile>); |
15950 |
|
$test->assert_equals ($sub2, $sub1); |
15951 |
|
|
15952 |
|
$test->id ('reset'); |
15953 |
|
$cfg-><M::c|DOMConfiguration.setParameter> ($cp => null); |
15954 |
|
my $sub3 = $cfg-><M::c|DOMConfiguration.getParameter> ($cp); |
15955 |
|
$test->assert_isa ($sub3, <ClassName::ManakaiDOMLSInputToInputFile>); |
15956 |
|
$test->assert_equals ($sub3, $default); |
15957 |
|
##ls-input-to-input-file |
15958 |
|
|
15959 |
|
ClsDef: |
15960 |
|
@ClsQName: ManakaiDOMLSInputToInputFile |
15961 |
|
@enDesc: |
15962 |
|
An <Class::ManakaiDOMLSInputToInputFile> object is used to covert |
15963 |
|
a <IF::LSInput> object into a Perl filehandle. |
15964 |
|
|
15965 |
|
{ISSUE:: |
15966 |
|
In which module this class should be placed? |
15967 |
|
|
15968 |
|
Better interface name? |
15969 |
|
} |
15970 |
|
|
15971 |
|
@enDesc: |
15972 |
|
@@ddid: perl |
15973 |
|
@@ForCheck: ManakaiDOM|ManakaiDOM |
15974 |
|
@@@: |
15975 |
|
For Perl binding, any parameter that accepts |
15976 |
|
a <Class::ManakaiDOMLSInputToInputFile> would also accept a Perl code |
15977 |
|
reference (subroutine reference). The code reference |
15978 |
|
will be blessed as a <Class::ManakaiDOMLSInputToInputFile> whose |
15979 |
|
<M::ManakaiDOMLSInputToInputFile.resolveLSInput> method invokes the code. |
15980 |
|
|
15981 |
|
@ResourceDef: |
15982 |
|
@@rdf:type: DISLang|InputProcessor |
15983 |
|
@@rdf:type: DISLang|OutputProcessor |
15984 |
|
@@PerlDef: |
15985 |
|
$INPUT = bless $INPUT, <ClassName::ManakaiDOMLSInputToInputFile> |
15986 |
|
if ref $INPUT eq 'CODE'; |
15987 |
|
|
15988 |
|
@Method: |
15989 |
|
@@Name: resolveLSInput |
15990 |
|
@@enDesc: |
15991 |
|
Converts a <IF::LSInput> into a Perl filehandle. |
15992 |
|
@@Param: |
15993 |
|
@@@Name: input |
15994 |
|
@@@Type: LSInput |
15995 |
|
@@@enDesc: |
15996 |
|
The input. |
15997 |
|
@@Param: |
15998 |
|
@@@Name: errorHandler |
15999 |
|
@@@Type: c|DOMErrorHandler |
16000 |
|
@@@enDesc: |
16001 |
|
An error handler. If the method encounters an error |
16002 |
|
or warning, it <kwd:MAY> notify it to application |
16003 |
|
via this handler. |
16004 |
|
@@Return: |
16005 |
|
@@@Type: ManakaiDOMInputFile |
16006 |
|
@@@enDesc: |
16007 |
|
A <Class::ManakaiDOMInputFile> object created from <P::input>. |
16008 |
|
@@@nullCase: |
16009 |
|
@@@@enDesc: |
16010 |
|
If the method was unable to resolve the <P::input>. |
16011 |
|
|
16012 |
|
{ISSUE:: |
16013 |
|
Should we allow the method to throw exceptions? |
16014 |
|
} |
16015 |
|
@@@PerlDef: |
16016 |
|
__DEEP{ |
16017 |
|
$r = $self->($self, $input, $errorHandler); |
16018 |
|
}__; |
16019 |
|
@@@enImplNote: |
16020 |
|
Notet that the input / output processor for <CODE::$input> |
16021 |
|
and return value might or might not be inserted in |
16022 |
|
the <Perl::$self> code. |
16023 |
|
##LSInputToInputFile |
16024 |
|
|
16025 |
|
ClsDef: |
16026 |
|
@ClsQName: ManakaiDOMInputFile |
16027 |
|
@enDesc: |
16028 |
|
A set of information on the input, including filehandle. |
16029 |
|
|
16030 |
|
@enDesc: |
16031 |
|
@@ddid: perl |
16032 |
|
@@ForCheck: ManakaiDOM|ManakaiDOM |
16033 |
|
@@@: |
16034 |
|
For Perl binding, any parameter that accepts |
16035 |
|
a <Class::ManakaiDOMInputFile> would also accept a Perl hash reference. |
16036 |
|
If a hash reference is given to parameter that expects |
16037 |
|
a <Class::ManakaiDOMInputFile> object, then it |
16038 |
|
bless the hash with the class. |
16039 |
|
|
16040 |
|
Each attributes defined |
16041 |
|
in the class is associated to the hash value with the |
16042 |
|
key equals to the attribut name. Each method defined in |
16043 |
|
the class will invoke the code reference retrieved |
16044 |
|
from the hash by the key equals to the method name. |
16045 |
|
|
16046 |
|
If there is no value in the hash for an attribute, |
16047 |
|
then its value is <DOM::null>. |
16048 |
|
|
16049 |
|
@ResourceDef: |
16050 |
|
@@rdf:type: DISLang|InputProcessor |
16051 |
|
@@rdf:type: DISLang|OutputProcessor |
16052 |
|
@@PerlDef: |
16053 |
|
$INPUT = bless $INPUT, <ClassName::ManakaiDOMInputFile> |
16054 |
|
if ref $INPUT eq 'HASH'; |
16055 |
|
|
16056 |
|
@Attr: |
16057 |
|
@@Name: filehandle |
16058 |
|
@@Type: DISPerl|filehandle||ManakaiDOM|all |
16059 |
|
@@enDesc: |
16060 |
|
The input filehandle. |
16061 |
|
|
16062 |
|
It <kwd:MUST> be an <Perl::open>ed (and not <Perl::close>d) |
16063 |
|
filehandle. Note that |
16064 |
|
it does not have to be associated with an actual file |
16065 |
|
in the local file system. |
16066 |
|
|
16067 |
|
It <kwd:MUST> return a character (rather than byte) |
16068 |
|
by <Perl::getc>. |
16069 |
|
@@Get: |
16070 |
|
@@@PerlDef: $r = $self->{filehandle}; |
16071 |
|
@@Set: |
16072 |
|
@@@PerlDef: $self->{filehandle} = $given; |
16073 |
|
|
16074 |
|
@Attr: |
16075 |
|
@@Name: baseURI |
16076 |
|
@@enDesc: |
16077 |
|
The base URI of the input. |
16078 |
|
|
16079 |
|
It <kwd:MUST> be an absolute DOM URI or <DOM::null>. |
16080 |
|
Otherwise, the result is undefined. |
16081 |
|
@@Type: DOMString |
16082 |
|
@@nullCase: |
16083 |
|
@@@enDesc: |
16084 |
|
If the base URI is not available. |
16085 |
|
@@Get: |
16086 |
|
@@@PerlDef: $r = $self->{base_uri}; |
16087 |
|
@@Set: |
16088 |
|
@@@PerlDef: $self->{base_uri} = $given; |
16089 |
|
|
16090 |
|
@Attr: |
16091 |
|
@@Name: documentURI |
16092 |
|
@@enDesc: |
16093 |
|
The URI of the document. |
16094 |
|
|
16095 |
|
It <kwd:MUST> be an absolute DOM URI or <DOM::null>. |
16096 |
|
Otherwise, the result is undefined. |
16097 |
|
@@Type: DOMString |
16098 |
|
@@nullCase: |
16099 |
|
@@@enDesc: |
16100 |
|
If the document URI is not available. |
16101 |
|
@@Get: |
16102 |
|
@@@PerlDef: $r = $self->{document_uri}; |
16103 |
|
@@Set: |
16104 |
|
@@@PerlDef: $self->{document_uri} = $given; |
16105 |
|
|
16106 |
|
@Method: |
16107 |
|
@@Name: close |
16108 |
|
@@enDesc: |
16109 |
|
Closes the file. |
16110 |
|
|
16111 |
|
Since when the Perl's destructor is invoked is unreliable, |
16112 |
|
this method is explicitly called when the file is no longer |
16113 |
|
in use. |
16114 |
|
|
16115 |
|
If the <Class::ManakaiDOMInputFile> is given as a hash |
16116 |
|
reference and whose value for <CODE::close> is not defined, |
16117 |
|
then the statement <Perl::close $filehandle> is done |
16118 |
|
(where <Perl::$filehandle> is the <A::ManakaiDOMInputFile.filehandle> |
16119 |
|
value). |
16120 |
|
@@Return: |
16121 |
|
@@@PerlDef: |
16122 |
|
__DEEP{ |
16123 |
|
if ($self->{close}) { |
16124 |
|
$self->{close}->($self); |
16125 |
|
} else { |
16126 |
|
close $self->{filehandle}; |
16127 |
|
} |
16128 |
|
}__; |
16129 |
|
##ManakaiDOMInputFile |
16130 |
|
|
16131 |
|
|
16132 |
|
|