3536 |
|
|
3537 |
$test->id ('dtdText'); |
$test->id ('dtdText'); |
3538 |
$test->assert_equals ($el-><AG::XDPElement.dtdText>, '<!ELEMENT>'); |
$test->assert_equals ($el-><AG::XDPElement.dtdText>, '<!ELEMENT>'); |
3539 |
|
|
3540 |
|
@Method: |
3541 |
|
@@Name: createXDPIf |
3542 |
|
@@enDesc: |
3543 |
|
Creates an <XE::xdp|if> element. |
3544 |
|
@@Param: |
3545 |
|
@@@Name: statusEntity |
3546 |
|
@@@Type: DOMString |
3547 |
|
@@@enDesc: |
3548 |
|
The name of the parameter entity that contains |
3549 |
|
the status of the marked section. |
3550 |
|
@@@nullCase: |
3551 |
|
@@@@enDesc: |
3552 |
|
Same as an empty string. |
3553 |
|
@@Return: |
3554 |
|
@@@Type: XDPIfElement |
3555 |
|
@@@enDesc: |
3556 |
|
The newly created element node. |
3557 |
|
|
3558 |
|
{P:: A new <IF::Element> node with following attributes |
3559 |
|
<kwd:MUST> be returned: |
3560 |
|
|
3561 |
|
- <A::Node.localName>::: <XE::if>. |
3562 |
|
|
3563 |
|
- <A::Node.namespaceURI>::: <URI^^DISCore|QName::xdp|>. |
3564 |
|
|
3565 |
|
- <A::Node.ownerDocument>::: The document. |
3566 |
|
|
3567 |
|
} |
3568 |
|
|
3569 |
|
{P:: The <A::Node.attributes> <IF::tc|NamedNodeMap> |
3570 |
|
of the returned <IF:Element> node <kwd:MUST> contain |
3571 |
|
a new <IF::te|Attr> node with following attributes: |
3572 |
|
|
3573 |
|
- <A::Node.localName>::: <XA::status-entity>. |
3574 |
|
|
3575 |
|
- <A::Node.namespaceURI>::: <DOM::null>. |
3576 |
|
|
3577 |
|
- <A::te|Attr.specified>::: <DOM::true>. |
3578 |
|
|
3579 |
|
- <A::Node.textContent>::: <P::statusEntity>, or an empty |
3580 |
|
string if <P::statusEntity> |
3581 |
|
is <DOM::null>. |
3582 |
|
|
3583 |
|
} |
3584 |
|
|
3585 |
|
{P:: <A::Node.childNodes> <IF::tc|NodeList> of |
3586 |
|
the returned <IF::Element> node <kwd:MUST> contain |
3587 |
|
two <IF::Element> nodes in order: |
3588 |
|
|
3589 |
|
{LI:: |
3590 |
|
|
3591 |
|
- <A::Node.localName>::: <XE::true>. |
3592 |
|
|
3593 |
|
- <A::Node.namespaceURI>::: <URI^^DISCore|QName::xdp|>. |
3594 |
|
|
3595 |
|
- <A::Node.ownerDocument>::: The document. |
3596 |
|
|
3597 |
|
- <A::Node.textContent>::: An empty string. |
3598 |
|
|
3599 |
|
} |
3600 |
|
|
3601 |
|
{LI:: |
3602 |
|
|
3603 |
|
- <A::Node.localName>::: <XE::false>. |
3604 |
|
|
3605 |
|
- <A::Node.namespaceURI>::: <URI^^DISCore|QName::xdp|>. |
3606 |
|
|
3607 |
|
- <A::Node.ownerDocument>::: The document. |
3608 |
|
|
3609 |
|
- <A::Node.textContent>::: An empty string. |
3610 |
|
|
3611 |
|
} |
3612 |
|
|
3613 |
|
} |
3614 |
|
@@@PerlDef: |
3615 |
|
__DEEP{ |
3616 |
|
$r = $self-><M::Document.createElementNS> (<Q::xdp|>, 'if'); |
3617 |
|
$r-><M::Element.setAttributeNS> |
3618 |
|
(null, 'status-entity', |
3619 |
|
defined $statusEntity ? $statusEntity : ''); |
3620 |
|
$r-><M::Node.appendChild> |
3621 |
|
($self-><M::Document.createElementNS> (<Q::xdp|>, 'tr'.'ue')); |
3622 |
|
$r-><M::Node.appendChild> |
3623 |
|
($self-><M::Document.createElementNS> (<Q::xdp|>, 'fal'.'se')); |
3624 |
|
}__; |
3625 |
|
|
3626 |
|
@@Test: |
3627 |
|
@@@QName: XDPDocument.createXDPIf.1.test |
3628 |
|
@@@PerlDef: |
3629 |
|
my $doc; |
3630 |
|
__CODE{createXDPDocumentForTest}__; |
3631 |
|
|
3632 |
|
my $el = $doc-><M::XDPDocument.createXDPIf> ('aname'); |
3633 |
|
|
3634 |
|
$test->id ('interface'); |
3635 |
|
$test->assert_isa ($el, <IFName::XDPIfElement>); |
3636 |
|
|
3637 |
|
$test->id ('namespaceURI'); |
3638 |
|
$test->assert_equals ($el-><AG::Node.namespaceURI>, <Q::xdp|>); |
3639 |
|
|
3640 |
|
$test->id ('localName'); |
3641 |
|
$test->assert_equals ($el-><AG::Node.localName>, 'if'); |
3642 |
|
|
3643 |
|
$test->id ('dtdText'); |
3644 |
|
$test->assert_equals ($el-><AG::XDPElement.dtdText>, |
3645 |
|
"<![%aname;[\n<!-- end of aname -->]]>\n"); |
3646 |
|
|
3647 |
|
$test->id ('fc'); |
3648 |
|
my $fc = $el-><AG::Node.firstChild>; |
3649 |
|
$test->assert_isa ($fc, <IFName::XDPElement>); |
3650 |
|
|
3651 |
|
$test->id ('fc.namespaceURI'); |
3652 |
|
$test->assert_equals ($fc-><AG::Node.namespaceURI>, <Q::xdp|>); |
3653 |
|
|
3654 |
|
$test->id ('fc.localName'); |
3655 |
|
$test->assert_equals ($fc-><AG::Node.localName>, 'tr'.'ue'); |
3656 |
|
|
3657 |
|
$test->id ('lc'); |
3658 |
|
my $lc = $el-><AG::Node.lastChild>; |
3659 |
|
$test->assert_isa ($fc, <IFName::XDPElement>); |
3660 |
|
|
3661 |
|
$test->id ('lc.namespaceURI'); |
3662 |
|
$test->assert_equals ($lc-><AG::Node.namespaceURI>, <Q::xdp|>); |
3663 |
|
|
3664 |
|
$test->id ('lc.localName'); |
3665 |
|
$test->assert_equals ($lc-><AG::Node.localName>, 'fal'.'se'); |
3666 |
##XDPDocument |
##XDPDocument |
3667 |
|
|
3668 |
IFClsDef: |
IFClsDef: |
4277 |
$r =~ s/"/%22/g; |
$r =~ s/"/%22/g; |
4278 |
$r = '"'.$r.'"'; |
$r = '"'.$r.'"'; |
4279 |
##XDPSystemLiteralElement |
##XDPSystemLiteralElement |
4280 |
|
|
4281 |
|
IFClsETDef: |
4282 |
|
@IFQName: XDPIfElement |
4283 |
|
@ETQName: xdp|if |
4284 |
|
@ClsQName: ManakaiDOMXDPIfElement |
4285 |
|
|
4286 |
|
@IFISA: XDPElement |
4287 |
|
@ClsISA: ManakaiDOMXDPElement |
4288 |
|
|
4289 |
|
@enDesc: |
4290 |
|
An <XE::xdp|if> element represents a set of XML DTD declarations |
4291 |
|
with a conditional section that can be enabled by a |
4292 |
|
parameter entity. |
4293 |
|
|
4294 |
|
@CAttr: |
4295 |
|
@@Name: dtdText |
4296 |
|
@@Type: DOMString |
4297 |
|
@@Get: |
4298 |
|
@@@PerlDef: |
4299 |
|
__DEEP{ |
4300 |
|
require Message::DOM::Traversal; |
4301 |
|
my $doctrv = $self-><AG::Node.ownerDocument> |
4302 |
|
-><M::Node.getFeature> (Traversal => '2.0'); |
4303 |
|
my $tw = $doctrv->create_tree_walker |
4304 |
|
($self, <C::NodeFilter.SHOW_ELEMENT> | |
4305 |
|
<C::NodeFilter.SHOW_TEXT> | |
4306 |
|
<C::NodeFilter.SHOW_CDATA_SECTION>, |
4307 |
|
sub { |
4308 |
|
my $node = $_[1]; |
4309 |
|
if ($node-><AG::Node.nodeType> |
4310 |
|
== <C::Node.ELEMENT_NODE>) { |
4311 |
|
my $ns = $node-><AG::Node.namespaceURI>; |
4312 |
|
if (not defined $ns) { |
4313 |
|
return <C::NodeFilter.FILTER_REJECT>; |
4314 |
|
} elsif ($ns eq <Q::xdp|>) { |
4315 |
|
return <C::NodeFilter.FILTER_ACCEPT>; |
4316 |
|
} else { |
4317 |
|
return <C::NodeFilter.FILTER_REJECT>; |
4318 |
|
} |
4319 |
|
} else { |
4320 |
|
return <C::NodeFilter.FILTER_ACCEPT>; |
4321 |
|
} |
4322 |
|
}, true); |
4323 |
|
my $current = $tw->first_child; |
4324 |
|
|
4325 |
|
my $pename = $self-><M::Element.getAttributeNS> |
4326 |
|
(null, 'status-entity'); |
4327 |
|
$r = '<![%'.$pename.";[\n"; |
4328 |
|
|
4329 |
|
my $has_true; |
4330 |
|
C: while (defined $current) { |
4331 |
|
if ($current-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>) { |
4332 |
|
if (not $has_true and |
4333 |
|
$current->manakai_expanded_uri eq <Q::xdp|true>) { |
4334 |
|
$r .= $current-><AG::XDPElement.dtdText>; |
4335 |
|
$r .= "<!-- end of $pename -->]]>"; |
4336 |
|
$has_true = true; |
4337 |
|
} elsif ($current->manakai_expanded_uri eq <Q::xdp|false>) { |
4338 |
|
my $v = $current-><AG::XDPElement.dtdText>; |
4339 |
|
$r .= "\n" if length $v; |
4340 |
|
$r .= $v; |
4341 |
|
} else { |
4342 |
|
$r .= $current-><AG::XDPElement.dtdText>; |
4343 |
|
} |
4344 |
|
} else { |
4345 |
|
$r .= $current-><AG::XDPElement.dtdText>; |
4346 |
|
} |
4347 |
|
|
4348 |
|
$current = $tw->next_sibling; |
4349 |
|
} # C |
4350 |
|
|
4351 |
|
$r .= "<!-- end of $pename -->]]>" unless $has_true; |
4352 |
|
}__; |
4353 |
|
##XDPIfElement |