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