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