/[suikacvs]/messaging/manakai/lib/Message/Markup/SuikaWikiConfig21.dis
Suika

Contents of /messaging/manakai/lib/Message/Markup/SuikaWikiConfig21.dis

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.42 - (show annotations) (download)
Sat Apr 29 11:05:09 2006 UTC (18 years ago) by wakaba
Branch: MAIN
CVS Tags: manakai-release-0-3-2
Changes since 1.41: +3 -21 lines
++ manakai/t/ChangeLog	29 Apr 2006 11:04:52 -0000
2006-04-29  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (markup-Atom.t): New test.
	(test-module-markup): New rule.
	(test-module-all): The |test-module-markup| is added to the list
	of rules.

++ manakai/lib/Message/Markup/ChangeLog	29 Apr 2006 11:04:06 -0000
2006-04-29  Wakaba  <wakaba@suika.fam.cx>

	* common.dis: New module.

	* Atom.dis: New module.

	* Makefile: New modules are added.

	* SuikaWikiConfig21.dis (Require): A reference
	to the |Markup:common| module is added.
	(Markup|): Removed (moved to the |Markup:common| module).

++ manakai/lib/Message/DOM/ChangeLog	29 Apr 2006 11:02:19 -0000
2006-04-29  Wakaba  <wakaba@suika.fam.cx>

	* Element.dis (removeAttributeNS): A runtime error
	was occurred if there was no specified attribute node.

	* TreeCore.dis (manakaiLanguage): New attribute.

2006-04-28  Wakaba  <wakaba@suika.fam.cx>

	* TreeCore.dis (NodeList.manakaiReadOnly, NamedNodeMap.manakaiReadOnly):
	New attributes.

	(StaticNodeList): New interface.

2006-04-24  Wakaba  <wakaba@suika.fam.cx>

	* DOMCore.dis (c:SET_TO_NULL_ERR): New error code.

1 Module:
2 @QName:
3 Markup:SuikaWikiConfig21
4 @FullName:
5 @@lang: en
6 @@@:
7 SuikaWikiConfig/2.1 Object Model
8 @Namespace:
9 http://suika.fam.cx/~wakaba/archive/2005/swcfg21#
10
11 @Description:
12 @@lang:en
13 @@@:
14 The <Module::SuikaWikiConfig21> module provides an object model
15 for SuikaWikiConfig/2.1 document format.
16
17 @DISCore:author: DISCore|Wakaba
18 @License:
19 @@@:
20 license:Perl+MPL
21 @@Original:
22 @@@FullName:
23 SuikaWiki <PerlModule::SuikaWiki::Markup::SuikaWikiConfig20> Module
24 @@@Year:2003
25 @@@DISCore:author: DISCore|Wakaba
26 @Date:
27 $Date: 2006/04/03 16:13:15 $
28
29 @Require:
30 @@Module:
31 @@@QName: Markup|common
32 @@Module:
33 @@@QName: Util|ManakaiNode
34 @@@WithFor: ManakaiDOM|Perl
35 @@Module:
36 @@@QName: DISlib|DISIDL
37 @@@WithFor: ManakaiDOM|all
38 @@Module:
39 @@@QName: UtilError|DOMException
40 @@@WithFor: ManakaiDOM|Perl
41 @@Module:
42 @@@WithFor: swcfg21|ForEmpty
43 @@Module:
44 @@@WithFor: swcfg21|ForLatest
45 @@Module:
46 @@@QName: MDOM|DOMFeature
47 @@@WithFor: ManakaiDOM|ManakaiDOMLatest
48 @@Module:
49 @@@QName: MDOM|GenericLS
50 @@@WithFor: ManakaiDOM|ManakaiDOMLatest
51 @DefaultFor: swcfg21|ForLatest
52
53 Namespace:
54 @DIS:
55 http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
56 @dis:
57 http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
58 @DISLang:
59 http://suika.fam.cx/~wakaba/archive/2004/dis/Lang#
60 @DISlib:
61 http://suika.fam.cx/~wakaba/archive/2004/dis/
62 @DOMCore:
63 http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#
64 @DOMLS:
65 http://suika.fam.cx/~wakaba/archive/2004/dom/ls#
66 @dx:
67 http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#
68 @ecore:
69 http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/Core/
70 @f:
71 http://suika.fam.cx/~wakaba/archive/2004/dom/feature#
72 @idl:
73 http://suika.fam.cx/~wakaba/archive/2004/dis/IDL#
74 @infoset:
75 http://www.w3.org/2001/04/infoset#
76 @kwd:
77 http://suika.fam.cx/~wakaba/archive/2005/rfc2119/
78 @lang:
79 http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
80 @license:
81 http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
82 @ManakaiDOM:
83 http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
84 @Markup:
85 http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup#
86 @MDOM:
87 http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.
88 @MDOMX:
89 http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#
90 @mn:
91 http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/ManakaiNode#
92 @rdf:
93 http://www.w3.org/1999/02/22-rdf-syntax-ns#
94 @rdfs:
95 http://www.w3.org/2000/01/rdf-schema#
96 @swcfg21:
97 http://suika.fam.cx/~wakaba/archive/2005/swcfg21#
98 @Util:
99 http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/
100 @UtilError:
101 http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/
102
103 ## -- "For" definitions
104
105 ## For a version
106
107 ForDef:
108 @QName: swcfg21|ForEmpty
109 @FullName:
110 @@lang:en
111 @@@:
112 For interface of <QUOTE::any> version
113 @ISA:
114 ManakaiDOM:Perl
115
116 ForDef:
117 @QName:
118 swcfg21:ForLatest
119 @FullName:
120 @@lang:en
121 @@@: For latest version
122 @ISA: swcfg21|ForEmpty
123
124 ## -- Features and versions
125
126 ElementTypeBinding:
127 @Name: FeatureDef
128 @ElementType:
129 dis:ResourceDef
130 @ShadowContent:
131 @@rdf:type: f|Feature
132 @@For: =ManakaiDOM|all
133
134 ElementTypeBinding:
135 @Name: FeatureVerDef
136 @ElementType:
137 dis:ResourceDef
138 @ShadowContent:
139 @@rdf:type: f|Feature
140
141 ElementTypeBinding:
142 @Name: featureQName
143 @ElementType:
144 f:name
145 @ShadowContent:
146 @@ContentType: DISCore|QName
147
148 FeatureDef:
149 @QName: CoreFeature
150 @featureQName: Core
151 @FeatureVerDef:
152 @@QName: CoreFeature21
153 @@Version: 2.1
154 @@f:instanceOf: CoreFeature
155 @@FullName:
156 @@@lang:en
157 @@@@:
158 The SuikaWikiConfig/2.1 object model
159 @@Description:
160 @@@lang:en
161 @@@@:
162 The SuikaWikiConfig/2.1 object model.
163
164 PropDef:
165 @QName:
166 swcfg21:namespaceAwareVariant
167 @Description:
168 @@lang:en
169 @@@:
170 A namespace aware variant of the subject method or attribute.
171
172 PropDef:
173 @QName: namespaceUnawareVariant
174 @Description:
175 @@lang:en
176 @@@:
177 A namespace unaware variant of the subject method or attribute.
178
179
180 ElementTypeBinding:
181 @Name: IFClsDef
182 @ElementType:
183 dis:ResourceDef
184 @ShadowContent:
185 @@rdf:type:
186 @@@@: dis|MultipleResource
187 @@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
188 @@resourceFor: ManakaiDOM|ForIF
189 @@resourceFor:
190 @@@@: ManakaiDOM|ForClass
191 @@@ForCheck: ForEmpty !=ForEmpty
192 @@For: ForLatest
193 @@For: =ForEmpty
194
195 @@rdf:type:
196 @@@@: DISLang|Interface
197 @@@ForCheck: ManakaiDOM|ForIF
198
199 @@rdf:type:
200 @@@@: DISLang|Class
201 @@@ForCheck: ManakaiDOM|ForClass
202 @@Implement:
203 @@@@: ||ForEmpty||ManakaiDOM|ForIF
204 @@@ContentType: DISCore|TFPQNames
205 @@@ForCheck: ManakaiDOM|ForClass ForEmpty
206 @@Implement:
207 @@@@: ||ForLatest||ManakaiDOM|ForIF
208 @@@ContentType: DISCore|TFPQNames
209 @@@ForCheck: ManakaiDOM|ForClass ForLatest
210
211 @@f:implements:
212 @@@@: CoreFeature21
213 @@@For: ForLatest
214
215 ## -- Node
216
217 IFClsDef:
218 @IFQName: SWCFGNode
219 @ClsQName: ManakaiSWCFGNode
220
221 @ClsISA: ManakaiNode|ManakaiNodeRef||ManakaiDOM|Perl
222 @ClsISA: dx|ManakaiDefaultExceptionHandler||ManakaiDOM|Perl
223
224 @Description:
225 @@lang:en
226 @@@:
227 Each SuikaWikiConfig/2.1 node object implements the
228 <IF::SWCFGNode> interface, which provides access to
229 its properties and chilren.
230 \
231 {NOTE:: The <M::new> method, available in the module
232 <PerlModule::Message::Markup::SuikaWikiConfig20::Node>,
233 is removed from the object model in favor of
234 the factory methods on <IF::SWCFGImplementation> and
235 <IF::SWCFGDocument> interfaces.
236 \
237 }
238
239 @Method:
240 @@Name:appendNode
241 @@Description:
242 @@@lang:en
243 @@@@:
244 Appends a node to the list of children of this node.
245 @@Param:
246 @@@Name:node
247 @@@Type: idl|Object||ManakaiDOM|all
248 @@@Description:
249 @@@@lang:en
250 @@@@@:
251 The node or node value to append.
252 @@@InCase:
253 @@@@Type:SWCFGNode
254 @@@@Description:
255 @@@@@lang:en
256 @@@@@@:
257 The <P::node> is appended to the list of children.
258 @@@InCase:
259 @@@@Type:SWCFGDocumentFragment
260 @@@@Description:
261 @@@@@lang:en
262 @@@@@@:
263 Children of the <P::node> is appended.
264 @@@InCase:
265 @@@@Type:SWCFGString
266 @@@@Description:
267 @@@@@lang:en
268 @@@@@@:
269 The <P::node> is appended to the value of this node,
270 as <M::SWCFGNode.appendText> does, if <P::nodeOrText>
271 is set to <DOM::true>. Otherwise, an exception is raised.
272 @@NamedParam:
273 @@@Name:nodeOrText
274 @@@Type: boolean
275 @@@Description:
276 @@@@lang:en
277 @@@@@:
278 Whether a string input should be accepted or not.
279 @@@InCase:
280 @@@@Value:
281 @@@@@:1
282 @@@@ContentType: DISCore|Boolean
283 @@@@Type: boolean
284 @@@@Description:
285 @@@@@lang:en
286 @@@@@@:
287 A <TYPE::SWCFGString> is accepted as a <P::node> parameter
288 value.
289 @@@InCase:
290 @@@@Value:
291 @@@@@:0
292 @@@@ContentType: DISCore|Boolean
293 @@@@Type: boolean
294 @@@@Description:
295 @@@@@lang:en
296 @@@@@@:
297 A <TYPE::SWCFGString> is not accepted as a <P::node>
298 parameter value.
299 @@Return:
300 @@@Type:SWCFGNode
301 @@@actualType:ManakaiSWCFGNode
302 @@@Description:
303 @@@@lang:en
304 @@@@@:
305 The node appended to the child list.
306 \
307 If the <P::node> is of <IF::SWCFGDocumentFragment>,
308 this (parent) node is returned instead.
309 @@@RaiseException:
310 @@@@@: HIERARCHY_ANCESTOR_OR_SELF_ERR
311 @@@@Description:
312 @@@@@lang:en
313 @@@@@@:
314 The <P::node> is an ancestor of this node or this node itself.
315 @@@RaiseException:
316 @@@@@: HIERARCHY_BAD_TYPE_ERR
317 @@@@Description:
318 @@@@@lang:en
319 @@@@@@:
320 An attempt is made to append non-element node on element or
321 document fragment node or an attempt is made to append any
322 node on comment node or document or document fragment
323 node on any node.
324 @@@RaiseException:
325 @@@@@:NOT_NODE_ERR
326 @@@@Description:
327 @@@@@lang:en
328 @@@@@@:
329 The <P::node> object is not of <IF::SWCFGNode> if
330 <P::nodeOrText> is <DOM::false> or is neither of
331 <IF::SWCFGNode> nor <IF::SWCFGString> if
332 <P::nodeOrText> is <DOM::true>.
333 @@@RaiseException:
334 @@@@@: EXTERNAL_NODE_ERR
335 @@@@Description:
336 @@@@@lang:en
337 @@@@@@:
338 The <P::node> does not belong to the same document
339 as the owner of this node.
340 @@@PerlDef:
341 unless (UNIVERSAL::isa ($node, <IFName::SWCFGNode>) or
342 UNIVERSAL::isa ($node, <ClassName::ManakaiSWCFGNode>)) {
343 ## NOTE: dis.pl and cdis2pm.pl does not support
344 ## interface "implement"ing in this case
345 if ($nodeOrText) {
346 __DEEP{
347 $r = $self-><M::ManakaiSWCFGNode.appendText> ($node);
348 }__;
349 } else {
350 __EXCEPTION{NOT_NODE_ERR::
351 SuikaWikiConfig21:actualType => {ref $node},
352 }__;
353 }
354 } else {
355 my $this_node_type = $self-><AG::SWCFGNode.nodeType>;
356 my $that_node_type = $node-><AG::SWCFGNode.nodeType>;
357 if ($this_node_type eq '#comment') {
358 __EXCEPTION{HIERARCHY_BAD_TYPE_ERR::
359 MDOMX:param-name => 'node',
360 swcfg21:parentNodeType => {$this_node_type},
361 swcfg21:childNodeType => {$that_node_type},
362 }__;
363 } elsif ($this_node_type ne '#document') {
364 if ($that_node_type eq '#comment') {
365 __EXCEPTION{HIERARCHY_BAD_TYPE_ERR::
366 MDOMX:param-name => 'node',
367 swcfg21:parentNodeType => {$this_node_type},
368 swcfg21:childNodeType => {$that_node_type},
369 }__;
370 }
371 } else {
372 if ($that_node_type eq '#document' or
373 $that_node_type eq '#fragment') {
374 __EXCEPTION{HIERARCHY_BAD_TYPE_ERR::
375 MDOMX:param-name => 'node',
376 swcfg21:parentNodeType => {$this_node_type},
377 swcfg21:childNodeType => {$that_node_type},
378 }__;
379 }
380 }
381 unless (($self-><AG::SWCFGNode.ownerDocument> || $self) eq
382 $node-><AG::SWCFGNode.ownerDocument>) {
383 __EXCEPTION{EXTERNAL_NODE_ERR::
384 MDOMX:param-name => 'node',
385 }__;
386 }
387 my $this_node = $node;
388 ANCESTOR: {
389 if ($this_node eq $self) {
390 __EXCEPTION{HIERARCHY_ANCESTOR_OR_SELF_ERR::
391 MDOMX:param-name => 'node',
392 }__;
393 }
394 redo ANCESTOR if $this_node = $this_node-><AG::SWCFGNode.parentNode>;
395 }
396
397 if ($node-><AG::SWCFGNode.nodeType> eq '#fragment') {
398 $self->{<H::mn:node>}
399 -><M::NodeStem.importTree> ($node->{<H::mn:node>});
400 for my $cn (@{$node->{<H::mn:node>}->{<H::swcfg21:childNodes>}}) {
401 $cn->{<H::swcfg21:parent>} = $self->{<H::mn:node>};
402 }
403 push @{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}},
404 \ @{$node->{<H::mn:node>}->{<H::swcfg21:childNodes>}};
405 $node->{<H::mn:node>}->{<H::swcfg21:childNodes>} = [];
406 $node->{<H::mn:node>}-><M::NodeStem.orphanate>;
407 $r = $self;
408 } else {
409 if ($node->{<H::mn:node>}->{<H::swcfg21:parent>}) {
410 my @pl = $node->{<H::mn:node>}->{<H::swcfg21:parent>}
411 ->{<H::swcfg21:childNodes>};
412 for my $i (0..$#pl) {
413 if ($pl[$i] eq $node->{<H::mn:node>}) {
414 splice @pl, $i, 1, ();
415 last;
416 }
417 }
418 }
419 $self->{<H::mn:node>}-><M::NodeStem
420 .importTree> ($node->{<H::mn:node>});
421 push @{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}},
422 $node->{<H::mn:node>};
423 $node->{<H::mn:node>}->{<H::swcfg21:parent>}
424 = $self->{<H::mn:node>};
425 $r = $node;
426 }
427 }
428
429 @Method:
430 @@Name:appendNewNode
431 @@Description:
432 @@@lang:en
433 @@@@:
434 Constructs a new node object and appends it to the child list
435 of this node.
436 @@TypeParam:
437 @@LocalNameParam:
438 @@NSURIParam:
439 @@ValueParam:
440 @@Return:
441 @@@Type:SWCFGNode
442 @@@actualType:ManakaiSWCFGNode
443 @@@Description:
444 @@@@lang:en
445 @@@@@: The newly created node.
446 @@@RaiseException:
447 @@@@@: HIERARCHY_ANCESTOR_OR_SELF_ERR
448 @@@@Description:
449 @@@@@lang:en
450 @@@@@@:
451 The <P::node> is an ancestor of this node or this node itself.
452 @@@RaiseException:
453 @@@@@: HIERARCHY_BAD_TYPE_ERR
454 @@@@Description:
455 @@@@@lang:en
456 @@@@@@:
457 An attempt is made to append non-element node on element or
458 document fragment node or an attempt is made to append any
459 node on comment node or document or document fragment
460 node on any node.
461 @@@RaiseException:
462 @@@@@: EXTERNAL_NODE_ERR
463 @@@@Description:
464 @@@@@lang:en
465 @@@@@@:
466 The <P::node> does not belong to the same document
467 as the owner of this node.
468 @@@PerlDef:
469 my $this_type = $self-><AG::SWCFGNode.nodeType>;
470 if ($this_type eq '#comment') {
471 __EXCEPTION{HIERARCHY_BAD_TYPE_ERR::
472 MDOMX:param-name => 'type',
473 swcfg21:parentNodeType => {$this_type},
474 swcfg21:childNodeType => {$type},
475 }__;
476 }
477 if ($type eq '#element') {
478 __DEEP{
479 $r = ($self-><AG::SWCFGNode.ownerDocument> || $self)
480 -><M::SWCFGDocument.createElementNS>
481 ($namespaceURI, $localName);
482 }__;
483 $r->{<H::mn:node>}->{<H::swcfg21:value>} = $value
484 if defined $value;
485 } elsif ($type eq '#comment') {
486 if ($this_type ne '#document') {
487 __EXCEPTION{HIERARCHY_BAD_TYPE_ERR::
488 MDOMX:param-name => 'type',
489 swcfg21:parentNodeType => {$this_type},
490 swcfg21:childNodeType => {$type},
491 }__;
492 }
493 __DEEP{
494 $r = ($self-><AG::SWCFGNode.ownerDocument> || $self)
495 -><M::SWCFGDocument.createComment> ($value);
496 }__;
497 } else {
498 __EXCEPTION{HIERARCHY_BAD_TYPE_ERR::
499 MDOMX:param-name => 'type',
500 swcfg21:parentNodeType => {$this_type},
501 swcfg21:childNodeType => {$type},
502 }__;
503 }
504 $self->{<H::mn:node>}-><M::NodeStem
505 .importTree> ($r->{<H::mn:node>});
506 push @{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}},
507 $r->{<H::mn:node>};
508 $r->{<H::mn:node>}->{<H::swcfg21:parent>} = $self->{<H::mn:node>};
509
510 @Method:
511 @@Name:appendText
512 @@Description:
513 @@@lang:en
514 @@@@:
515 Appends a string to the value of this node. If the node value
516 is of list, the string is added as a new item. Otherwise,
517 it is simply added at the end of the current value.
518 @@Param:
519 @@@Name:text
520 @@@Type:SWCFGString
521 @@@Description:
522 @@@@lang:en
523 @@@@@:
524 A text to append.
525 @@Return:
526 @@@RaiseException:
527 @@@@@: HIERARCHY_NO_VALUE_ERR
528 @@@@Description:
529 @@@@@lang:en
530 @@@@@@:
531 An attempt is made to set a value to document node.
532 @@@UndeclaredPrefixException:
533 @@@PerlDef:
534 my $node = $self->{<H::mn:node>};
535 my $nt = $self-><AG::SWCFGNode.nodeType>;
536 if ($nt eq '#document') {
537 __EXCEPTION{HIERARCHY_NO_VALUE_ERR::
538 MDOMX:param-name => 'text',
539 swcfg21:parentNodeType => {$nt},
540 }__;
541 } elsif (ref ($node->{<H::swcfg21:value>}) eq 'ARRAY') {
542 push @{$node->{<H::swcfg21:value>}}, $text;
543 } elsif (defined $node->{<H::swcfg21:value>}) {
544 $node->{<H::swcfg21:value>} .= $text;
545 } else {
546 __CODE{expandETBinding:: $node => $node}__;
547 if (defined $node->{<H::swcfg21:shadowContent>} and
548 defined $node->{<H::swcfg21:shadowContent>}->{<H::swcfg21:value>}) {
549 $node->{<H::swcfg21:value>}
550 = $node->{<H::swcfg21:shadowContent>}->{<H::swcfg21:value>} . $text;
551 } else {
552 $node->{<H::swcfg21:value>} = $text;
553 }
554 }
555
556 @Method:
557 @@Name:removeChildNode
558 @@Description:
559 @@@lang:en
560 @@@@:
561 Removes a node from the child node list of this node.
562 \
563 {TODO:: How this method should do for shadow tree is not
564 decided yet.
565 \
566 }
567 @@Param:
568 @@@Name:node
569 @@@Type:SWCFGNode
570 @@@actualType:ManakaiSWCFGNode
571 @@@Description:
572 @@@@lang:en
573 @@@@@:
574 The node to remove. If the <P::node> is not a child of
575 this node, no action has taken.
576 @@Return:
577 @@@PerlDef:
578 my $n = $node->{<H::mn:node>};
579 $self->{<H::mn:node>}->{<H::swcfg21:childNodes>}
580 = [grep {not $_ eq $n} @{$self->{<H::mn:node>}
581 ->{<H::swcfg21:childNodes>}}];
582 $node->{<H::mn:node>}-><M::NodeStem.orphanate>;
583 @Method:
584 @@Name:getAttribute
585 @@Description:
586 @@@lang:en
587 @@@@:
588 Returns the first child element node object whose local name matches
589 with the given name, if any.
590 @@NSVariant:.getAttributeNS
591 @@Param:
592 @@@Name:localName
593 @@@Type:SWCFGString
594 @@@Description:
595 @@@@lang:en
596 @@@@@:
597 The local name of element to return.
598 @@MakeNewNodeParam:
599 @@Return:
600 @@@Type:SWCFGElement
601 @@@Description:
602 @@@@lang:en
603 @@@@@:
604 The first child element node whose local name matches to
605 <P::name>.
606 @@@InCase:
607 @@@@Value:
608 @@@@@is-null:1
609 @@@@Type:SWCFGElement
610 @@@@Description:
611 @@@@@lang:en
612 @@@@@@:
613 There is no child element found whose name is <P::name>.
614 @@@UndeclaredPrefixException:
615 @@@PerlDef:
616 __DEEP{
617 FIND: {
618 my $node = $self->{<H::mn:node>};
619 __CODE{expandETBinding:: $node => $node}__;
620 my @c = (@{$node->{<H::swcfg21:childNodes>}},
621 ($node->{<H::swcfg21:shadowContent>}
622 ? @{$node->{<H::swcfg21:shadowContent>}
623 ->{<H::swcfg21:childNodes>}} : ()));
624 while (@c) {
625 my $c = $self-><M::ManakaiSWCFGNode.getNodeReference>
626 (my $cn = shift @c);
627 if ($c-><AG::SWCFGNode.nodeType> eq '#element' and
628 $c-><AG::SWCFGNode.localName> eq $localName) {
629 $r = $c;
630 last FIND;
631 }
632 __CODE{expandETBinding:: $node => $cn}__;
633 if ($cn->{<H::swcfg21:shadowSibling>}) {
634 push @c, @{$cn->{<H::swcfg21:shadowSibling>}->{<H::swcfg21:childNodes>}};
635 }
636 }
637 ## Not found
638 if ($makeNewNode) {
639 $r = ($self-><AG::SWCFGNode.ownerDocument> || $self)
640 -><M::SWCFGDocument.createElementNS> (null, $localName);
641 $self-><M::SWCFGNode.appendNode> ($r);
642 }
643 } # FIND
644 }__;
645
646 @Method:
647 @@Name:getAttributeNS
648 @@Description:
649 @@@lang:en
650 @@@@:
651 Returns the first child node whose name matches to the
652 pair of namespace URI and local name.
653 @@NewIn21:
654 @@NonNSVariant:.getAttribute
655 @@Param:
656 @@@Name:namespaceURI
657 @@@Type:SWCFGString
658 @@@Description:
659 @@@@lang:en
660 @@@@@:
661 The namespace URI of the element to get.
662 @@@InCase:
663 @@@@Value:
664 @@@@@is-null:1
665 @@@@Description:
666 @@@@@lang:en
667 @@@@@@: The null namespace.
668 @@Param:
669 @@@Name:localName
670 @@@Type:SWCFGString
671 @@@Description:
672 @@@@lang:en
673 @@@@@:
674 The local name of the element to get.
675 @@MakeNewNodeParam:
676 @@Return:
677 @@@Type:SWCFGElement
678 @@@Description:
679 @@@@lang:en
680 @@@@@:
681 The first child element node whose name matches to
682 <P::namespaceURI> and <P::localName>.
683 @@@InCase:
684 @@@@Value:
685 @@@@@is-null:1
686 @@@@Type:SWCFGElement
687 @@@@Description:
688 @@@@@lang:en
689 @@@@@@:
690 There is no child element found whose name is <P::namespaceURI>
691 and <P::localName> pair.
692 @@@UndeclaredPrefixException:
693 @@@PerlDef:
694 FIND: {
695 my $node = $self->{<H::mn:node>};
696 __CODE{expandETBinding:: $node => $node}__;
697 my @c = (@{$node->{<H::swcfg21:childNodes>}},
698 ($node->{<H::swcfg21:shadowContent>}
699 ? @{$node->{<H::swcfg21:shadowContent>}
700 ->{<H::swcfg21:childNodes>}} : ()));
701 while (@c) {
702 my $c = $self-><M::ManakaiSWCFGNode.getNodeReference>
703 (my $cn = shift @c);
704 if ($c-><AG::SWCFGNode.nodeType> eq '#element' and
705 ((not defined $namespaceURI and
706 not defined $c-><AG::SWCFGNode.namespaceURI>) or
707 (defined $namespaceURI and
708 defined $c-><AG::SWCFGNode.namespaceURI> and
709 $namespaceURI eq $c-><AG::SWCFGNode.namespaceURI>)) and
710 $c-><AG::SWCFGNode.localName> eq $localName) {
711 $r = $c;
712 last FIND;
713 }
714 __CODE{expandETBinding:: $node => $cn}__;
715 if ($cn->{<H::swcfg21:shadowSibling>}) {
716 push @c, @{$cn->{<H::swcfg21:shadowSibling>}->{<H::swcfg21:childNodes>}};
717 }
718 }
719 ## Not found
720 if ($makeNewNode) {
721 __DEEP{
722 $r = ($self-><AG::SWCFGNode.ownerDocument> || $self)
723 -><M::SWCFGDocument.createElementNS>
724 ($namespaceURI, $localName);
725 $self-><M::SWCFGNode.appendNode> ($r);
726 }__;
727 }
728 } # FIND
729
730 @Method:
731 @@Name:getAttributeValue
732 @@Description:
733 @@@lang:en
734 @@@@:
735 Returns the value of the first child element with a given
736 local name.
737 @@NSVariant:.getAttributeValueNS
738 @@Param:
739 @@@Name:localName
740 @@@Type:SWCFGString
741 @@@Description:
742 @@@@lang:en
743 @@@@@:
744 The local name of the child element to get its value.
745 @@DefaultParam:
746 @@DefaultListParam:
747 @@Return:
748 @@@Type:SWCFGString
749 @@@Description:
750 @@@@lang:en
751 @@@@@:
752 The value of specified child element. It might be either
753 a simple string value, a list (array reference) value or
754 a <DOM::null> value.
755 \
756 If the element value is <DOM::null> or there is no such element
757 exist and the <P::default> parameter is specified, then
758 the <P::default> value is returned. If the element
759 value is of list and it have zero item and the <P::defaultList>
760 parameter is specified, then the <P::defaultValue> is returned.
761 @@@InCase:
762 @@@@Value:
763 @@@@@is-null:1
764 @@@@Type:SWCFGString
765 @@@@Description:
766 @@@@@lang:en
767 @@@@@@:
768 Either if there is no such child element found, if
769 the element value is <DOM::null> or if the <P::default>
770 value is specified as <DOM::null>.
771 @@@PerlDef:
772 __DEEP{
773 my $node = $self-><M::SWCFGNode.getAttribute> ($localName);
774 if (ref $node) {
775 $r = $node-><M::SWCFGNode.value> (%opt);
776 if ($defaultList and ref $r eq 'ARRAY' and @$r == 0) {
777 $r = $defaultList;
778 }
779 } else {
780 $r = $defaultList || $default;
781 }
782 }__;
783
784 @Method:
785 @@Name:getAttributeValueNS
786 @@Description:
787 @@@lang:en
788 @@@@:
789 Returns the value of the first child element with a given
790 local name and namespace URI pair.
791 @@NewIn21:
792 @@NonNSVariant:.getAttributeValue
793 @@Param:
794 @@@Name:namespaceURI
795 @@@Type:SWCFGString
796 @@@Description:
797 @@@@lang:en
798 @@@@@:
799 The namespace URI of the element to get.
800 @@@InCase:
801 @@@@Value:
802 @@@@@is-null:1
803 @@@@Description:
804 @@@@@lang:en
805 @@@@@@: The null namespace.
806 @@Param:
807 @@@Name:localName
808 @@@Type:SWCFGString
809 @@@Description:
810 @@@@lang:en
811 @@@@@:
812 The local name of the child element to get its value.
813 @@DefaultParam:
814 @@DefaultListParam:
815 @@Return:
816 @@@Type:SWCFGString
817 @@@Description:
818 @@@@lang:en
819 @@@@@:
820 The value of specified child element. It might be either
821 a simple string value, a list (array reference) value or
822 a <DOM::null> value.
823 \
824 If the element value is <DOM::null> or there is no such element
825 exist and the <P::default> parameter is specified, then
826 the <P::default> value is returned. If the element
827 value is of list and it have zero item and the <P::defaultList>
828 parameter is specified, then the <P::defaultValue> is returned.
829 @@@InCase:
830 @@@@Value:
831 @@@@@is-null:1
832 @@@@Type:SWCFGString
833 @@@@Description:
834 @@@@@lang:en
835 @@@@@@:
836 Either if there is no such child element found, if
837 the element value is <DOM::null> or if the <P::default>
838 value is specified as <DOM::null>.
839 @@@PerlDef:
840 __DEEP{
841 my $node = $self-><M::SWCFGNode.getAttributeNS>
842 ($namespaceURI, $localName);
843 if (ref $node) {
844 $r = $node-><M::SWCFGNode.value> (%opt);
845 if ($defaultList and ref $r eq 'ARRAY' and @$r == 0) {
846 $r = $defaultList;
847 }
848 } else {
849 $r = $defaultList || $default;
850 }
851 }__;
852
853 @Method:
854 @@Name:getElementBy
855 @@Description:
856 @@@lang:en
857 @@@@:
858 Returns the first child element node that satisfies the
859 given condition, if any.
860 @@Param:
861 @@@Name:code
862 @@@Type: DISPerl|CODE||ManakaiDOM|all
863 @@@Description:
864 @@@@lang:en
865 @@@@@:
866 An anonymous function whose arguments are a <IF::SWCFGElement>
867 node and a named parameter list (Perl hash) and
868 returning a boolean value. This method calls this
869 function to test an element node should be returned as
870 the result. The element node to test is passed as the first
871 argument and any named parameters to this method are
872 passed to the function.
873 @@NamedParam:
874 @@@Name:makeNewNode
875 @@@Type: DISPerl|CODE||ManakaiDOM|all
876 @@@Description:
877 @@@@lang:en
878 @@@@@:
879 An anonymous function whose arguments are a newly created
880 <IF::SWCFGElement> node and a named parameter list (Perl hash)
881 with no return value expected. Any named parameters to this
882 method are passed to the function. The function is expected
883 to modify the node of the first argument (including, but
884 not limited to, renaming its name) to match the <P::code>'s
885 condition, although it is not tested.
886 @@Return:
887 @@@Type:SWCFGElement
888 @@@Description:
889 @@@@lang:en
890 @@@@@:
891 The first matching child element node.
892 @@@InCase:
893 @@@@Value:
894 @@@@@is-null:1
895 @@@@Type:SWCFGElement
896 @@@@Description:
897 @@@@@lang:en
898 @@@@@@:
899 There is no element node with which the <P::code> returns
900 a <DOM::true> value.
901 @@@UndeclaredPrefixException:
902 @@@PerlDef:
903 FIND: {
904 my $node = $self->{<H::mn:node>};
905 __CODE{expandETBinding:: $node => $node}__;
906 __DEEP{
907 my @c = (@{$node->{<H::swcfg21:childNodes>}},
908 ($node->{<H::swcfg21:shadowContent>}
909 ? @{$node->{<H::swcfg21:shadowContent>}
910 ->{<H::swcfg21:childNodes>}} : ()));
911 while (@c) {
912 my $this = $self-><M::ManakaiSWCFGNode.getNodeReference>
913 (my $t = shift @c);
914 if ($t->{<H::swcfg21:nodeType>} eq '#element' and
915 $code->($self, $this, %opt)) {
916 $r = $this;
917 last FIND;
918 }
919 __CODE{expandETBinding:: $node => $t}__;
920 if ($t->{<H::swcfg21:shadowSibling>}) {
921 push @c, @{$t->{<H::swcfg21:shadowSibling>}->{<H::swcfg21:childNodes>}};
922 }
923 }
924 }__;
925 ## Not found
926 if ($makeNewNode) {
927 __DEEP{
928 $r = $self-><M::SWCFGNode.appendNewNode>
929 (type => '#element',
930 namespace_uri =>
931 ($self-><AG::SWCFGNode.ownerDocument> ||
932 $self)
933 -><AG::SWCFGDocument
934 .defaultElementTypeNamespaceURI>,
935 local_name => 'Node');
936 if (ref $makeNewNode eq 'CODE') {
937 $makeNewNode->($self, $r, %opt);
938 }
939 }__;
940 }
941 } # FIND
942
943 @Method:
944 @@Name:setAttribute
945 @@Description:
946 @@@lang:en
947 @@@@:
948 Sets the value of the first child element with the given name. If
949 it does not exist, a new element has created and the value is set
950 to it.
951 \
952 {TODO:: How this method treats shadow tree is not yet decided.
953 \
954 }
955 @@NSVariant:.setAttributeNS
956 @@Param:
957 @@@Name:localName
958 @@@Type:SWCFGString
959 @@@Description:
960 @@@@lang:en
961 @@@@@:
962 The name of the element to set the value.
963 @@Param:
964 @@@Name:value
965 @@@Type:SWCFGString
966 @@@Description:
967 @@@@lang:en
968 @@@@@: The value to set.
969 @@Return:
970 @@@Type:SWCFGElement
971 @@@Description:
972 @@@@lang:en
973 @@@@@: The element to which the value is set.
974 @@@RaiseException:
975 @@@@@:BAD_VALUE_ERR
976 @@@@Description:
977 @@@@@lang:en
978 @@@@@@:
979 An attempt is made to set a value whose type is neither
980 a string, a list (array reference) or a blessed object.
981 @@@PerlDef:
982 if ({qw/HASH 1 CODE 1/}->{ref ($value)}) {
983 __EXCEPTION{BAD_VALUE_ERR::
984 swcfg21:actualType => {ref $value},
985 }__;
986 }
987
988 FIND: {
989 for my $cn (@{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}}) {
990 my $c = $self-><M::ManakaiSWCFGNode.getNodeReference> ($cn);
991 if ($c-><AG::SWCFGNode.nodeType> eq '#element' and
992 $c-><AG::SWCFGNode.localName> eq $localName) {
993 $r = $c;
994 $r->{<H::mn:node>}->{<H::swcfg21:value>} = $value;
995 for my $rcn (@{$r->{<H::mn:node>}->{<H::swcfg21:childNodes>}}) {
996 CORE::delete $rcn->{<H::swcfg21:parent>};
997 $rcn-><M::NodeStem.orphanate>;
998 }
999 $r->{<H::mn:node>}->{<H::swcfg21:childNodes>} = [];
1000 last FIND;
1001 }
1002 }
1003 ## Not found
1004 __DEEP{
1005 $r = ($self-><AG::SWCFGNode.ownerDocument> || $self)
1006 -><M::SWCFGDocument.createElementNS> (null, $localName);
1007 $self-><M::SWCFGNode.appendNode> ($r);
1008 $r->{<H::mn:node>}->{<H::swcfg21:value>} = $value;
1009 }__;
1010 } # FIND
1011
1012 @Method:
1013 @@Name:setAttributeNS
1014 @@Description:
1015 @@@lang:en
1016 @@@@:
1017 Sets the value of the first child element with the given name. If
1018 it does not exist, a new element has created and the value is set
1019 to it.
1020 \
1021 {TODO:: How this method treats shadow tree is not yet decided.
1022 \
1023 }
1024 @@NonNSVariant:.setAttribute
1025 @@NewIn21:
1026 @@Param:
1027 @@@Name:namespaceURI
1028 @@@Type:SWCFGString
1029 @@@Description:
1030 @@@@lang:en
1031 @@@@@:
1032 The namespace URI of the element to set the value.
1033 @@Param:
1034 @@@Name:localName
1035 @@@Type:SWCFGString
1036 @@@Description:
1037 @@@@lang:en
1038 @@@@@:
1039 The name of the element to set the value.
1040 @@Param:
1041 @@@Name:value
1042 @@@Type:SWCFGString
1043 @@@Description:
1044 @@@@lang:en
1045 @@@@@: The value to set.
1046 @@Return:
1047 @@@Type:SWCFGElement
1048 @@@Description:
1049 @@@@lang:en
1050 @@@@@: The element to which the value is set.
1051 @@@RaiseException:
1052 @@@@@:BAD_VALUE_ERR
1053 @@@@Description:
1054 @@@@@lang:en
1055 @@@@@@:
1056 An attempt is made to set a value whose type is neither
1057 a string, a list (array reference) or a blessed object.
1058 @@@PerlDef:
1059 if ({qw/HASH 1 CODE 1/}->{ref ($value)}) {
1060 __EXCEPTION{BAD_VALUE_ERR::
1061 swcfg21:actualType => {ref $value},
1062 }__;
1063 }
1064
1065 FIND: {
1066 for my $cn (@{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}}) {
1067 my $c = $self-><M::ManakaiSWCFGNode.getNodeReference> ($cn);
1068 my $cnsuri = $c-><AG::SWCFGNode.namespaceURI>;
1069 if ($c-><AG::SWCFGNode.nodeType> eq '#element' and
1070 ((not defined $namespaceURI and
1071 not defined $cnsuri) or
1072 (defined $namespaceURI and defined $cnsuri and
1073 $namespaceURI eq $cnsuri)) and
1074 $cn-><AG::SWCFGNode.localName> eq $localName) {
1075 $r = $c;
1076 $r->{<H::mn:node>}->{<H::swcfg21:value>} = $value;
1077 for my $rcn (@{$r->{<H::mn:node>}->{<H::swcfg21:childNodes>}}) {
1078 CORE::delete $rcn->{<H::swcfg21:parent>};
1079 $rcn-><M::NodeStem.orphanate>;
1080 }
1081 $r->{<H::mn:node>}->{<H::swcfg21:childNodes>} = [];
1082 last FIND;
1083 }
1084 }
1085 ## Not found
1086 __DEEP{
1087 $r = ($self-><AG::SWCFGNode.ownerDocument> || $self)
1088 -><M::SWCFGDocument.createElementNS>
1089 ($namespaceURI, $localName);
1090 $self-><M::SWCFGNode.appendNode> ($r);
1091 $r->{<H::mn:node>}->{<H::swcfg21:value>} = $value;
1092 }__;
1093 } # FIND
1094
1095 @Method:
1096 @@Name: removeAttribute
1097 @@Description:
1098 @@@lang:en
1099 @@@@:
1100 Removes all child elements with the given name.
1101 \
1102 {TODO:: How this method treats shadow tree is not yet decided.
1103 \
1104 }
1105 @@NSVariant:.removeAttributeNS
1106 @@Param:
1107 @@@Name:localName
1108 @@@Type:SWCFGString
1109 @@@Description:
1110 @@@@lang:en
1111 @@@@@:
1112 The local name of the element to remove.
1113 @@Return:
1114 @@@Type: boolean
1115 @@@Description:
1116 @@@@lang:en
1117 @@@@@:
1118 Always returns <DOM::true>.
1119 @@@PerlDef:
1120 my @removed;
1121 $self->{<H::mn:node>}->{<H::swcfg21:childNodes>} = [grep {
1122 my $c = $self-><M::ManakaiSWCFGNode.getNodeReference> ($_);
1123 if ($c-><AG::SWCFGNode.nodeType> eq '#element' and
1124 $c-><AG::SWCFGNode.localName> eq $localName) {
1125 push @removed, $_;
1126 CORE::delete $_->{<H::swcfg21:parent>};
1127 false;
1128 } else {
1129 true;
1130 }
1131 } @{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}}];
1132 for my $n (@removed) {
1133 $n-><M::NodeStem.orphanate>;
1134 }
1135 $r = true;
1136
1137 @Method:
1138 @@Name: removeAttributeNS
1139 @@Description:
1140 @@@lang:en
1141 @@@@:
1142 Removes all child elements with the given name.
1143 \
1144 {TODO:: How this method treats shadow tree is not yet decided.
1145 \
1146 }
1147 @@NonNSVariant:.removeAttribute
1148 @@NewIn21:
1149 @@Param:
1150 @@@Name:namespaceURI
1151 @@@Type:SWCFGString
1152 @@@Description:
1153 @@@@lang:en
1154 @@@@@:
1155 The namespace URI of the element to remove.
1156 @@Param:
1157 @@@Name:localName
1158 @@@Type:SWCFGString
1159 @@@Description:
1160 @@@@lang:en
1161 @@@@@:
1162 The local name of the element to remove.
1163 @@Return:
1164 @@@Type: boolean
1165 @@@Description:
1166 @@@@lang:en
1167 @@@@@:
1168 Always returns <DOM::true>.
1169 @@@PerlDef:
1170 my @removed;
1171 $self->{<H::mn:node>}->{<H::swcfg21:childNodes>} = [grep {
1172 my $c = $self-><M::ManakaiSWCFGNode.getNodeReference> ($_);
1173 my $cnsuri = $c-><AG::SWCFGNode.namespaceURI>;
1174 if ($c-><AG::SWCFGNode.nodeType> eq '#element' and
1175 ((not defined $namespaceURI and not defined $cnsuri) or
1176 (defined $namespaceURI and defined $cnsuri and
1177 $namespaceURI eq $cnsuri)) and
1178 $c-><AG::SWCFGNode.localName> eq $localName) {
1179 push @removed, $_;
1180 CORE::delete $_->{<H::swcfg21:parent>};
1181 false;
1182 } else {
1183 true;
1184 }
1185 } @{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}}];
1186 for my $n (@removed) {
1187 $n-><M::NodeStem.orphanate>;
1188 }
1189 $r = true;
1190
1191 @Attr:
1192 @@Name: childNodes
1193 @@Type: SWCFGChildNodeList
1194 @@actualType: ManakaiSWCFGChildNodeList
1195 @@Description:
1196 @@@lang:en
1197 @@@@:
1198 The list of child nodes, including nodes from shadow trees.
1199 If the type of the node is
1200 <CODE::#comment>, the list is always empty.
1201 @@Get:
1202 @@@PerlDef:
1203 __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
1204 $object => {$self->{<H::mn:node>}},
1205 $ref => {$r},
1206 $class => {<ClassName::ManakaiSWCFGChildNodeList>},
1207 }__;
1208 $r->{nodeClass} = ref $self;
1209
1210 @Attr:
1211 @@Name:localName
1212 @@Description:
1213 @@@lang:en
1214 @@@@:
1215 The local name of the node.
1216 @@Type:SWCFGString
1217 @@Get:
1218 @@@disDef:
1219 @@@@DISLang:nop:
1220 @@@Description:
1221 @@@@lang:en
1222 @@@@@:
1223 The local name of the node.
1224 @@@Type:SWCFGString
1225 @@@InCase:
1226 @@@@Value:
1227 @@@@@is-null:1
1228 @@@@Type:SWCFGString
1229 @@@@Description:
1230 @@@@@lang:en
1231 @@@@@@:
1232 The node does not have the local name.
1233 No node of type other than <CODE::#element> has the local name.
1234 @@Set:
1235 @@@disDef:
1236 @@@@DISLang:nop:
1237 @@@Description:
1238 @@@@lang:en
1239 @@@@@:
1240 Sets the local name. Setting the local name to the node
1241 whose type is other than <CODE::#element> has no effect.
1242
1243 @Attr:
1244 @@Name:namespaceURI
1245 @@NewIn21:
1246 @@Description:
1247 @@@lang:en
1248 @@@@:
1249 The namespace URI of the node.
1250 @@Type:SWCFGString
1251 @@Get:
1252 @@@disDef:
1253 @@@@DISLang:nop:
1254 @@@Type:SWCFGString
1255 @@@Description:
1256 @@@@lang:en
1257 @@@@@:
1258 The namespace URI of the node.
1259 @@@InCase:
1260 @@@@Value:
1261 @@@@@is-null:1
1262 @@@@Type:SWCFGString
1263 @@@@Description:
1264 @@@@@lang:en
1265 @@@@@@:
1266 The node does not have the namespace URI.
1267 No node of type other than <CODE::#element> has the local name.
1268 @@Set:
1269 @@@disDef:
1270 @@@@DISLang:nop:
1271 @@@Description:
1272 @@@@lang:en
1273 @@@@@:
1274 Sets the namespace URI. Setting the local name to the node
1275 whose type is other than <CODE::#element> has no effect.
1276 @@@InCase:
1277 @@@@Value:
1278 @@@@@is-null:1
1279 @@@@Type:SWCFGString
1280 @@@@Description:
1281 @@@@@lang:en
1282 @@@@@@:
1283 Sets the node not to have its namespace URI (or sets
1284 the namespace as the <QUOTE::<DOM::null> namespace>.
1285
1286 @Attr:
1287 @@Name:nodeType
1288 @@Type:SWCFGString
1289 @@Description:
1290 @@@lang:en
1291 @@@@:
1292 The type of the node.
1293 @@Get:
1294 @@@Type:SWCFGString
1295 @@@disDef:
1296 @@@@ConstValue:\#element
1297 @@@InCase:
1298 @@@@Value:\#comment
1299 @@@@Type:SWCFGString
1300 @@@@Description:
1301 @@@@@lang:en
1302 @@@@@@:This node is a comment node.
1303 @@@InCase:
1304 @@@@Value:\#document
1305 @@@@Type:SWCFGString
1306 @@@@Description:
1307 @@@@@lang:en
1308 @@@@@@:This node is a document node.
1309 @@@InCase:
1310 @@@@Value:\#element
1311 @@@@Type:SWCFGString
1312 @@@@Description:
1313 @@@@@lang:en
1314 @@@@@@:This node is an element node.
1315 @@@InCase:
1316 @@@@Value:\#fragment
1317 @@@@Type:SWCFGString
1318 @@@@Description:
1319 @@@@@lang:en
1320 @@@@@@:This node is a document fragment node.
1321
1322 @Attr:
1323 @@Name:parentNode
1324 @@Type:SWCFGNode
1325 @@Description:
1326 @@@lang:en
1327 @@@@:
1328 The parent node of this node, if any.
1329 @@ModIn21:
1330 @@Get:
1331 @@@Description:
1332 @@@@lang:en
1333 @@@@@:The parent node.
1334 @@@InCase:
1335 @@@@Value:
1336 @@@@@is-null:1
1337 @@@@Type:SWCFGNode
1338 @@@@Description:
1339 @@@@@lang:en
1340 @@@@@@:This node has no parent node.
1341 @@@PerlDef:
1342 $r = $self->{<H::mn:node>}->{<H::swcfg21:parent>};
1343 if ($r) {
1344 if ($r->{<H::swcfg21:shadowParent>}) {
1345 $r = $r->{<H::swcfg21:shadowParent>};
1346 } elsif ($r->{<H::swcfg21:shadowSiblingOf>}) {
1347 $r = $r->{<H::swcfg21:shadowSiblingOf>}->{<H::swcfg21:parent>};
1348 }
1349 }
1350 $r = $self-><M::ManakaiSWCFGNode.getNodeReference> ($r) if $r;
1351
1352 @Attr:
1353 @@Name:realParentNode
1354 @@Type:SWCFGNode
1355 @@Description:
1356 @@@lang:en
1357 @@@@:
1358 The parent node of this node, if any.
1359 @@NewIn21:
1360 @@Get:
1361 @@@Description:
1362 @@@@lang:en
1363 @@@@@:The parent node.
1364 @@@InCase:
1365 @@@@Value:
1366 @@@@@is-null:1
1367 @@@@Type:SWCFGNode
1368 @@@@Description:
1369 @@@@@lang:en
1370 @@@@@@:This node has no parent node.
1371 @@@PerlDef:
1372 $r = $self->{<H::mn|node>}->{<H::swcfg21|parent>};
1373 if (defined $r) {
1374 $r = <ClassM::ManakaiSWCFGNode.getNodeReference> ($r);
1375 }
1376
1377 @Attr:
1378 @@Name:count
1379 @@Type: unsignedLong
1380 @@Description:
1381 @@@lang:en
1382 @@@@:
1383 The number of children of this node, includeing
1384 child nodes in shadow trees. If this node has
1385 the value, it is also counted as a <QUOTE::child>.
1386 @@ModIn21:
1387 @@Get:
1388 @@@UndeclaredPrefixException:
1389 @@@PerlDef:
1390 my $node = $self->{<H::mn:node>};
1391 $r = (defined $node->{<H::swcfg21:value>} ? 1 : 0)
1392 + @{$node->{<H::swcfg21:childNodes>}};
1393 __CODE{expandETBinding:: $node => $node}__;
1394 if ($node->{<H::swcfg21:shadowContent>}) {
1395 $r++ if not defined $node->{<H::swcfg21:value>} and
1396 defined $node->{<H::swcfg21:shadowContent>}->{<H::swcfg21:value>};
1397 $r += @{$node->{<H::swcfg21:shadowContent>}->{<H::swcfg21:childNodes>}};
1398 }
1399 for my $cc (@{$node->{<H::swcfg21:childNodes>}}) {
1400 __CODE{expandETBinding:: $node => $cc}__;
1401 $r += @{$cc->{<H::swcfg21:shadowSibling>}->{<H::swcfg21:childNodes>}}
1402 if $cc->{<H::swcfg21:shadowSibling>};
1403 }
1404
1405 @Attr:
1406 @@Name:realCount
1407 @@Type: unsignedLong
1408 @@Description:
1409 @@@lang:en
1410 @@@@:
1411 The number of children of this node. If this node has
1412 the value, it is also counted as a <QUOTE::child>.
1413 @@NewIn21:
1414 @@Get:
1415 @@@PerlDef:
1416 $r = (defined $self->{<H::mn:node>}->{<H::swcfg21:value>} ? 1 : 0)
1417 + @{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}};
1418
1419 @Method:
1420 @@Name:innerText
1421 @@Description:
1422 @@@lang:en
1423 @@@@:
1424 Returns the text value of this node.
1425 @@ModIn21:
1426 @@NamedParam:
1427 @@@Name:newValue
1428 @@@Type: any
1429 @@@Description:
1430 @@@@lang:en
1431 @@@@@:
1432 The new node value. If <P::newValue> is specified,
1433 the node value is changed before returning the value.
1434 Sets a value to document or document fragment node has no effect.
1435 @@Return:
1436 @@@Type:SWCFGString
1437 @@@Description:
1438 @@@@lang:en
1439 @@@@@:
1440 The value of this node. If the value is of list,
1441 values are separeted by a <CHAR::LINE FEED> character.
1442 Note that the last item of the list will <EM::not>
1443 suffixed by a <CHAR::LINE FEED>.
1444 @@@InCase:
1445 @@@@Value:
1446 @@@@@is-null:1
1447 @@@@Type:SWCFGString
1448 @@@@Description:
1449 @@@@@lang:en
1450 @@@@@@:
1451 The node has no value.
1452 @@@PerlDef:
1453 my $node = $self->{<H::mn:node>};
1454 if (defined $newValue) {
1455 $node->{<H::swcfg21:value>} = $newValue;
1456 }
1457 my $v;
1458 if (defined $node->{<H::swcfg21:value>}) {
1459 $v = $node->{<H::swcfg21:value>};
1460 } else {
1461 __CODE{expandETBinding:: $node => $node}__;
1462 $v = defined $node->{<H::swcfg21:shadowContent>}
1463 ? $node->{<H::swcfg21:shadowContent>}->{<H::swcfg21:value>} : null;
1464 }
1465 $r = ref $v eq 'ARRAY' ? join "\x0A", @$v : $v;
1466
1467 @Method:
1468 @@Name:actualInnerText
1469 @@Description:
1470 @@@lang:en
1471 @@@@:
1472 Returns the text value of this node.
1473 @@NewIn21:
1474 @@NamedParam:
1475 @@@Name:newValue
1476 @@@Type: any
1477 @@@Description:
1478 @@@@lang:en
1479 @@@@@:
1480 The new node value. If <P::newValue> is specified,
1481 the node value is changed before returning the value.
1482 Sets a value to document or document fragment node has no effect.
1483 @@Return:
1484 @@@Type:SWCFGString
1485 @@@Description:
1486 @@@@lang:en
1487 @@@@@:
1488 The value of this node. If the value is of list,
1489 values are separeted by a <CHAR::LINE FEED> character.
1490 Note that the last item of the list will <EM::not>
1491 suffixed by a <CHAR::LINE FEED>.
1492 @@@InCase:
1493 @@@@Value:
1494 @@@@@is-null:1
1495 @@@@Type:SWCFGString
1496 @@@@Description:
1497 @@@@@lang:en
1498 @@@@@@:
1499 The node has no value.
1500 @@@PerlDef:
1501 my $node = $self->{<H::mn:node>};
1502 if (defined $newValue) {
1503 $node->{<H::swcfg21:value>} = $newValue;
1504 }
1505 my $v;
1506 if (defined $node->{<H::swcfg21:value>}) {
1507 $v = $node->{<H::swcfg21:value>};
1508 }
1509 $r = ref $v eq 'ARRAY' ? join "\x0A", @$v : $v;
1510
1511 @Method:
1512 @@Name:value
1513 @@Description:
1514 @@@lang:en
1515 @@@@:
1516 Returns the value of this node.
1517 @@ModIn21:
1518 @@NamedParam:
1519 @@@Name:asArray
1520 @@@Type: boolean
1521 @@@Description:
1522 @@@@lang:en
1523 @@@@@:
1524 Whether the value should be returned as an array reference
1525 even if the node value is a simple string.
1526 @@@InCase:
1527 @@@@Value:
1528 @@@@@@:1
1529 @@@@@ContentType: DISCore|Boolean
1530 @@@@Type: boolean
1531 @@@@Description:
1532 @@@@@lang:en
1533 @@@@@@:
1534 The node value is always returned as an array reference.
1535 @@@InCase:
1536 @@@@Value:
1537 @@@@@@:0
1538 @@@@@ContentType: DISCore|Boolean
1539 @@@@Type: boolean
1540 @@@@Description:
1541 @@@@@lang:en
1542 @@@@@@:
1543 The node value is returned as an array reference if and
1544 only if the node value is a list value.
1545 @@Return:
1546 @@@Type: any
1547 @@@Description:
1548 @@@@lang:en
1549 @@@@@:
1550 The node value. If the <P::asArray> value is <DOM::false>,
1551 the current node value is returned as is. If the <P::asArray>
1552 value is <DOM::true> and the node value is a simple string,
1553 then an array reference containing the value as an only item
1554 is returned. If <DOM::true> and the node value is not defined,
1555 then an empty array reference is returned.
1556 @@@UndeclaredPrefixException:
1557 @@@PerlDef:
1558 my $node = $self->{<H::mn:node>};
1559 my $v;
1560 if (defined $node->{<H::swcfg21:value>}) {
1561 $v = $node->{<H::swcfg21:value>};
1562 } else {
1563 __CODE{expandETBinding:: $node => $node}__;
1564 $v = defined $node->{<H::swcfg21:shadowContent>}
1565 ? $node->{<H::swcfg21:shadowContent>}->{<H::swcfg21:value>} : null;
1566 }
1567 if ($asArray and ref $v ne 'ARRAY') {
1568 $r = defined $v ? [$v] : [];
1569 } else {
1570 $r = $v;
1571 }
1572
1573 @Attr:
1574 @@Name:valueRef
1575 @@Description:
1576 @@@lang:en
1577 @@@@:
1578 A reference to the value of this node.
1579 @@NewIn21:
1580 @@Get:
1581 @@@Type: DISPerl|SCALAR||ManakaiDOM|all
1582 @@@Description:
1583 @@@@lang:en
1584 @@@@@:
1585 A reference to the node value. If the value is a list,
1586 the value is <EM::unspecified>.
1587
1588 {NOTE:: Applications <kwd:SHOULD-NOT> try to modify
1589 the value via the reference; such operations
1590 might result in broken object model.
1591 }
1592 @@@InCase:
1593 @@@@Value:
1594 @@@@@is-null:1
1595 @@@@@enDesc:
1596 The node has no value.
1597 @@@UndeclaredPrefixException:
1598 @@@PerlDef:
1599 my $node = $self->{<H::mn:node>};
1600 if (defined $node->{<H::swcfg21:value>}) {
1601 $r = \ ($node->{<H::swcfg21:value>});
1602 } else {
1603 __CODE{expandETBinding:: $node => $node}__;
1604 $r = defined $node->{<H::swcfg21:shadowContent>}
1605 ? \ ($node->{<H::swcfg21:shadowContent>}->{<H::swcfg21:value>}) : null;
1606 }
1607
1608 @Method:
1609 @@Operator:
1610 @@@ContentType: DISCore|QName
1611 @@@@:
1612 DISPerl:AsStringMethod
1613 @@Description:
1614 @@@lang:en
1615 @@@@:
1616 The string representation of the node, i.e. the serialized
1617 text form of a SuikaWikiConfig/2.0 document or document fragment.
1618 \
1619 {NOTE:: If a namespace URI in any node in the subtree rooted
1620 by this node does not have its corresponding namespace
1621 prefix, then this method assigns a prefix to that URI.
1622 \
1623 }
1624 \
1625 {NOTE:: This method results in a ill-formed SuikaWikiConfig
1626 document (fragment) if any node has unserializable
1627 property, e.g. a value starts with <CODE::?SuikaWikiConfig>
1628 on the comment node.
1629 \
1630 }
1631 @@ModIn21:
1632 @@NamedParam:
1633 @@@Name:outputHeader
1634 @@@Type: boolean
1635 @@@Description:
1636 @@@@lang:en
1637 @@@@@:
1638 Whether the magic identifier (the signature header) should
1639 be prefixed or not, if this node is the document node.
1640 @@Return:
1641 @@@Type:SWCFGString
1642 @@@PerlDef:
1643 my $nt = $self-><AG::SWCFGNode.nodeType>;
1644 my $node = $self->{<H::mn:node>};
1645 if ($nt eq '#element') {
1646 $r = $self-><M::SWCFGNode.actualInnerText>;
1647 if (scalar @{$node->{<H::swcfg21:childNodes>}}) {
1648 if (defined $r) {
1649 $r =~ s/(^|\x0A)(?=([\\\@\#\s]|$))?/$1." ".
1650 (defined $2?"\\":"")/ges;
1651 $r = $self-><AG::SWCFGElement.realQualifiedName>
1652 . ":\x0A \@\@"
1653 . (ref ($node->{<H::swcfg21:value>}) eq 'ARRAY' ? '[list]' : '')
1654 . ":" . ((($r !~ /[\x0D\x0A:]/) and (length ($r) < 50))
1655 ? '' : "\x0A")
1656 . (length $r ? $r : '\\') . "\x0A";
1657 } else {
1658 $r = $self-><AG::SWCFGElement.realQualifiedName>
1659 . ":\x0A";
1660 }
1661 for my $cn (@{$node->{<H::swcfg21:childNodes>}}) {
1662 next unless $cn->{<H::swcfg21:nodeType>} eq '#element';
1663 my $rc = $self-><M::ManakaiSWCFGNode.getNodeReference> ($cn)
1664 ->stringify;
1665 $rc =~ s/\x0A /\x0A /gs;
1666 $rc =~ s/(\x0A +\@)/$1\@/gs;
1667 $r .= ' @' . $rc;
1668 }
1669 } else {
1670 $r = '' unless defined $r;
1671 $r =~ s/(^|\x0A)(?=([\\\@\#\s]|$))?/$1." ".(defined $2?"\\":"")/ges;
1672 $r = $self-><AG::SWCFGElement.realQualifiedName>
1673 . (ref ($node->{<H::swcfg21:value>}) eq 'ARRAY' ? '[list]' : '')
1674 . ":" . ((($r !~ /[\x0D\x0A:]/) and (length ($r) < 50))
1675 ? '' : "\x0A")
1676 . (length $r ? $r : '\\') . "\x0A";
1677 }
1678 $r = "\\" . $r if substr ($r, 0, 1) =~ /[\\\@\#\s]/;
1679 } elsif ($nt eq '#document') {
1680 if ($outputHeader) {
1681 $r = '#?SuikaWikiConfig/' . $node->{<H::swcfg21:version>} . "\n";
1682 }
1683
1684 for my $cn (@{$node->{<H::swcfg21:childNodes>}}) {
1685 $r .= "\x0A";
1686 $r .= $self-><M::ManakaiSWCFGNode.getNodeReference> ($cn)->stringify;
1687 }
1688
1689 ## Element Type Binding
1690 my $eb = '';
1691 for my $bk (sort keys %{$self->{<H::mn:node>}
1692 ->{<H::swcfg21:etBinding>}}) {
1693 my $b = $self->{<H::mn:node>}->{<H::swcfg21:etBinding>}->{$bk};
1694 next unless $b;
1695 $eb .= "\x0A" . 'ElementTypeBinding:' . "\x0A"
1696 . ' @Name:' . "\x0A"
1697 . ' ' . $b->{elementType} . "\x0A"
1698 . ' @ElementType:' . "\x0A"
1699 . ' ';
1700 if ($b->{namespaceExpanded}) {
1701 $eb .= $self-><M::SWCFGNode.lookupNamespacePrefix>
1702 ($b->{shadowNamespaceURI}, make_new_binding => true);
1703 $eb .= $b->{shadowLocalName};
1704 } else {
1705 ## NOTE: If namespace binding has changed,
1706 ## associated namespace URI might change.
1707 $eb .= $b->{shadowLocalName};
1708 }
1709 $eb .= "\x0A";
1710 for my $p (qw/shadowContent shadowSibling/) {
1711 next unless $b->{$p};
1712 $eb .= ' @' . ucfirst ($p) . ":\x0A";
1713 my $rc = $self-><M::ManakaiSWCFGNode.getNodeReference> ($b->{$p});
1714 my $ebc = $rc->stringify;
1715 $ebc =~ s/\x0A /\x0A /gs;
1716 $ebc =~ s/(\x0A +\@)/$1\@\@/gs;
1717 $ebc =~ s/\x0A(?=\S)/\x0A \@\@/gs;
1718 $eb .= ' @@' . $ebc;
1719 $ebc = $rc-><M::SWCFGNode.innerText>;
1720 if (defined $ebc) {
1721 $ebc =~ s/(^|\x0A)(?=([\\\@\#\s]|$))?/$1.' '.
1722 (defined $2?"\\":"")/ges;
1723 $eb .= ' @@@'
1724 . (ref ($b->{$p}->{<H::swcfg21:value>}) eq 'ARRAY' ? '[list]' : '')
1725 . ":" . ((($ebc !~ /[\x0D\x0A:]/) and (length ($ebc) < 50))
1726 ? '' : "\x0A")
1727 . (length $ebc ? $ebc : '\\') . "\x0A";
1728 }
1729 }
1730 } # swcfg21:etBinding
1731 $r .= $eb;
1732
1733 ## Namespace bindings
1734 my $ns = '';
1735 for my $pfx (sort keys %{$self->{<H::mn:node>}
1736 ->{<H::swcfg21:nsBinding>}}) {
1737 if ($pfx ne 'URI') {
1738 $ns .= ' @' . $pfx . ':' . "\x0A"
1739 . ' ';
1740 my $uri = $self->{<H::mn:node>}->{<H::swcfg21:nsBinding>}->{$pfx};
1741 if (defined $uri) {
1742 if (length $uri) {
1743 if ($uri =~ /^[\\#\s\@]/) {
1744 $ns .= '\\' . $uri . "\x0A";
1745 } else {
1746 $ns .= $uri . "\x0A";
1747 }
1748 } else {
1749 $ns .= "\\\x0A";
1750 }
1751 } else {
1752 $ns .= '@@is-null: 1' . "\x0A";
1753 }
1754 }
1755 }
1756 $r .= "\x0A" . 'Namespace:' . "\x0A" . $ns . "\x0A" if length $ns;
1757 } elsif ($nt eq '#comment') {
1758 $r = $self-><M::SWCFGNode.innerText>;
1759 $r =~ s/\x0A/\x0A#/gs;
1760 $r = '#' . $r . "\n";
1761 } elsif ($nt eq '#fragment') {
1762 for my $cn (@{$node->{<H::swcfg21:childNodes>}}) {
1763 $r .= $self-><M::ManakaiSWCFGNode.getNodeReference> ($cn)->stringify;
1764 }
1765 } else {
1766 __ASSERT{DISPerl:invariant::
1767 msg => {qq[Node type: "$nt"]},
1768 }__;
1769 }
1770
1771 @Attr:
1772 @@Name:rootNode
1773 @@Description:
1774 @@@lang:en
1775 @@@@:
1776 The root node of the tree to which this node belongs.
1777 If this node is part of a shadow master tree, the root node
1778 of the main tree.
1779 @@Get:
1780 @@@Type:SWCFGNode
1781 @@@PerlDef:
1782 $r = $self->{<H::mn:node>};
1783 {
1784 if ($r->{<H::swcfg21:parent>}) {
1785 $r = $r->{<H::swcfg21:parent>};
1786 redo;
1787 } elsif ($r->{<H::swcfg21:shadowParent>}) {
1788 $r = $r->{<H::swcfg21:shadowParent>};
1789 redo;
1790 } elsif ($r->{<H::swcfg21:shadowSiblingOf>}) {
1791 $r = $r->{<H::swcfg21:shadowSiblingOf>};
1792 redo;
1793 } elsif ($r->{<H::swcfg21:isShadowMaster>}) {
1794 $r = $r->{<H::swcfg21:ownerDocument>};
1795 }
1796 }
1797 $r = $self-><M::ManakaiSWCFGNode.getNodeReference> ($r);
1798
1799 @Method:
1800 @@Name:nodePath
1801 @@Description:
1802 @@@lang:en
1803 @@@@:
1804 Returns a string representing the position of this node
1805 in the document tree.
1806 \
1807 {NOTE:: The position is represented in the informal
1808 XPath-like expression. In the current implementation,
1809 it does not conform to XPath nor is able to
1810 identify the node uniquely.
1811 \
1812 }
1813 @@NamedParam:
1814 @@@Name:key
1815 @@@Type: any
1816 @@@Description:
1817 @@@@lang:en
1818 @@@@@:
1819 Either an attribute name or a reference to an array
1820 containing attribute names. Attribute names are
1821 used as <QUOTE::keys> to identify a node.
1822 @@Return:
1823 @@@Type:SWCFGString
1824 @@@Description:
1825 @@@@lang:en
1826 @@@@@:
1827 Node path string.
1828 @@@PerlDef:
1829 __DEEP{
1830 my $parent = $self-><AG::SWCFGNode.parentNode>;
1831 if ($parent) {
1832 $r = $parent-><M::SWCFGNode.nodePath> (%opt);
1833 } else {
1834 $r = '';
1835 }
1836 my $node_type = $self-><AG::SWCFGNode.nodeType>;
1837 if ($node_type eq '#element') {
1838 $r .= '/' . $self-><AG::SWCFGElement.realQualifiedName>;
1839 if ($key) {
1840 for my $k (ref $key eq 'ARRAY' ? @{$key} : $key) {
1841 my $key_val = $self-><M::SWCFGNode.getAttributeValue> ($k);
1842 if (defined $key_val) {
1843 $r .= '[@' . $k . '=' . $key_val . ']';
1844 }
1845 }
1846 }
1847 } elsif ($node_type eq '#comment') {
1848 $r .= q</comment ()>;
1849 } elsif ($node_type eq '#document') {
1850 $r .= q</document (>
1851 . ($self-><M::SWCFGNode.flag> (<Q::swcfg21:fileName>) || '')
1852 . q<)>;
1853 } elsif ($node_type eq '#fragment') {
1854 $r .= q</fragment ()>;
1855 } else {
1856 __ASSERT{DISPerl:invariant::
1857 msg => {qq<Node path = "$r" ... Oops! Node type: "$node_type">},
1858 }__;
1859 }
1860 }__;
1861
1862 @Method:
1863 @@Name:flag
1864 @@Description:
1865 @@@lang:en
1866 @@@@:
1867 Gets or sets an application data associated with this node.
1868 \
1869 {NOTE:: The SuikaWikiConfig/2.1 object implementation
1870 does not use <QUOTE::flags> to decide what to do.
1871 Applications are free to use this space.
1872 \
1873 }
1874 @@Param:
1875 @@@Name:name
1876 @@@Type:SWCFGString
1877 @@@Description:
1878 @@@@lang:en
1879 @@@@@:
1880 The name of flag to get or set its value.
1881 \
1882 {NOTE:: Applications are advised to use a URI reference
1883 <SRC::RFC 3986> for flag names to avoid name confliction.
1884 \
1885 }
1886 @@Param:
1887 @@@Name:value
1888 @@@Type: any
1889 @@@Description:
1890 @@@@lang:en
1891 @@@@@:
1892 Any data to associate with this node.
1893 \
1894 {NOTE:: Associating a node belonging to the same tree as
1895 this node might lead memory leak because of its
1896 reference loop.
1897 \
1898 }
1899 @@@InCase:
1900 @@@@Value:
1901 @@@@@is-null:1
1902 @@@@Type: any
1903 @@@@Description:
1904 @@@@@lang:en
1905 @@@@@@:
1906 The current flag value is left unchanged.
1907 \
1908 {NOTE:: There is no way to remove a flag entirely.
1909 \
1910 }
1911 @@DefaultParam:
1912 @@Return:
1913 @@@Type: any
1914 @@@Description:
1915 @@@@lang:en
1916 @@@@@:
1917 The (possibly new) value associated with the flag of <P::name>.
1918 @@@InCase:
1919 @@@@Value:
1920 @@@@@is-null:1
1921 @@@@Type: any
1922 @@@@Description:
1923 @@@@@lang:en
1924 @@@@@@:
1925 No value is associated with the flag and no default value provided.
1926 @@@PerlDef:
1927 if (defined $value) {
1928 $r = $self->{<H::mn:node>}->{<H::swcfg21:flag>}->{$name} = $value;
1929 } else {
1930 $r = defined $self->{<H::mn:node>}->{<H::swcfg21:flag>}->{$name}
1931 ? $self->{<H::mn:node>}->{<H::swcfg21:flag>}->{$name} : $default;
1932 }
1933
1934 @Method:
1935 @@Name:option
1936 @@Description:
1937 @@@lang:en
1938 @@@@:
1939 Gets or sets a named option to this node.
1940 \
1941 {NOTE:: Currently no options has defined.
1942 \
1943 }
1944 @@Param:
1945 @@@Name:name
1946 @@@Type:SWCFGString
1947 @@@Description:
1948 @@@@lang:en
1949 @@@@@: The option name.
1950 @@Param:
1951 @@@Name:value
1952 @@@Type: any
1953 @@@Description:
1954 @@@@lang:en
1955 @@@@@:The option value to set.
1956 @@@InCase:
1957 @@@@Value:
1958 @@@@@is-null:1
1959 @@@@Type: any
1960 @@@@Description:
1961 @@@@@lang:en
1962 @@@@@@:
1963 The option value is left unchanged.
1964 \
1965 {NOTE:: There is no way to remove an option value.
1966 \
1967 }
1968 @@Return:
1969 @@@Type: any
1970 @@@Description:
1971 @@@@lang:en
1972 @@@@@:The (possibly new) value of the option.
1973 @@@InCase:
1974 @@@@Value:
1975 @@@@@is-null:1
1976 @@@@Type: any
1977 @@@@Description:
1978 @@@@@lang:en
1979 @@@@@@:No value has set to the option.
1980 @@@PerlDef:
1981 if (defined $value) {
1982 $self->{<H::mn:node>}->{<H::swcfg21:option>}->{$name} = $value;
1983 }
1984 $r = $self->{<H::mn:node>}->{<H::swcfg21:option>}->{$name};
1985
1986 @Method:
1987 @@Operator:
1988 @@@ContentType: DISCore|QName
1989 @@@@:
1990 DISPerl:CloneMethod
1991 @@Description:
1992 @@@lang:en
1993 @@@@:
1994 Makes a copy of this node. All child nodes are cloned and
1995 all flags and options are copied (rather than cloned).
1996 The new node does not have any parent.
1997 @@ModIn21:
1998 @@Return:
1999 @@@Type:SWCFGNode
2000 @@@Description:
2001 @@@@lang:en
2002 @@@@@:
2003 The cloned node.
2004 \
2005 If this node is a document node, then the another document is made.
2006 @@@PerlDef:
2007 __DEEP{
2008 my $od = $self-><AG::SWCFGNode.ownerDocument> || $self;
2009 my $nt = $self-><AG::SWCFGNode.nodeType>;
2010 if ($nt eq '#element') {
2011 $r = $self-><M::ManakaiSWCFGNode.getNodeReference>
2012 (<ClassM::ManakaiSWCFGElement.newObject>);
2013 for my $p (<H::swcfg21:shadowLocalName>, <H::swcfg21:shadowNamespaceURI>,
2014 <H::swcfg21:localName>, <H::swcfg21:namespaceURI>,
2015 <H::swcfg21:namespaceExpanded>, <H::swcfg21:etExpanded>,
2016 <H::swcfg21:ownerDocument>) {
2017 $r->{<H::mn:node>}->{$p} = $self->{<H::mn:node>}->{$p};
2018 }
2019 $r->{<H::mn:node>}->{<H::swcfg21:value>}
2020 = defined $self->{<H::mn:node>}->{<H::swcfg21:value>}
2021 ? ref $self->{<H::mn:node>}->{<H::swcfg21:value>} eq 'ARRAY'
2022 ? [@{$self->{<H::mn:node>}->{<H::swcfg21:value>}}]
2023 : $self->{<H::mn:node>}->{<H::swcfg21:value>} : null;
2024 for my $p (<H::swcfg21:shadowContent>, <H::swcfg21:shadowSibling>) {
2025 if ($self->{<H::mn:node>}->{$p}) {
2026 my $c = $self-><M::ManakaiSWCFGNode.getNodeReference>
2027 ($self->{<H::mn:node>}->{$p})->clone;
2028 $r->{<H::mn:node>}->{$p} = $c->{<H::mn:node>};
2029 $r->{<H::mn:node>}
2030 -><M::NodeStem.importTree> ($r->{<H::mn:node>}->{$p});
2031 $r->{<H::mn:node>}->{$p}
2032 ->{+{
2033 <H::swcfg21:shadowContent> => <H::swcfg21:shadowParent>,
2034 <H::swcfg21:shadowSibling> => <H::swcfg21:shadowSiblingOf>,
2035 }->{$p}} = $r->{<H::mn:node>};
2036 }
2037 }
2038 for my $cn (@{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}}) {
2039 my $c = $self-><M::ManakaiSWCFGNode.getNodeReference> ($cn);
2040 $r-><M::SWCFGNode.appendNode> ($c->clone);
2041 }
2042 } elsif ($nt eq '#comment') {
2043 $r = $od-><M::SWCFGDocument.createComment>
2044 ($self->{<H::mn:node>}->{<H::swcfg21:value>});
2045 } elsif ($nt eq '#fragment') {
2046 $r = $od-><M::SWCFGDocument.createDocumentFragment>;
2047 ## swcfg21:isShadowMaster property is not copied
2048 for my $cn (@{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}}) {
2049 my $c = $self-><M::ManakaiSWCFGNode.getNodeReference> ($cn);
2050 $r-><M::SWCFGNode.appendNode> ($c->clone);
2051 }
2052 $r->{<H::mn:node>}->{<H::swcfg21:value>}
2053 = defined $self->{<H::mn:node>}->{<H::swcfg21:value>}
2054 ? ref $self->{<H::mn:node>}->{<H::swcfg21:value>} eq 'ARRAY'
2055 ? [@{$self->{<H::mn:node>}->{<H::swcfg21:value>}}]
2056 : $self->{<H::mn:node>}->{<H::swcfg21:value>} : null;
2057 } elsif ($nt eq '#document') {
2058 $r = $od-><AG::SWCFGDocument.implementation>
2059 -><M::SWCFGImplementation.createSWCFGDocument>;
2060 $r->{<H::mn:node>}->{<H::swcfg21:nsBinding>}
2061 = {%{$self->{<H::mn:node>}->{<H::swcfg21:nsBinding>}}};
2062 for my $bk (keys %{$self->{<H::mn:node>}->{<H::swcfg21:etBinding>}}) {
2063 my $b = $self->{<H::mn:node>}->{<H::swcfg21:etBinding>}->{$bk};
2064 next unless $b;
2065 my $c = $r->{<H::mn:node>}->{<H::swcfg21:etBinding>}->{$bk} = {
2066 elementType => $b->{elementType},
2067 shadowLocalName => $b->{shadowLocalName},
2068 shadowNamespaceURI => $b->{shadowNamespaceURI},
2069 namespaceExpanded => $b->{namespaceExpanded},
2070 };
2071 for my $p (qw/shadowContent shadowSibling/) {
2072 if ($b->{$p}) {
2073 my $cl = $self-><M::ManakaiSWCFGNode.getNodeReference>
2074 ($b->{$p})->clone;
2075 $c->{$p} = $cl->{<H::mn:node>};
2076 $r->{<H::mn:node>}-><M::NodeStem.importTree> ($c->{$p});
2077 my @l = $c->{$p};
2078 while (@l) {
2079 my $l = shift @l; next unless $l;
2080 $l->{<H::swcfg21:ownerDocument>} = $r->{<H::mn:node>};
2081 for my $n (@{$l->{<H::swcfg21:childNodes>}},
2082 $l->{<H::swcfg21:shadowContent>}, ## Does not allowed
2083 $l->{<H::swcfg21:shadowSibling>}) { ## but for safe
2084 push @l, $n;
2085 }
2086 }
2087 $c->{$p}->{<H::swcfg21:isShadowMaster>} = true;
2088 }
2089 }
2090 }
2091 for my $cn (@{$self->{<H::mn:node>}->{<H::swcfg21:childNodes>}}) {
2092 my $c = $self-><M::ManakaiSWCFGNode.getNodeReference> ($cn)->clone;
2093 $r->{<H::mn:node>}
2094 -><M::NodeStem.importTree> ($c->{<H::mn:node>});
2095 my @l = $c->{<H::mn:node>};
2096 while (@l) {
2097 my $l = shift @l; next unless $l;
2098 __CODE{mn|setXRefNode||ManakaiDOM|Perl::
2099 $referrer => {$l},
2100 $propName => {<H::swcfg21:ownerDocument>},
2101 $referent => {$r->{<H::mn:node>}},
2102 }__;
2103 for my $n (@{$l->{<H::swcfg21:childNodes>}},
2104 $l->{<H::swcfg21:shadowContent>},
2105 $l->{<H::swcfg21:shadowSibling>}) {
2106 push @l, $n;
2107 }
2108 }
2109 $r-><M::SWCFGNode.appendNode> ($c);
2110 }
2111 } else {
2112 __ASSERT{DISPerl:invariant::
2113 msg => {qq[Node type: "$nt"]},
2114 }__;
2115 }
2116 }__;
2117 $r->{<H::mn:node>}->{<H::swcfg21:flag>}
2118 = {%{$self->{<H::mn:node>}->{<H::swcfg21:flag>}||{}}};
2119 $r->{<H::mn:node>}->{<H::swcfg21:option>}
2120 = {%{$self->{<H::mn:node>}->{<H::swcfg21:option>}||{}}};
2121
2122 @Attr:
2123 @@Name:ownerDocument
2124 @@NewIn21:
2125 @@Description:
2126 @@@lang:en
2127 @@@@:
2128 The document object associated with this node.
2129 @@Get:
2130 @@@Type:SWCFGDocument
2131 @@@Description:
2132 @@@@lang:en
2133 @@@@@:
2134 The document object associated with this node.
2135 @@@InCase:
2136 @@@@Value:
2137 @@@@@is-null:1
2138 @@@@Type:SWCFGDocument
2139 @@@@Description:
2140 @@@@@lang:en
2141 @@@@@@:
2142 This node is a document node.
2143 @@@PerlDef:
2144 $r = $self->{<H::mn|node>}->{<H::swcfg21|ownerDocument>};
2145 if (defined $r) {
2146 $r = <ClassM::ManakaiSWCFGNode.getNodeReference> ($r);
2147 }
2148
2149 @Method:
2150 @@Name:lookupNamespacePrefix
2151 @@Description:
2152 @@@lang:en
2153 @@@@:
2154 Looks up the namespace prefix associated to the given
2155 namespace URI. The default namespaces are ignored.
2156 @@NewIn21:
2157 @@Param:
2158 @@@Name:namespaceURI
2159 @@@Type:SWCFGString
2160 @@@Description:
2161 @@@@lang:en
2162 @@@@@:
2163 The namespace URI to look for.
2164 @@@InCase:
2165 @@@@Value:
2166 @@@@@is-null:1
2167 @@@@Description:
2168 @@@@@lang:en
2169 @@@@@@:
2170 The <DOM::null> namespace.
2171 @@NamedParam:
2172 @@@Name: makeNewBinding
2173 @@@Type: boolean
2174 @@@Description:
2175 @@@@lang:en
2176 @@@@@:
2177 Whether a new namespace prefix should be bound when
2178 no namespace URI has been associated yet.
2179 @@@InCase:
2180 @@@@Value:
2181 @@@@@@:1
2182 @@@@@ContentType: DISCore|Boolean
2183 @@@@Description:
2184 @@@@@lang:en
2185 @@@@@@:
2186 New binding is made if no prefix associated.
2187 @@@InCase:
2188 @@@@Value:
2189 @@@@@@:0
2190 @@@@@ContentType: DISCore|Boolean
2191 @@@@Description:
2192 @@@@@lang:en
2193 @@@@@@:
2194 Simply returns the <DOM::null> if no prefix associated.
2195 @@Return:
2196 @@@Type:SWCFGString
2197 @@@Description:
2198 @@@@lang:en
2199 @@@@@:
2200 An associated namespace prefix. If more than one prefix
2201 are associated to the namespace URI, the returned prefix
2202 is implementation dependent.
2203 @@@InCase:
2204 @@@@Value:
2205 @@@@@is-null:1
2206 @@@@Type:SWCFGString
2207 @@@@Description:
2208 @@@@@lang:en
2209 @@@@@@:
2210 No associated namespace prefix found.
2211 @@@PerlDef:
2212 $r = null;
2213 my $od = $self-><AG::SWCFGNode.ownerDocument> || $self;
2214 my $binds = $od->{<H::mn:node>}->{<H::swcfg21:nsBinding>};
2215 if (defined $namespaceURI) {
2216 FIND: {
2217 for my $prefix (keys %$binds) {
2218 if (defined $binds->{$prefix} and
2219 $binds->{$prefix} eq $namespaceURI) {
2220 $r = $prefix;
2221 last FIND;
2222 }
2223 }
2224 last FIND unless $makeNewBinding;
2225 ## Not found
2226 if ($namespaceURI =~ /(\w+)$/) {
2227 my $prefix = $1;
2228 unless (exists $binds->{$prefix}) {
2229 $binds->{$prefix} = $namespaceURI;
2230 $r = $prefix;
2231 last FIND;
2232 }
2233 }
2234 my $i = 1;
2235 {
2236 unless (exists $binds->{'ns'.$i}) {
2237 $binds->{$r = 'ns'.$i} = $namespaceURI;
2238 last FIND;
2239 }
2240 $i++;
2241 redo;
2242 }
2243 } # FIND
2244 } else { ## Null namespace
2245 FIND: {
2246 if (exists $binds->{'nu'.'ll'} and not defined $binds->{'nu'.'ll'}) {
2247 $r = 'nu'.'ll';
2248 last FIND;
2249 }
2250 for my $prefix (keys %$binds) {
2251 if (not defined $prefix) {
2252 $r = $prefix;
2253 last FIND;
2254 }
2255 }
2256 last FIND unless $makeNewBinding;
2257 ## Not found
2258 my $i = '';
2259 {
2260 unless (exists $binds->{'nu'.'ll'.$i}) {
2261 $binds->{$r = 'nu'.'ll'.$i} = null;
2262 last FIND;
2263 }
2264 $i++;
2265 redo;
2266 }
2267 }
2268 }
2269
2270 @Method:
2271 @@Name:lookupNamespaceURI
2272 @@Description:
2273 @@@lang:en
2274 @@@@:
2275 Looks up the namespace URI associated to the given prefix.
2276 @@NewIn21:
2277 @@Param:
2278 @@@Name:prefix
2279 @@@Type:SWCFGString
2280 @@@Description:
2281 @@@@lang:en
2282 @@@@@:
2283 The namespace URI to look for.
2284 @@NamedParam:
2285 @@@Name: makeNewBinding
2286 @@@Type: boolean
2287 @@@Description:
2288 @@@@lang:en
2289 @@@@@:
2290 Whether a new binding should be created if no namespace URI
2291 is associated with the <P::prefix> or not.
2292 @@@InCase:
2293 @@@@Value:
2294 @@@@@@:1
2295 @@@@@ContentType: DISCore|Boolean
2296 @@@@Description:
2297 @@@@@lang:en
2298 @@@@@@:
2299 A new binding to the temporary namespace URI
2300 exactly same as <P::prefix> is created
2301 if no binding found.
2302 @@@InCase:
2303 @@@@Value:
2304 @@@@@@:0
2305 @@@@@ContentType: DISCore|Boolean
2306 @@@@Description:
2307 @@@@@lang:en
2308 @@@@@@:
2309 No new binding is created if no binding found. Note that
2310 even if no association newly created, this method
2311 returns the <DOM::null> value.
2312 @@NamedParam:
2313 @@@Name: raisePrefixException
2314 @@@Type: boolean
2315 @@@enDesc:
2316 Whehter an exception should be thrown if <P::prefix>
2317 is not declared or not.
2318 @@Return:
2319 @@@Type:SWCFGString
2320 @@@Description:
2321 @@@@lang:en
2322 @@@@@:The associated namespace URI.
2323 @@@InCase:
2324 @@@@Value:
2325 @@@@@is-null:1
2326 @@@@Type:SWCFGString
2327 @@@@Description:
2328 @@@@@lang:en
2329 @@@@@@:
2330 No namespace prefix is associated to the prefix or
2331 the <DOM::null> namespace is associated.
2332 @@@UndeclaredPrefixException:
2333 @@@PerlDef:
2334 my $od = $self-><AG::SWCFGNode.ownerDocument> || $self;
2335 my $binds = $od->{<H::mn:node>}->{<H::swcfg21:nsBinding>};
2336 if (exists $binds->{$prefix}) {
2337 $r = $binds->{$prefix};
2338 } elsif ($makeNewBinding) {
2339 $r = $binds->{$prefix} = $prefix;
2340 } elsif ($raisePrefixException) {
2341 __EXCEPTION{DIS:UNDECLARED_NS_PREFIX_ERR::
2342 infoset:prefix => {$prefix},
2343 MDOMX:param-name => 'prefix',
2344 DIS:sourceNode => {$self},
2345 }__;
2346 } else {
2347 $r = null;
2348 }
2349
2350 @Method:
2351 @@Name:bindNamespaceURI
2352 @@Description:
2353 @@@lang:en
2354 @@@@:
2355 Binds a namespace URI to a prefix.
2356 @@NewIn21:
2357 @@Param:
2358 @@@Name:prefix
2359 @@@Type:SWCFGString
2360 @@@Description:
2361 @@@@lang:en
2362 @@@@@:
2363 The namespace prefix to which the URI is bound.
2364 If this <P::prefix> is already bound to another URI,
2365 that binding is overwritten.
2366 @@@InCase:
2367 @@@@Value:URI
2368 @@@@Description:
2369 @@@@@lang:en
2370 @@@@@@:
2371 Any attempt to change the namespace URI will not success,
2372 i.e. the namespace binding left unchanged.
2373 @@Param:
2374 @@@Name:namespaceURI
2375 @@@Type:SWCFGString
2376 @@@Description:
2377 @@@@lang:en
2378 @@@@@:
2379 The namespace URI.
2380 @@@InCase:
2381 @@@@Value:
2382 @@@@@is-null:1
2383 @@@@Type:SWCFGString
2384 @@@@Description:
2385 @@@@@lang:en
2386 @@@@@@:
2387 The namespace binding for <P::prefix> is removed.
2388 @@Return:
2389 @@@PerlDef:
2390 unless ($prefix eq 'URI') {
2391 my $od = $self-><AG::SWCFGNode.ownerDocument> || $self;
2392 if (defined $namespaceURI) {
2393 $od->{<H::mn:node>}->{<H::swcfg21:nsBinding>}->{$prefix}
2394 = $namespaceURI;
2395 } else {
2396 CORE::delete $od->{<H::mn:node>}->{<H::swcfg21:nsBinding>}->{$prefix};
2397 }
2398 }
2399
2400 @IntMethod:
2401 @@ForCheck: ManakaiDOM|ForClass
2402 @@Name:getNodeReference
2403 @@Description:
2404 @@@lang:en
2405 @@@@:
2406 Returns a new reference to the node object.
2407 @@ImplNote:
2408 @@@lang:en
2409 @@@@:
2410 Calling this method to get node reference
2411 might be dangerous when <M::SWCFGNode.lookupNamespaceURI>
2412 is overridden; it might lead a node having different namespace
2413 URI from the correct one.
2414 @@ManakaiDOM:isStatic:1
2415 @@Param:
2416 @@@Name:object
2417 @@@Type: NodeStem
2418 @@@Description:
2419 @@@@lang:en
2420 @@@@@:
2421 The node object to be referred.
2422 @@Return:
2423 @@@Type:SWCFGNode
2424 @@@actualType:ManakaiSWCFGNode
2425 @@@Description:
2426 @@@@lang:en
2427 @@@@@:
2428 A newly created reference.
2429 @@@PerlDef:
2430 my $class;
2431 if ($object->{<H::swcfg21:nodeType>} eq '#element') {
2432 $class = <ClassName::ManakaiSWCFGElement>;
2433 } elsif ($object->{<H::swcfg21:nodeType>} eq '#comment') {
2434 $class = <ClassName::ManakaiSWCFGComment>;
2435 } elsif ($object->{<H::swcfg21:nodeType>} eq '#document') {
2436 $class = <ClassName::ManakaiSWCFGDocument>;
2437 } elsif ($object->{<H::swcfg21:nodeType>} eq '#fragment') {
2438 $class = <ClassName::ManakaiSWCFGDocumentFragment>;
2439 } else {
2440 __ASSERT{DISPerl:invariant::
2441 msg => {qq[Node type: "$object->{<H::swcfg21:nodeType>}" ].
2442 qq[(ref: "@{[ref $object]}")]},
2443 }__;
2444 }
2445 __CODE{ManakaiNode|getNewReference||ManakaiDOM|Perl::
2446 $object => $object,
2447 $ref => $r,
2448 $class => $class,
2449 }__;
2450
2451 @Method:
2452 @@Name: isSameNode
2453 @@Description:
2454 @@@lang:en
2455 @@@@:
2456 Return whether this node is the same node as the given one.
2457 \
2458 When two node references are references to the same object,
2459 even if through a proxy, the references may be used completely
2460 interchangably, such that all attributes have the same values
2461 and calling the same method on either reference always has
2462 exactly same effect.
2463 @@NewIn21:
2464 @@Operator:
2465 @@@@: eq
2466 @@@ContentType:
2467 lang:Perl
2468 @@Param:
2469 @@@Name: other
2470 @@@Type: SWCFGNode
2471 @@@Description:
2472 @@@@lang:en
2473 @@@@@: The node to test against.
2474 @@Return:
2475 @@@Type: boolean
2476 @@@InCase:
2477 @@@@Value:
2478 @@@@@@:1
2479 @@@@@ContentType: DISCore|Boolean
2480 @@@@Description:
2481 @@@@@lang:en
2482 @@@@@@:
2483 The two nodes are the same.
2484 @@@InCase:
2485 @@@@Value:
2486 @@@@@@:0
2487 @@@@@ContentType: DISCore|Boolean
2488 @@@@Description:
2489 @@@@@lang:en
2490 @@@@@@: The two nodes are not same.
2491 @@@PerlDef:
2492 if (UNIVERSAL::isa ($other, <IFName::NodeRef>)
2493 and $other->{<H::mn:node>}->{<H::mn:nodeID>}
2494 eq $self->{<H::mn:node>}->{<H::mn:nodeID>}) {
2495 $r = true;
2496 }
2497
2498 @IntMethod:
2499 @@Name:newObject
2500 @@ForCheck: ManakaiDOM|ForClass
2501 @@ManakaiDOM:isStatic:1
2502 @@Description:
2503 @@@lang:en
2504 @@@@:
2505 Creates a new instance object for <IF::SWCFGNode>.
2506 @@Param:
2507 @@@Name: refClass
2508 @@@Type: SWCFGString
2509 @@@enDesc:
2510 The name of a <IF::mn|NodeRef||ManakaiDOM|Perl> class.
2511 @@Return:
2512 @@@Type: NodeStem
2513 @@@Description:
2514 @@@@lang:en
2515 @@@@@:
2516 The newly created node object.
2517 @@@PerlDef:
2518 @@@@@:
2519 my $node =
2520 $r = <ClassM::ManakaiNode|ManakaiNodeStem||ManakaiDOM|Perl.new>
2521 ($refClass);
2522 $node->{<H::swcfg21:childNodes>} = [];
2523 @@@@ImplNote:
2524 @@@@@lang:en
2525 @@@@@@:
2526 Required property: <Q::swcfg21:nodeType>, <Q::ownerDocument>.
2527 \
2528 Optional properties: <Q::swcfg21:value>, <Q::swcfg21:parent>,
2529 <Q::swcfg21:childNodes>, <Q::flag>, <Q::option>.
2530
2531 @mn:origin0: swcfg21|parent
2532 @mn:subnode1: swcfg21|childNodes
2533 @mn:irefnode0: swcfg21|ownerDocument
2534 @mn:anydata1: swcfg21|flag
2535 @mn:anydata1: swcfg21|option
2536
2537 @Attr:
2538 @@Name: nodeID
2539 @@Description:
2540 @@@lang:en
2541 @@@@:
2542 A unique identifier of this node.
2543 \
2544 {NOTE:: Node IDs are a globally unique opaque string. Note that
2545 two nodes separetely parsed and constructed from the
2546 same document would have different node IDs.
2547 \
2548 }
2549 @@NewIn21:
2550 @@Get:
2551 @@@Type: SWCFGString
2552 @@@PerlDef:
2553 $r = $self->{<H::mn:node>}->{<H::mn:nodeID>};
2554
2555 @Attr:
2556 @@Name: nodeIDRef
2557 @@enDesc:
2558 A reference to the node identifier.
2559 @@NewIn21:
2560 @@Get:
2561 @@@Type: DISPerl|SCALAR||ManakaiDOM|all
2562 @@@PerlDef:
2563 $r = \($self->{<H::mn:node>}->{<H::mn:nodeID>});
2564 ##SWCFGNode
2565
2566 ElementTypeBinding:
2567 @Name: XParamDef
2568 @ElementType:
2569 dis:ResourceDef
2570 @ShadowContent:
2571 @@rdf:type: ecore|Parameter
2572 @@For:
2573 =ManakaiDOM:all
2574
2575 PropDef:
2576 @QName: fileName
2577 @Description:
2578 @@lang:en
2579 @@@:
2580 The name of the source file.
2581
2582 ElementTypeBinding:
2583 @Name: UndeclaredPrefixException
2584 @ElementType:
2585 ManakaiDOM:raises
2586 @ShadowContent:
2587 @@@:
2588 DIS:UNDECLARED_NS_PREFIX_ERR
2589 @@Description:
2590 @@@lang:en
2591 @@@@:
2592 The implementation has encounted an undeclared namespace prefix.
2593
2594 IFClsDef:
2595 @IFQName: SWCFGComment
2596 @ClsQName: ManakaiSWCFGComment
2597
2598 @ClsISA: ManakaiSWCFGNode
2599
2600 @Description:
2601 @@lang:en
2602 @@@:
2603 A comment node.
2604 \
2605 {NOTE:: A comment node have a value. A comment node has no child node.
2606 The <CODE::#?SuikaWikiConfig/2.1> magic line is not a comment.
2607 The parent node of a comment node, if any, is always
2608 the document node in SuikaWikiConfig versions 2.0 and 2.1.
2609 \
2610 }
2611
2612 @RedefAttr:
2613 @@Name:nodeType
2614 @@Type:SWCFGString
2615 @@Description:
2616 @@@lang:en
2617 @@@@:
2618 The type of the node.
2619 @@Get:
2620 @@@disDef:
2621 @@@@ConstValue:\#comment
2622 @@@InCase:
2623 @@@@Value:\#comment
2624 @@@@Type:SWCFGString
2625 @@@@Description:
2626 @@@@@lang:en
2627 @@@@@@:This node is a comment node.
2628
2629 @IntMethod:
2630 @@ForCheck: ManakaiDOM|ForClass
2631 @@Name:newObject
2632 @@ManakaiDOM:isStatic:1
2633 @@Description:
2634 @@@lang:en
2635 @@@@:
2636 Creates a new instance object for <IF::SWCFGComment>.
2637 @@Return:
2638 @@@Type: NodeStem
2639 @@@Description:
2640 @@@@lang:en
2641 @@@@@:
2642 The newly created node object.
2643 @@@PerlDef:
2644 @@@@@:
2645 $r = <ClassM::ManakaiSWCFGNode.newObject> ($self);
2646 $r->{<H::swcfg21:nodeType>} = '#comment';
2647 $r->{<H::swcfg21:value>} = '';
2648 $r->{<H::swcfg21:namespaceExpanded>} = true; ## Always t r u e
2649 $r->{<H::swcfg21:etExpanded>} = true; ## Always t r u e
2650 @@@@ImplNote:
2651 @@@@@lang:en
2652 @@@@@@:
2653 Required property: <Q::ownerDocument>, <Q::swcfg21:nodeType>.
2654 \
2655 Optional properties: <Q::swcfg21:value>, <Q::swcfg21:parent>,
2656 <Q::swcfg21:childNodes>, <Q::flag>, <Q::option>.
2657 ##SWCFGComment
2658
2659 IFClsDef:
2660 @IFQName: SWCFGElement
2661 @ClsQName: ManakaiSWCFGElement
2662
2663 @ClsISA: ManakaiSWCFGNode
2664
2665 @Description:
2666 @@lang:en
2667 @@@:
2668 An element node.
2669 \
2670 {NOTE:: An element node have a value. An element node can have
2671 child elements if the value is a simple string (if any).
2672 Future version of SuikaWikiConfig might allow a comment child.
2673 \
2674 }
2675
2676 @Attr:
2677 @@Name:expandedURI
2678 @@Type:SWCFGString
2679 @@Description:
2680 @@@lang:en
2681 @@@@:
2682 The expanded URI of the node.
2683 @@NewIn21:
2684 @@Get:
2685 @@@UndeclaredPrefixException:
2686 @@@PerlDef:
2687 __CODE{expandNamespace}__;
2688 if (defined $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>}) {
2689 if ($self->{<H::mn:node>}
2690 ->{<H::swcfg21:namespaceURI>} eq <Q::swcfg21:RealName>) {
2691 $r = $self->{<H::mn:node>}->{<H::swcfg21:shadowNamespaceURI>} .
2692 $self->{<H::mn:node>}->{<H::swcfg21:shadowLocalName>};
2693 } else {
2694 $r = $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} .
2695 $self->{<H::mn:node>}->{<H::swcfg21:localName>};
2696 }
2697 } else {
2698 $r = $self->{<H::mn:node>}->{<H::swcfg21:localName>};
2699 }
2700
2701 @Attr:
2702 @@Name:prefix
2703 @@Description:
2704 @@@lang:en
2705 @@@@:
2706 The namespace prefix of this node.
2707 @@NewIn21:
2708 @@Get:
2709 @@@Type:SWCFGString
2710 @@@Description:
2711 @@@@lang:en
2712 @@@@@:The namespace prefix.
2713 @@@InCase:
2714 @@@@Value:
2715 @@@@@is-null:1
2716 @@@@Type:SWCFGString
2717 @@@@Description:
2718 @@@@@lang:en
2719 @@@@@@:
2720 Either this node is not an element node or its namespace
2721 is the default and no prefix is required.
2722 @@@UndeclaredPrefixException:
2723 @@@PerlDef:
2724 __CODE{expandNamespace}__;
2725 my $node = $self->{<H::mn:node>};
2726 my $od = $self-><AG::SWCFGNode.ownerDocument>;
2727 my $defURI = $od-><AG::SWCFGDocument.defaultElementTypeNamespaceURI>;
2728 if (defined $node->{<H::swcfg21:namespaceURI>}) {
2729 if (not defined $defURI or
2730 $node->{<H::swcfg21:namespaceURI>} ne $defURI or
2731 $node->{<H::swcfg21:localName>} eq 'Namespace' or
2732 $node->{<H::swcfg21:localName>} eq 'ElementTypeBinding' or
2733 $node->{<H::swcfg21:localName>} =~ /:/) {
2734 $r = $self-><M::SWCFGNode.lookupNamespacePrefix>
2735 ($node->{<H::swcfg21:namespaceURI>},
2736 make_new_binding => 1);
2737 } else {
2738 $r = null;
2739 }
2740 } else { ## Null namespace
2741 if (defined $defURI or $node->{<H::swcfg21:localName>} =~ /:/ or
2742 $node->{<H::swcfg21:localName>} eq 'Namespace' or
2743 $node->{<H::swcfg21:localName>} eq 'ElementTypeBinding') {
2744 $r = $self-><M::SWCFGNode.lookupNamespacePrefix>
2745 ($node->{<H::swcfg21:namespaceURI>},
2746 make_new_binding => 1);
2747 } else {
2748 $r = null;
2749 }
2750 }
2751
2752 @Attr:
2753 @@Name: qualifiedName
2754 @@Type: SWCFGString
2755 @@Description:
2756 @@@lang:en
2757 @@@@:
2758 The qualified name of the element type, i.e. the local name
2759 with or with out the namespace prefix followed by a <CHAR::COLON>.
2760 @@NewIn21:
2761 @@Get:
2762 @@@UndeclaredPrefixException:
2763 @@@PerlDef:
2764 __CODE{expandNamespace}__;
2765 my $node = $self->{<H::mn:node>};
2766 my $od = $self-><AG::SWCFGNode.ownerDocument>;
2767 my $defURI = $od-><AG::SWCFGDocument.defaultElementTypeNamespaceURI>;
2768 if (defined $node->{<H::swcfg21:namespaceURI>}) {
2769 my $nsURI = ($node->{<H::swcfg21:namespaceURI>} eq <Q::swcfg21:RealName>
2770 ? $node->{<H::swcfg21:shadowNamespaceURI>}
2771 : $node->{<H::swcfg21:namespaceURI>});
2772 my $ln = ($node->{<H::swcfg21:namespaceURI>} eq <Q::swcfg21:RealName>
2773 ? $node->{<H::swcfg21:shadowLocalName>}
2774 : $node->{<H::swcfg21:localName>});
2775 if (not defined $defURI or
2776 $nsURI ne $defURI or
2777 $ln eq 'Namespace' or
2778 $ln eq 'ElementTypeBinding' or
2779 $ln =~ /:/) {
2780 $r = $self-><M::SWCFGNode.lookupNamespacePrefix>
2781 ($node->{<H::swcfg21:namespaceURI>},
2782 make_new_binding => 1) .
2783 ':' . $ln;
2784 } else {
2785 $r = $ln;
2786 }
2787 } else { ## Null namespace
2788 if (defined $defURI or $node->{<H::swcfg21:localName>} =~ /:/ or
2789 $node->{<H::swcfg21:localName>} eq 'Namespace' or
2790 $node->{<H::swcfg21:localName>} eq 'ElementTypeBinding') {
2791 $r = $self-><M::SWCFGNode.lookupNamespacePrefix>
2792 ($node->{<H::swcfg21:namespaceURI>},
2793 make_new_binding => 1) .
2794 ':' . $node->{<H::swcfg21:localName>};
2795 } else {
2796 $r = $node->{<H::swcfg21:localName>};
2797 }
2798 }
2799
2800 @Attr:
2801 @@Name: realQualifiedName
2802 @@Type: SWCFGString
2803 @@Description:
2804 @@@lang:en
2805 @@@@:
2806 The qualified name of the element type, i.e. the local name
2807 with or with out the namespace prefix followed by a <CHAR::COLON>.
2808 @@NewIn21:
2809 @@Get:
2810 @@@UndeclaredPrefixException:
2811 @@@PerlDef:
2812 __CODE{expandNamespace}__;
2813 my $node = $self->{<H::mn:node>};
2814 my $od = $self-><AG::SWCFGNode.ownerDocument>;
2815 my $defURI = $od-><AG::SWCFGDocument.defaultElementTypeNamespaceURI>;
2816 if (defined $node->{<H::swcfg21:namespaceURI>}) {
2817 if ($node->{<H::swcfg21:namespaceURI>} eq <Q::swcfg21:RealName>) {
2818 $r = $node->{<H::swcfg21:localName>};
2819 } elsif (not defined $defURI or
2820 $node->{<H::swcfg21:namespaceURI>} ne $defURI or
2821 $node->{<H::swcfg21:localName>} eq 'Namespace' or
2822 $node->{<H::swcfg21:localName>} eq 'ElementTypeBinding' or
2823 $node->{<H::swcfg21:localName>} =~ /:/) {
2824 $r = $self-><M::SWCFGNode.lookupNamespacePrefix>
2825 ($node->{<H::swcfg21:namespaceURI>},
2826 make_new_binding => 1) .
2827 ':' . $node->{<H::swcfg21:localName>};
2828 } else {
2829 $r = $node->{<H::swcfg21:localName>};
2830 }
2831 } else { ## Null namespace
2832 if (defined $defURI or $node->{<H::swcfg21:localName>} =~ /:/ or
2833 $node->{<H::swcfg21:localName>} eq 'Namespace' or
2834 $node->{<H::swcfg21:localName>} eq 'ElementTypeBinding') {
2835 $r = $self-><M::SWCFGNode.lookupNamespacePrefix>
2836 ($node->{<H::swcfg21:namespaceURI>},
2837 make_new_binding => 1) .
2838 ':' . $node->{<H::swcfg21:localName>};
2839 } else {
2840 $r = $node->{<H::swcfg21:localName>};
2841 }
2842 }
2843
2844 @RedefAttr:
2845 @@Name:nodeType
2846 @@Type:SWCFGString
2847 @@Description:
2848 @@@lang:en
2849 @@@@:
2850 The type of the node.
2851 @@Get:
2852 @@@disDef:
2853 @@@@ConstValue:\#element
2854 @@@InCase:
2855 @@@@Value:\#element
2856 @@@@Type:SWCFGString
2857 @@@@Description:
2858 @@@@@lang:en
2859 @@@@@@:This node is an element node.
2860
2861 @RedefAttr:
2862 @@Name:localName
2863 @@Description:
2864 @@@lang:en
2865 @@@@:
2866 The local name of the node.
2867 @@Type:SWCFGString
2868 @@ModIn21:
2869 @@Get:
2870 @@@Type:SWCFGString
2871 @@@Description:
2872 @@@@lang:en
2873 @@@@@:
2874 The local name of the node.
2875 @@@InCase:
2876 @@@@Value:
2877 @@@@@is-null:1
2878 @@@@Type:SWCFGString
2879 @@@@Description:
2880 @@@@@lang:en
2881 @@@@@@:
2882 The node does not have the local name.
2883 No node of type other than <CODE::#element> has the local name.
2884 @@@UndeclaredPrefixException:
2885 @@@PerlDef:
2886 __CODE{expandNamespace}__;
2887 $r = (defined $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} and
2888 $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} eq <Q::swcfg21:RealName>)
2889 ? $self->{<H::mn:node>}->{<H::swcfg21:shadowLocalName>}
2890 : $self->{<H::mn:node>}->{<H::swcfg21:localName>};
2891 @@Set:
2892 @@@Description:
2893 @@@@lang:en
2894 @@@@@:
2895 Sets the local name. Setting the local name to the node
2896 whose type is other than <CODE::#element> has no effect.
2897 @@@UndeclaredPrefixException:
2898 @@@PerlDef:
2899 __CODE{expandNamespace}__;
2900 if (defined $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} and
2901 $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} eq <Q::swcfg21:RealName>) {
2902 $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>}
2903 = $self->{<H::mn:node>}->{<H::swcfg21:shadowNamespaceURI>};
2904 }
2905 $self->{<H::mn:node>}->{<H::swcfg21:localName>} = $given;
2906
2907 @Attr:
2908 @@Name:realLocalName
2909 @@Description:
2910 @@@lang:en
2911 @@@@:
2912 The real local name of the node.
2913 @@Type:SWCFGString
2914 @@NewIn21:
2915 @@Get:
2916 @@@Type:SWCFGString
2917 @@@Description:
2918 @@@@lang:en
2919 @@@@@:
2920 The local name of the node. If an element type binding
2921 has bound to this element, then actual element type name.
2922 @@@UndeclaredPrefixException:
2923 @@@PerlDef:
2924 __CODE{expandNamespace}__;
2925 $r = $self->{<H::mn:node>}->{<H::swcfg21:localName>};
2926 @@Set:
2927 @@@Description:
2928 @@@@lang:en
2929 @@@@@:
2930 Sets the local name. Setting the local name to the node
2931 whose type is other than <CODE::#element> has no effect.
2932 Changes for element type name does not take effect
2933 until <M::SWCFGDocument.updateElementTypeBinding> method is called.
2934 @@@UndeclaredPrefixException:
2935 @@@PerlDef:
2936 __CODE{expandNamespace}__;
2937 $self->{<H::mn:node>}->{<H::swcfg21:localName>} = $given;
2938
2939 @RedefAttr:
2940 @@Name:namespaceURI
2941 @@Description:
2942 @@@lang:en
2943 @@@@:
2944 The namespace URI of the node.
2945 @@NewIn21:
2946 @@Type:SWCFGString
2947 @@Get:
2948 @@@Type:SWCFGString
2949 @@@Description:
2950 @@@@lang:en
2951 @@@@@:
2952 The namespace URI of the node.
2953 @@@InCase:
2954 @@@@Value:
2955 @@@@@is-null:1
2956 @@@@Type:SWCFGString
2957 @@@@Description:
2958 @@@@@lang:en
2959 @@@@@@:
2960 The node does not have the namespace URI.
2961 @@@UndeclaredPrefixException:
2962 @@@PerlDef:
2963 __CODE{expandNamespace}__;
2964 $r = (defined $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} and
2965 $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} eq <Q::swcfg21:RealName>)
2966 ? $self->{<H::mn:node>}->{<H::swcfg21:shadowNamespaceURI>}
2967 : $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>};
2968 @@Set:
2969 @@@Type:SWCFGString
2970 @@@Description:
2971 @@@@lang:en
2972 @@@@@:
2973 Sets the namespace URI.
2974 @@@InCase:
2975 @@@@Value:
2976 @@@@@is-null:1
2977 @@@@Type:SWCFGString
2978 @@@@Description:
2979 @@@@@lang:en
2980 @@@@@@:
2981 Sets the node not to have its namespace URI (or sets
2982 the namespace as the <QUOTE::<DOM::null> namespace>.
2983 @@@InCase:
2984 @@@@Value:
2985 @@@@@ContentType: DISCore|QName
2986 @@@@@@:
2987 swcfg21:RealName
2988 @@@@Description:
2989 @@@@@lang:en
2990 @@@@@@:
2991 The namespace URI (both <EM::real> or <EM::shadow>)
2992 has left unchanged.
2993 @@@UndeclaredPrefixException:
2994 @@@PerlDef:
2995 unless (defined $given and $given eq <Q::swcfg21:RealName>) {
2996 __CODE{expandNamespace}__;
2997 if (defined $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} and
2998 $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} eq <Q::swcfg21:RealName>) {
2999 $self->{<H::mn:node>}->{<H::swcfg21:localName>}
3000 = $self->{<H::mn:node>}->{<H::swcfg21:localName>};
3001 }
3002 $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} = $given;
3003 }
3004
3005 @Attr:
3006 @@Name:realNamespaceURI
3007 @@Description:
3008 @@@lang:en
3009 @@@@:
3010 The namespace URI of the node.
3011 @@NewIn21:
3012 @@Type:SWCFGString
3013 @@Get:
3014 @@@Type:SWCFGString
3015 @@@Description:
3016 @@@@lang:en
3017 @@@@@:
3018 The namespace URI of the node.
3019 @@@InCase:
3020 @@@@Value:
3021 @@@@@is-null:1
3022 @@@@Type:SWCFGString
3023 @@@@Description:
3024 @@@@@lang:en
3025 @@@@@@:
3026 The node does not have the namespace URI.
3027 @@@InCase:
3028 @@@@Value:
3029 @@@@@ContentType: DISCore|QName
3030 @@@@@@:
3031 swcfg21:RealName
3032 @@@@Description:
3033 @@@@@lang:en
3034 @@@@@@:
3035 Any element type binding has been bound to this element;
3036 the local name of this node is the <EM::real> qualified name.
3037 @@@UndeclaredPrefixException:
3038 @@@PerlDef:
3039 __CODE{expandNamespace}__;
3040 $r = $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>};
3041 @@Set:
3042 @@@Type:SWCFGString
3043 @@@Description:
3044 @@@@lang:en
3045 @@@@@:
3046 Sets the namespace URI.
3047 @@@InCase:
3048 @@@@Value:
3049 @@@@@is-null:1
3050 @@@@Type:SWCFGString
3051 @@@@Description:
3052 @@@@@lang:en
3053 @@@@@@:
3054 Sets the node not to have its namespace URI (or sets
3055 the namespace as the <QUOTE::<DOM::null> namespace>.
3056 @@@InCase:
3057 @@@@Value:
3058 @@@@@ContentType: DISCore|QName
3059 @@@@@@:
3060 swcfg21:RealName
3061 @@@@Description:
3062 @@@@@lang:en
3063 @@@@@@:
3064 The namespace URI (both <EM::real> or <EM::shadow>)
3065 has left unchanged.
3066 @@@UndeclaredPrefixException:
3067 @@@PerlDef:
3068 unless (defined $given and $given eq <Q::swcfg21:RealName>) {
3069 __CODE{expandNamespace}__;
3070 $self->{<H::mn:node>}->{<H::swcfg21:namespaceURI>} = $given;
3071 }
3072
3073 @IntMethod:
3074 @@ForCheck: ManakaiDOM|ForClass
3075 @@Name:newObject
3076 @@ManakaiDOM:isStatic:1
3077 @@Description:
3078 @@@lang:en
3079 @@@@:
3080 Creates a new instance object for <IF::SWCFGElement>.
3081 @@Return:
3082 @@@Type: NodeStem
3083 @@@Description:
3084 @@@@lang:en
3085 @@@@@:
3086 The newly created node object.
3087 @@@PerlDef:
3088 @@@@@:
3089 $r = <ClassM::ManakaiSWCFGNode.newObject> ($self);
3090 $r->{<H::swcfg21:nodeType>} = '#element';
3091 @@@@ImplNote:
3092 @@@@@lang:en
3093 @@@@@@:
3094 Required property: <Q::ownerDocument>, <H::swcfg21:nodeType>,
3095 <H::swcfg21:localName>.
3096 \
3097 Optional properties: <H::swcfg21:value>, <H::swcfg21:parent>,
3098 <H::swcfg21:childNodes>, <Q::flag>, <Q::option>,
3099 <Q::namespaceURI>, <H::swcfg21:namespaceExpanded>,
3100 <H::swcfg21:shadowContent>, <H::swcfg21:shadowSibling>,
3101 <H::swcfg21:etExpanded>.
3102
3103 @mn:subnode0: swcfg21|shadowContent
3104 @mn:subnode0: swcfg21|shadowSibling
3105
3106 @ResourceDef:
3107 @@QName: expandETBinding
3108 @@rdf:type: DISPerl|BlockCode
3109 @@Description:
3110 @@@lang:en
3111 @@@@:
3112 Expands element type bindings.
3113 @@ForCheck: ManakaiDOM|ForClass
3114 @@UndeclaredPrefixException:
3115 @@PerlDef:
3116 unless ($node->{<H::swcfg21:etExpanded>}) {
3117 __DEEP{
3118 my $__qn;
3119 if ($node->{<H::swcfg21:namespaceExpanded>}) {
3120 $__qn = $self-><M::ManakaiSWCFGNode.getNodeReference> ($node)
3121 -><AG::SWCFGElement.realQualifiedName>;
3122 } else {
3123 $__qn = $node->{<H::swcfg21:localName>};
3124
3125 }
3126 my $__od = $node->{<H::swcfg21:ownerDocument>};
3127 if ($__od->{<H::swcfg21:etBinding>}->{$__qn}) {
3128 my $b = $__od->{<H::swcfg21:etBinding>}->{$__qn};
3129 $node->{<H::swcfg21:namespaceURI>} = <Q::swcfg21:RealName>;
3130 if ($node->{<H::swcfg21:namespaceExpanded>}) {
3131 $node->{<H::swcfg21:localName>} = $__qn;
3132 } else {
3133 $node->{<H::swcfg21:namespaceExpanded>} = true;
3134 }
3135 unless ($b->{namespaceExpanded}) {
3136 if ($b->{shadowLocalName} =~ s/^([^:]*)://) {
3137 my $__prefix = $1;
3138 $b->{shadowNamespaceURI}
3139 = $self-><M::ManakaiSWCFGNode.getNodeReference> ($__od)
3140 -><M::SWCFGNode.lookupNamespaceURI>
3141 ($__prefix, make_new_binding => false,
3142 raise_prefix_exception => true);
3143 }
3144 $b->{namespaceExpanded} = true;
3145 }
3146 $node->{<H::swcfg21:shadowNamespaceURI>} = $b->{shadowNamespaceURI};
3147 $node->{<H::swcfg21:shadowLocalName>} = $b->{shadowLocalName};
3148 for my $__p (qw/shadowContent shadowSibling/) {
3149 next unless $b->{$__p};
3150 my $cl = $self-><M::ManakaiSWCFGNode.getNodeReference> ($b->{$__p})
3151 ->clone;
3152 my $__n = $node->{{shadowContent => <H::swcfg21:shadowContent>,
3153 shadowSibling => <H::swcfg21:shadowSibling>}->{$__p}}
3154 = $cl->{<H::mn:node>};
3155 $node-><M::NodeStem.importTree> ($__n);
3156 $__n->{{shadowContent => <H::swcfg21:shadowParent>,
3157 shadowSibling => <H::swcfg21:shadowSiblingOf>}->{$__p}} = $node;
3158 }
3159 }
3160 $node->{<H::swcfg21:etExpanded>} = true;
3161 }__;
3162 }
3163
3164 @ResourceDef:
3165 @@QName: expandNamespace
3166 @@rdf:type: DISPerl|BlockCode
3167 @@ForCheck: ManakaiDOM|ForClass
3168 @@Description:
3169 @@@lang:en
3170 @@@@:
3171 Expands qualified name into namespace URI and local name.
3172 @@UndeclaredPrefixException:
3173 @@PerlDef:
3174 my $__node = $self->{<H::mn:node>};
3175 __CODE{expandETBinding:: $node => $__node}__;
3176 unless ($__node->{<H::swcfg21:namespaceExpanded>}) {
3177 if ($__node->{<H::swcfg21:localName>} =~ s/^([^:]*)://) {
3178 my $__prefix = $1;
3179 __DEEP{
3180 $__node->{<H::swcfg21:namespaceURI>}
3181 = $self-><M::SWCFGNode.lookupNamespaceURI>
3182 ($__prefix, make_new_binding => false,
3183 raise_prefix_exception => true);
3184 }__;
3185 } else {
3186 $__node->{<H::swcfg21:namespaceURI>}
3187 = $__node->{<H::swcfg21:ownerDocument>}
3188 ->{<H::swcfg21:defaultETNamespaceURI>};
3189 }
3190 $__node->{<H::swcfg21:namespaceExpanded>} = true;
3191 }
3192 ##SWCFGElement
3193
3194 IFClsDef:
3195 @IFQName: SWCFGDocument
3196 @ClsQName: ManakaiSWCFGDocument
3197
3198 @ClsISA: ManakaiSWCFGNode
3199
3200 @Description:
3201 @@lang:en
3202 @@@:
3203 A document node.
3204 \
3205 {NOTE:: A document node does not have any value. A document node can have
3206 child nodes whose type is either element or comment.
3207 A document node has no parent.
3208 \
3209 }
3210
3211 @Method:
3212 @@Name:createElementNS
3213 @@Description:
3214 @@@lang:en
3215 @@@@:
3216 Creates a new element.
3217 \
3218 {NOTE:: No element type binding expansion will occur
3219 at the time of creation.
3220 \
3221 }
3222 @@NewIn21:
3223 @@Param:
3224 @@@Name:namespaceURI
3225 @@@Type:SWCFGString
3226 @@@Description:
3227 @@@@lang:en
3228 @@@@@:
3229 The namespace URI of the element to create.
3230 @@@InCase:
3231 @@@@Value:
3232 @@@@@is-null:1
3233 @@@@Type:SWCFGString
3234 @@@@Description:
3235 @@@@@lang:en
3236 @@@@@@: The new element has no namespace.
3237 @@Param:
3238 @@@Name:localName
3239 @@@Type:SWCFGString
3240 @@@Description:
3241 @@@@lang:en
3242 @@@@@:
3243 The local name of the element to create.
3244 @@Return:
3245 @@@Type:SWCFGElement
3246 @@@Description:
3247 @@@@lang:en
3248 @@@@@:
3249 The newly created element.
3250 @@@PerlDef:
3251 $r = <ClassM::ManakaiSWCFGElement.newObject>;
3252 __CODE{mn|setXRefNode||ManakaiDOM|Perl::
3253 $referrer => {$r},
3254 $propName => {<H::swcfg21:ownerDocument>},
3255 $referent => {$self->{<H::mn:node>}},
3256 }__;
3257 $r->{<H::swcfg21:namespaceURI>} = $namespaceURI;
3258 $r->{<H::swcfg21:localName>} = $localName;
3259 $r->{<H::swcfg21:namespaceExpanded>} = true;
3260 $r->{<H::swcfg21:etExpanded>} = true;
3261 $r = $self-><M::ManakaiSWCFGNode.getNodeReference> ($r);
3262
3263 @Method:
3264 @@Name:createComment
3265 @@Description:
3266 @@@lang:en
3267 @@@@:
3268 Creates a new comment node.
3269 @@NewIn21:
3270 @@Param:
3271 @@@Name:data
3272 @@@Type:SWCFGString
3273 @@@Description:
3274 @@@@lang:en
3275 @@@@@:
3276 The initial content of the comment.
3277 @@@InCase:
3278 @@@@Value:
3279 @@@@@is-null:1
3280 @@@@Type:SWCFGString
3281 @@@@Description:
3282 @@@@@lang:en
3283 @@@@@@:
3284 The new comment node has the empty value.
3285 @@Return:
3286 @@@Type:SWCFGComment
3287 @@@Description:
3288 @@@@lang:en
3289 @@@@@:
3290 The newly created comment.
3291 @@@PerlDef:
3292 $r = <ClassM::ManakaiSWCFGComment.newObject>;
3293 __CODE{mn|setXRefNode||ManakaiDOM|Perl::
3294 $referrer => {$r},
3295 $propName => {<H::swcfg21:ownerDocument>},
3296 $referent => {$self->{<H::mn:node>}},
3297 }__;
3298 $r->{<H::swcfg21:value>} = defined $data ? $data : '';
3299 $r = $self-><M::ManakaiSWCFGNode.getNodeReference> ($r);
3300
3301 @Method:
3302 @@Name:createDocumentFragment
3303 @@Description:
3304 @@@lang:en
3305 @@@@:
3306 Creates a new document fragment node.
3307 @@NewIn21:
3308 @@Return:
3309 @@@Type:SWCFGDocumentFragment
3310 @@@Description:
3311 @@@@lang:en
3312 @@@@@:
3313 The newly created document fragment node.
3314 @@@PerlDef:
3315 $r = <ClassM::ManakaiSWCFGDocumentFragment.newObject>;
3316 __CODE{mn|setXRefNode||ManakaiDOM|Perl::
3317 $referrer => {$r},
3318 $propName => {<H::swcfg21:ownerDocument>},
3319 $referent => {$self->{<H::mn:node>}},
3320 }__;
3321 $r = $self-><M::ManakaiSWCFGNode.getNodeReference> ($r);
3322
3323 @Attr:
3324 @@Name: defaultElementTypeNamespaceURI
3325 @@Description:
3326 @@@lang:en
3327 @@@@:
3328 The default namespace URI for element type names.
3329 @@NewIn21:
3330 @@Type:SWCFGString
3331 @@Get:
3332 @@@PerlDef:
3333 $r = $self->{<H::mn|node>}->{<H::swcfg21|defaultETNamespaceURI>};
3334 @@Set:
3335 @@@PerlDef:
3336 $self->{<H::mn|node>}->{<H::swcfg21|defaultETNamespaceURI>} = $given;
3337
3338 @Attr:
3339 @@Name: implementation
3340 @@Description:
3341 @@@lang:en
3342 @@@@:
3343 The SuikaWikiConfig implementation to which this document
3344 belongs.
3345 @@NewIn21:
3346 @@Type: SWCFGImplementation
3347 @@Get:
3348 @@@PerlDef:
3349 $r = $self->{<H::mn|node>}->{<H::f|implementation>};
3350
3351 @RedefAttr:
3352 @@Name:nodeType
3353 @@Type:SWCFGString
3354 @@Description:
3355 @@@lang:en
3356 @@@@:
3357 The type of the node.
3358 @@Get:
3359 @@@disDef:
3360 @@@@ConstValue:\#document
3361 @@@Type:SWCFGString
3362 @@@InCase:
3363 @@@@Value:\#document
3364 @@@@Type:SWCFGString
3365 @@@@Description:
3366 @@@@@lang:en
3367 @@@@@@:This node is a document node.
3368
3369 @RedefMethod:
3370 @@Name:innerText
3371 @@Description:
3372 @@@lang:en
3373 @@@@:
3374 Returns the text value of this node.
3375 @@NamedParam:
3376 @@@Name:newValue
3377 @@@Type: any
3378 @@@Description:
3379 @@@@lang:en
3380 @@@@@:
3381 An attempt to set a value to document node has no effect.
3382 @@Return:
3383 @@@Type:SWCFGString
3384 @@@Description:
3385 @@@@lang:en
3386 @@@@@:
3387 The value of this node.
3388 @@@InCase:
3389 @@@@Value:
3390 @@@@@is-null:1
3391 @@@@Type:SWCFGString
3392 @@@@Description:
3393 @@@@@lang:en
3394 @@@@@@:
3395 The node has no value.
3396 @@@disDef:
3397 @@@@DISLang:nop:
3398
3399 @Method:
3400 @@Name:actualInnerText
3401 @@Description:
3402 @@@lang:en
3403 @@@@:
3404 Returns the text value of this node.
3405 @@NewIn21:
3406 @@NamedParam:
3407 @@@Name:newValue
3408 @@@Type: any
3409 @@@Description:
3410 @@@@lang:en
3411 @@@@@:
3412 An attempt to set a value to document node has no effect.
3413 @@Return:
3414 @@@Type:SWCFGString
3415 @@@Description:
3416 @@@@lang:en
3417 @@@@@:
3418 The value of this node.
3419 @@@InCase:
3420 @@@@Value:
3421 @@@@@is-null:1
3422 @@@@Type:SWCFGString
3423 @@@@Description:
3424 @@@@@lang:en
3425 @@@@@@:
3426 The node has no value.
3427 @@@disDef:
3428 @@@@DISLang:nop:
3429
3430 @IntMethod:
3431 @@ForCheck: ManakaiDOM|ForClass
3432 @@Name:newObject
3433 @@ManakaiDOM:isStatic:1
3434 @@Description:
3435 @@@lang:en
3436 @@@@:
3437 Creates a new instance object for <IF::SWCFGDocument>.
3438 @@Return:
3439 @@@Type: NodeStem
3440 @@@Description:
3441 @@@@lang:en
3442 @@@@@:
3443 The newly created node object.
3444 @@@PerlDef:
3445 @@@@@:
3446 $r = <ClassM::ManakaiSWCFGNode.newObject> ($self);
3447 $r->{<H::swcfg21:nodeType>} = '#document';
3448 $r->{<H::swcfg21:nsBinding>} = {URI => ''};
3449 $r->{<H::swcfg21:etBinding>} = {};
3450 $r->{<H::swcfg21:namespaceExpanded>} = true; ## Always t r u e
3451 $r->{<H::swcfg21:etExpanded>} = true; ## Always t r u e
3452 @@@@ImplNote:
3453 @@@@@lang:en
3454 @@@@@@:
3455 Required property: <Q::ownerDocument>, <Q::swcfg21:nodeType>,
3456 <Q::f|implementation>, <Q::swcfg21:nsBinding>,
3457 <Q::etBinding>.
3458 \
3459 Optional properties: <Q::swcfg21:childNodes>, <Q::flag>, <Q::option>,
3460 <Q::defaultETNamespaceURI>.
3461
3462 @mn:subnode2: swcfg21|etBinding
3463 ##SWCFGDocument
3464
3465 IFClsDef:
3466 @IFQName: SWCFGDocumentFragment
3467 @ClsQName: ManakaiSWCFGDocumentFragment
3468
3469 @ClsISA: ManakaiSWCFGNode
3470
3471 @Description:
3472 @@lang:en
3473 @@@:
3474 A document fragment node.
3475 \
3476 {NOTE:: A document fragment node may have its value if
3477 and only if its <A::SWCFGDocumentFragment.isShadowMaster>
3478 is <DOM::true>.
3479 A document fragment node can have child elements.
3480 Future version of SuikaWikiConfig might allow a comment child.
3481 A document fragment node has no parent.
3482 \
3483 }
3484
3485 @Attr:
3486 @@Name: isShadowMaster
3487 @@Type: boolean
3488 @@Description:
3489 @@@lang:en
3490 @@@@:
3491 Whether this node is the root node for the shadow content
3492 or shadow sibling tree or not.
3493 @@NewIn21:
3494 @@Get:
3495 @@@PerlDef:
3496 $r = $self->{<H::mn|node>}->{<H::swcfg21|isShadowMaster>};
3497
3498 @RedefAttr:
3499 @@Name:nodeType
3500 @@Type:SWCFGString
3501 @@Description:
3502 @@@lang:en
3503 @@@@:
3504 The type of the node.
3505 @@Get:
3506 @@@disDef:
3507 @@@@ConstValue:\#fragment
3508 @@@InCase:
3509 @@@@Value:\#fragment
3510 @@@@Type:SWCFGString
3511 @@@@Description:
3512 @@@@@lang:en
3513 @@@@@@:This node is a document fragment node.
3514
3515 @IntMethod:
3516 @@ForCheck: ManakaiDOM|ForClass
3517 @@Name:newObject
3518 @@ManakaiDOM:isStatic:1
3519 @@Description:
3520 @@@lang:en
3521 @@@@:
3522 Creates a new instance object for <IF::SWCFGDocumentFragment>.
3523 @@Return:
3524 @@@Type: NodeStem
3525 @@@Description:
3526 @@@@lang:en
3527 @@@@@:
3528 The newly created node object.
3529 @@@PerlDef:
3530 @@@@@:
3531 $r = <ClassM::ManakaiSWCFGNode.newObject> ($self);
3532 $r->{<H::swcfg21:nodeType>} = '#fragment';
3533 $r->{<H::swcfg21:namespaceExpanded>} = true; ## Always t r u e
3534 $r->{<H::swcfg21:etExpanded>} = true; ## Always t r u e
3535 @@@@ImplNote:
3536 @@@@@lang:en
3537 @@@@@@:
3538 Required property: <Q::ownerDocument>, <Q::swcfg21:nodeType>.
3539 \
3540 Optional properties: <Q::swcfg21:parent>, <Q::swcfg21:value>,
3541 <Q::swcfg21:childNodes>, <Q::flag>, <Q::option>, <Q::swcfg21:shadowOwner>,
3542 <Q::swcfg21:shadowParent>, <Q::swcfg21:shadowSiblingOf>.
3543
3544 @mn:origin0: swcfg21|shadowOwner
3545 @mn:origin0: swcfg21|shadowParent
3546 @mn:origin0: swcfg21|shadowSiblingOf
3547 ##SWCFGDocumentFragment
3548
3549 PropDef:
3550 @QName: swcfg21|shadowParent
3551
3552 PropDef:
3553 @QName: swcfg21|shadowSiblingOf
3554
3555 PropDef:
3556 @QName: swcfg21|shadowLocalName
3557
3558 PropDef:
3559 @QName: swcfg21|shadowNamespaceURI
3560
3561 IFClsDef:
3562 @IFQName: SWCFGChildNodeList
3563 @ClsQName: ManakaiSWCFGChildNodeList
3564
3565 @ClsISA: ManakaiNode|ManakaiNodeRef||ManakaiDOM|Perl
3566 @AppISA:
3567 @@ForCheck: ManakaiDOM|ForClass
3568 @@ContentType:
3569 lang:Perl
3570 @@@:
3571 Tie::Array
3572
3573 @Description:
3574 @@lang:en
3575 @@@:
3576 A child node list of a node.
3577
3578 @Attr:
3579 @@Name:length
3580 @@Type: unsignedLong
3581 @@Operator:
3582 @@@@:FETCHSIZE
3583 @@@ContentType:
3584 lang:Perl
3585 @@Description:
3586 @@@lang:en
3587 @@@@:
3588 The number of child nodes, including those belong to shadow trees.
3589 @@Get:
3590 @@@UndeclaredPrefixException:
3591 @@@PerlDef:
3592 my $node = $self->{<H::mn:node>};
3593 $r = @{$node->{<H::swcfg21:childNodes>}};
3594 __CODE{expandETBinding:: $node => $node,
3595 $self => {$self->{nodeClass}}}__;
3596 if ($node->{<H::swcfg21:shadowContent>}) {
3597 $r += @{$node->{<H::swcfg21:shadowContent>}->{<H::swcfg21:childNodes>}};
3598 }
3599 for my $c (@{$node->{<H::swcfg21:childNodes>}}) {
3600 __CODE{expandETBinding:: $node => $c,
3601 $self => {$self->{nodeClass}}}__;
3602 $r += @{$c->{<H::swcfg21:shadowSibling>}->{<H::swcfg21:childNodes>}}
3603 if $c->{<H::swcfg21:shadowSibling>};
3604 }
3605
3606 @Method:
3607 @@Name:item
3608 @@Description:
3609 @@@lang:en
3610 @@@@:
3611 Returns a child node.
3612 @@Operator:
3613 @@@@:FETCH
3614 @@@ContentType:
3615 lang:Perl
3616 @@NewIn21:
3617 @@Param:
3618 @@@Name:index
3619 @@@Type: idl|long||ManakaiDOM|all
3620 @@@Description:
3621 @@@@lang:en
3622 @@@@@:
3623 The ordinal index of the node to retrieve, counting from zero.
3624 A negative index identifies a node from the end of the list.
3625 @@Return:
3626 @@@Type:SWCFGNode
3627 @@@Description:
3628 @@@@lang:en
3629 @@@@@:
3630 The <P::index>th child node in the list.
3631 @@@InCase:
3632 @@@@Value:
3633 @@@@@is-null:1
3634 @@@@Type:SWCFGNode
3635 @@@@Description:
3636 @@@@@lang:en
3637 @@@@@@:
3638 There is no <P::index>th node in the list.
3639 @@@UndeclaredPrefixException:
3640 @@@PerlDef:
3641 if ($index < 0) {
3642 $index = $self-><AG::SWCFGChildNodeList.length> + $index;
3643 }
3644 my $node = $self->{<H::mn:node>};
3645 $r = $node->{<H::swcfg21:childNodes>}->[$index];
3646 unless ($r) {
3647 $index -= @{$node->{<H::swcfg21:childNodes>}};
3648 __CODE{expandETBinding:: $node => $node,
3649 $self => {$self->{nodeClass}}}__;
3650 $r = $node->{<H::swcfg21:shadowContent>}->{<H::swcfg21:childNodes>}->[$index]
3651 if $node->{<H::swcfg21:shadowContent>};
3652 unless ($r) {
3653 if ($node->{<H::swcfg21:shadowContent>}) {
3654 $index -= @{$node->{<H::swcfg21:shadowContent>}->{<H::swcfg21:childNodes>}};
3655 }
3656 for my $c (@{$node->{<H::swcfg21:childNodes>}}) {
3657 __CODE{expandETBinding:: $node => $c,
3658 $self => {$self->{nodeClass}}}__;
3659 if ($c->{<H::swcfg21:shadowSibling>}) {
3660 $r = $c->{<H::swcfg21:shadowSibling>}->{<H::swcfg21:childNodes>}->[$index];
3661 last if $r;
3662 $index -= @{$c->{<H::swcfg21:shadowSibling>}->{<H::swcfg21:childNodes>}};
3663 }
3664 }
3665 }
3666 }
3667 $r = $self->{nodeClass}
3668 -><M::ManakaiSWCFGNode.getNodeReference> ($r) if $r;
3669
3670 @IntMethod:
3671 @@ForCheck: ManakaiDOM|ForClass
3672 @@Operator:
3673 @@@@:TIEARRAY
3674 @@@ContentType:
3675 lang:Perl
3676 @@ManakaiDOM:isStatic:1
3677 @@Description:
3678 @@@lang:en
3679 @@@@:
3680 Binds a node list to an array. This method is intended to
3681 be called by Perl <Perl::tie> function.
3682 @@Param:
3683 @@@Name: nodeList
3684 @@@Type: SWCFGChildNodeList
3685 @@@Description:
3686 @@@@lang:en
3687 @@@@@:
3688 A node list that is tied with an array.
3689 @@Return:
3690 @@@Type: SWCFGChildNodeList
3691 @@@Description:
3692 @@@@lang:en
3693 @@@@@:
3694 The node list to which the array has bound,
3695 i.e. <P::nodeList>.
3696 @@@PerlDef:
3697 $r = $nodeList;
3698
3699 @IntMethod:
3700 @@ForCheck: ManakaiDOM|ForClass
3701 @@Operator:
3702 @@@@:@{}
3703 @@@ContentType:
3704 lang:Perl
3705 @@Description:
3706 @@@lang:en
3707 @@@@:
3708 Returns an array representation of this node list.
3709 \
3710 {NOTE:: It is intended that most operations through the
3711 array is as like ones in DOM Level 0 JavaScript
3712 implementations as possible.
3713 \
3714 }
3715 @@Return:
3716 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
3717 @@@PerlDef:
3718 tie my @list, ref $self, $self;
3719 $r = \@list;
3720
3721 @IntMethod:
3722 @@ForCheck: ManakaiDOM|ForClass
3723 @@Operator:
3724 @@@@:DESTROY
3725 @@@ContentType:
3726 lang:Perl
3727 @@Description:
3728 @@@lang:en
3729 @@@@:
3730 Redefines destructor for the class
3731 <Class::ManakaiNode|ManakaiNodeRef||ManakaiDOM|Perl>,
3732 since the <PerlModule::Tie::Array> also has its own empty destructor.
3733 @@Return:
3734 @@@Def:
3735 @@@@ContentType:
3736 lang:dis
3737 @@@@DISPerl:cloneCode:
3738 ManakaiNode|ManakaiNodeRef||ManakaiDOM|Perl.destroy
3739 ##SWCFGChildNodeList
3740
3741 PropDef:
3742 @QName:childNodes
3743 @Description:
3744 @@lang:en
3745 @@@:
3746 Child nodes of a node.
3747 @mn:stemName: swcn
3748
3749 PropDef:
3750 @QName:shadowContent
3751 @Description:
3752 @@lang:en
3753 @@@:
3754 Child nodes of a node, copied from the shadow master tree.
3755 @mn:stemName: shadow
3756
3757 PropDef:
3758 @QName:shadowSibling
3759 @Description:
3760 @@lang:en
3761 @@@:
3762 Younger sibling nodes of a node, copied from the shadow master tree.
3763 @mn:stemName: shadowsib
3764
3765 PropDef:
3766 @QName: shadowOwner
3767 @Description:
3768 @@lang:en
3769 @@@:
3770 The owner document of the master shadow tree. This property is
3771 redudant (always same, if any, as <Q::ownerDocument>)
3772 but need to maintain the origin-subnode relationship.
3773 @mn:stemName: shadowo
3774
3775 PropDef:
3776 @QName: ownerDocument
3777 @enDesc:
3778 The owner document node.
3779 @mn:stemName: swod
3780
3781 PropDef:
3782 @QName:value
3783 @Description:
3784 @@lang:en
3785 @@@:
3786 The value of a node. It is either a simple value, represented
3787 as a string, or a
3788 list value, represented as an array reference. If a node
3789 does not has a value, its value is <DOM::null>.
3790 @mn:stemName: swval
3791
3792 PropDef:
3793 @QName:namespaceURI
3794 @Type:SWCFGString
3795 @Description:
3796 @@lang:en
3797 @@@:
3798 The namespace URI of an element node.
3799 @InCase:
3800 @@Value:
3801 @@@is-null:1
3802 @@Type:SWCFGString
3803 @@Description:
3804 @@@lang:en
3805 @@@@:
3806 The node has no namespace (or has <QUOTE::<DOM::null> namespace>.
3807 @mn:stemName: swns
3808
3809 PropDef:
3810 @QName:localName
3811 @Description:
3812 @@lang:en
3813 @@@:
3814 The local name of an element node.
3815 @mn:stemName: swln
3816
3817 PropDef:
3818 @QName:namespaceExpanded
3819 @Description:
3820 @@lang:en
3821 @@@:
3822 Whether the namespace URI has expanded or not.
3823 @Type: boolean
3824 @mn:stemName: nsx
3825
3826 PropDef:
3827 @QName: etExpanded
3828 @Description:
3829 @@lang:en
3830 @@@:
3831 Whether the element type binding has been expanded or not.
3832 @Type: boolean
3833 @mn:stemName: etx
3834
3835 PropDef:
3836 @QName:nsBinding
3837 @Description:
3838 @@lang:en
3839 @@@:
3840 Namespace prefix and URI bindings.
3841 @mn:stemName: swnsb
3842
3843 PropDef:
3844 @QName:etBinding
3845 @Description:
3846 @@lang:en
3847 @@@:
3848 Element type bindings.
3849 @mn:stemName: swetb
3850
3851 ResourceDef:
3852 @QName: RealName
3853 @rdf:type:
3854 rdfs:Class
3855 @Description:
3856 @@lang:en
3857 @@@:
3858 The special-purpose namespace to which qualified names
3859 unparsed because of element type bindings belong.
3860 @For:
3861 =ManakaiDOM:all
3862
3863 PropDef:
3864 @QName:isShadowMaster
3865 @Description:
3866 @@lang:en
3867 @@@:
3868 Whether a document fragment node is the root node of a
3869 shadow master tree or not.
3870 @Type: boolean
3871 @rdfs:range: SWCFGDocumentFragment
3872 @mn:stemName: shadowmaster
3873
3874 PropDef:
3875 @QName:defaultETNamespaceURI
3876 @Description:
3877 @@lang:en
3878 @@@:
3879 Default namespace URI for element type.
3880 @Type: SWCFGString
3881
3882 PropDef:
3883 @QName:flag
3884 @Type: DISPerl|HASH||ManakaiDOM|all
3885 @Description:
3886 @@lang:en
3887 @@@:
3888 Flags associated with the node.
3889 @mn:stemName: swflag
3890
3891 PropDef:
3892 @QName:option
3893 @Type: DISPerl|HASH||ManakaiDOM|all
3894 @Description:
3895 @@lang:en
3896 @@@:
3897 Node-wide options set to the node.
3898 #@Type:c
3899
3900 PropDef:
3901 @QName:nodeType
3902 @Type:SWCFGString
3903 @Description:
3904 @@lang:en
3905 @@@:
3906 The node type.
3907 @mn:stemName: swnt
3908
3909 ## -- Exceptions
3910
3911 ResourceDef:
3912 @rdf:type:
3913 @@@: dis|MultipleResource
3914 @@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
3915 @resourceFor: ManakaiDOM|ForIF
3916 @resourceFor:
3917 @@@: ManakaiDOM|ForClass
3918 @@ForCheck: ForEmpty !=ForEmpty
3919 @For: ForLatest
3920 @For: =ForEmpty
3921
3922 @rdf:type:
3923 @@@: dx|Interface
3924 @@ForCheck: ManakaiDOM|ForIF
3925
3926 @rdf:type:
3927 @@@: dx|Class
3928 @@ForCheck: ManakaiDOM|ForClass
3929
3930 @Implement:
3931 @@@: ||ForEmpty||ManakaiDOM|ForIF
3932 @@ContentType: DISCore|TFPQNames
3933 @@ForCheck: ManakaiDOM|ForClass ForEmpty
3934 @Implement:
3935 @@@: ||ForLatest||ManakaiDOM|ForIF
3936 @@ContentType: DISCore|TFPQNames
3937 @@ForCheck: ManakaiDOM|ForClass ForLatest
3938 @dx:implementedBy: ||swcfg21|ForLatest||ManakaiDOM|ForClass
3939
3940 @f:implements:
3941 @@@: CoreFeature21
3942 @@For: ForLatest
3943
3944 @ISA:
3945 @@@: dx|Exception||ManakaiDOM|Perl
3946 @@ForCheck: ManakaiDOM|ForClass
3947
3948 @IFQName: SWCFGException
3949 @ClsQName: ManakaiSWCFGException
3950
3951 @Description:
3952 @@lang:en
3953 @@@:
3954 Exceptions raised if an attempt to make a bad operation has made.
3955
3956 @ResourceDef:
3957 @@rdf:type: DISLang|ConstGroup
3958 @@ForCheck: ManakaiDOM|ForIF !=ForEmpty
3959
3960 @@IFQName: SWCFGExceptionCode
3961
3962 @@rdfs:subClassOf: idl|unsignedShort||ManakaiDOM|all
3963 @@Type:idl|unsignedShort||ManakaiDOM|all
3964
3965 @@XConst:
3966 @@@Name:HIERARCHY_REQUEST_ERR
3967 @@@Value:
3968 @@@@@:3
3969 @@@@ContentType: DISCore|Integer
3970 @@@Description:
3971 @@@@lang:en
3972 @@@@@:
3973 An attempt is made to insert a node somewhere it does not belong.
3974 @@@XSubTypeDef:
3975 @@@@QName:HIERARCHY_ANCESTOR_OR_SELF_ERR
3976 @@@@Description:
3977 @@@@@lang:en
3978 @@@@@@:
3979 An attempt is made to insert an ancestor of this node or
3980 this node itself.
3981 @@@XSubTypeDef:
3982 @@@@QName:HIERARCHY_BAD_TYPE_ERR
3983 @@@@Description:
3984 @@@@@lang:en
3985 @@@@@@:
3986 An attempt is made to insert a comment node into non-document
3987 node or a document or document fragment node somwehre or
3988 any node into comment node.
3989 @@@@enMufDef:
3990 An attempt is made to insert a node %p (
3991 name => {<Q::swcfg21:childNodeType>}, prefix => { of type });
3992 into the node %p (name => {<Q::swcfg21:parentNodeType>},
3993 prefix => {of type });, which is not allowed
3994 @@@@XParam:
3995 @@@@@QName: parentNodeType
3996 @@@@@Description:
3997 @@@@@@lang:en
3998 @@@@@@@:
3999 The type of the node into which an attempt is made to
4000 insert another node.
4001 @@@@XParam:
4002 @@@@@QName: childNodeType
4003 @@@@@Description:
4004 @@@@@@lang:en
4005 @@@@@@@:
4006 The type of the node that an attempt is made to
4007 insert into another node.
4008 @@@XSubTypeDef:
4009 @@@@QName: HIERARCHY_NO_VALUE_ERR
4010 @@@@Description:
4011 @@@@@lang:en
4012 @@@@@@:
4013 An attempt is made to set a node value for a document node.
4014 @@@@enMufDef:
4015 An attempt is made to set a node value for a
4016 %p (name => {<Q::swcfg21:parentNodeType>}); node
4017 @@@@XParam:
4018 @@@@@QName: parentNodeType
4019 @@@@@Description:
4020 @@@@@@lang:en
4021 @@@@@@@:
4022 The type of the node to which the value is attempted to set.
4023 @@XConst:
4024 @@@Name:WRONG_DOCUMENT_ERR
4025 @@@Value:
4026 @@@@@:4
4027 @@@@ContentType: DISCore|Integer
4028 @@@Description:
4029 @@@@lang:en
4030 @@@@@:
4031 A node is used in a different document than the one for which
4032 it is created.
4033 @@@XSubTypeDef:
4034 @@@@QName:EXTERNAL_NODE_ERR
4035 @@@@Description:
4036 @@@@@lang:en
4037 @@@@@@:
4038 An attempt is made to insert a foreign node.
4039 @@@@enMufDef:
4040 An attempt is made to append a node created for another document
4041 @@XConst:
4042 @@@Name:TYPE_MISMATCH_ERR
4043 @@@Value:
4044 @@@@@:17
4045 @@@@ContentType: DISCore|Integer
4046 @@@Description:
4047 @@@@lang:en
4048 @@@@@:
4049 The type of an object is incompatible with the type of
4050 the parameter.
4051 @@@XSubTypeDef:
4052 @@@@QName:BAD_VALUE_ERR
4053 @@@@Description:
4054 @@@@@lang:en
4055 @@@@@@:
4056 The type of an object is not a string nor a list (array reference).
4057 @@@@enMufDef:
4058 A value%p (name => {<Q::swcfg21:actualType>}, prefix => { of type }); is
4059 specified where only either string or array reference is allowed
4060 @@@@XParam:
4061 @@@@@QName:actualType
4062 @@@@@Description:
4063 @@@@@@lang:en
4064 @@@@@@@:
4065 The type of the object specified.
4066 @@@XSubTypeDef:
4067 @@@@QName:NOT_NODE_ERR
4068 @@@@Description:
4069 @@@@@lang:en
4070 @@@@@@:
4071 The type of an object is not <IF::SWCFGNode>.
4072 @@@@XParam:
4073 @@@@@QName:actualType
4074 @@@@@Description:
4075 @@@@@@lang:en
4076 @@@@@@@:
4077 The type of the object specified.
4078 @@@XSubTypeDef:
4079 @@@@QName:APPEND_NULL_TEXT_ERR
4080 @@@@Description:
4081 @@@@@lang:en
4082 @@@@@@:
4083 An attempt is made to append a <DOM::null> value.
4084 @@XConst:
4085 @@@Name: NOT_SUPPORTED_ERR
4086 @@@Value:
4087 @@@@@: 9
4088 @@@@ContentType: DISCore|Integer
4089 @@@XSubTypeDef:
4090 @@@@QName:SWCFG_VERSION_NOT_SUPPORTED_ERR
4091 @@@@Description:
4092 @@@@@lang:en
4093 @@@@@@:
4094 The implementation does not support the specified version
4095 of SuikaWikiConfig.
4096 @@@@XParam:
4097 @@@@@QName:version
4098 @@@@@Description:
4099 @@@@@@lang:en
4100 @@@@@@@:
4101 The version of SuikaWikiConfig that the implementation
4102 does not support.
4103 @@XConst:
4104 @@@Name: NAMESPACE_ERR
4105 @@@Value:
4106 @@@@@:14
4107 @@@@ContentType: DISCore|Integer
4108 @@@Description:
4109 @@@@lang:en
4110 @@@@@:
4111 An error related to namespaces has occurred.
4112 @@@XSubTypeDef:
4113 @@@@QName:
4114 DIS:UNDECLARED_NS_PREFIX_ERR
4115 @@@@enDesc:
4116 The implementation has encounted an undeclared namespace
4117 prefix.
4118 @@@@XParam:
4119 @@@@@QName:
4120 infoset:prefix
4121 @@@@@enDesc:
4122 The namespace prefix.
4123 @@@@XSourceNodeParam:
4124 @@@@enMufDef:
4125 Namespace prefix "%p (name => {<Q::infoset:prefix>});" is
4126 not declared
4127 @@XConst:
4128 @@@Name:PARSE_ERR
4129 @@@Value:
4130 @@@@@:81
4131 @@@@ContentType: DISCore|Integer
4132 @@@XSubTypeDef:
4133 @@@@QName:SWCFG_PARSE_ERR
4134 @@@@Description:
4135 @@@@@lang:en
4136 @@@@@@:
4137 The implementation is unable to read and parse the
4138 SuikaWikiConfig document.
4139
4140 @Attr:
4141 @@Name: text
4142 @@enDesc:
4143 The description of the error, in <LANG::i-default> language.
4144 @@enImplNote:
4145 See <A::dx|Exception.text> for super definition.
4146 @@Type: DISLang|String
4147 @@Get:
4148 @@@PerlDef:
4149 __DEEP{
4150 $r = $self->SUPER::text;
4151 if (defined $self->{<H::DIS:sourceNode>}) {
4152 $r = 'Node ' . $self->{<H::DIS:sourceNode>}-><M::SWCFGNode.nodePath>
4153 . ': ' . $r;
4154 }
4155 }__;
4156 ##SWCFGException
4157
4158 ElementTypeBinding:
4159 @Name: enDesc
4160 @ElementType:
4161 dis:Description
4162 @ShadowContent:
4163 @@lang:en
4164
4165 ElementTypeBinding:
4166 @Name: enImplNote
4167 @ElementType:
4168 dis:ImplNote
4169 @ShadowContent:
4170 @@lang:en
4171
4172 ElementTypeBinding:
4173 @Name: XSourceNodeParam
4174 @ElementType:
4175 ecore:hasParameter
4176 @ShadowContent:
4177 @@QName:
4178 DIS:sourceNode
4179 @@Description:
4180 @@@lang:en
4181 @@@@:
4182 The node in which an error has occurred.
4183
4184 XParamDef:
4185 @QName:
4186 DIS:sourceNode
4187 @Description:
4188 @@lang:en
4189 @@@:
4190 The node in which an error has occurred.
4191 @Type: ManakaiSWCFGNode
4192
4193 XPropDef:
4194 @QName: parentNodeType
4195 @Description:
4196 @@lang:en
4197 @@@:
4198 The type of the node that an attempt is made to
4199 insert into another node.
4200
4201 XPropDef:
4202 @QName: childNodeType
4203 @Description:
4204 @@lang:en
4205 @@@:
4206 The type of the node into which an attempt is made to
4207 insert another node.
4208
4209 XPropDef:
4210 @QName:actualType
4211 @Description:
4212 @@lang:en
4213 @@@:
4214 The type of the actually specified value.
4215 @dataType:
4216 DISCore:String
4217
4218 XPropDef:
4219 @QName: version
4220 @Type: SWCFGString
4221 @Description:
4222 @@lang:en
4223 @@@:
4224 The version of the SuikaWikiConfig format. Currently there is
4225 version <CODE::2.0> and <CODE::2.1> defined.
4226
4227 ## -- Datatypes
4228
4229 ResourceDef:
4230 @QName: SWCFGString
4231 @AliasFor: DISPerl|String||ManakaiDOM|all
4232 @For: swcfg21|ForEmpty
4233
4234 ResourceDef:
4235 @QName: boolean
4236 @AliasFor: idl|boolean||ManakaiDOM|all
4237 @For: swcfg21|ForEmpty
4238
4239 ResourceDef:
4240 @QName: any
4241 @AliasFor: idl|any||ManakaiDOM|all
4242 @For: swcfg21|ForEmpty
4243
4244 ResourceDef:
4245 @QName: unsignedLong
4246 @AliasFor: idl|unsignedLong||ManakaiDOM|all
4247 @For: swcfg21|ForEmpty
4248
4249 ElementTypeBinding:
4250 @Name: plCName
4251 @ElementType:
4252 DISPerl:exportTagName
4253 @ShadowContent:
4254 @@For: ManakaiDOM|Perl
4255
4256 ## -- Load
4257
4258 IFClsDef:
4259 @IFQName: SWCFGParser
4260 @ClsQName: ManakaiSWCFGParser
4261
4262 @ClsISA: DOMException|ManakaiDefaultExceptionHandler||ManakaiDOM|Perl
4263
4264 @DISLang:role: DOMLS|ParserRole
4265
4266 @Description:
4267 @@lang:en
4268 @@@:
4269 This interface provides methods to load SuikaWikiConfig documents.
4270
4271 @Method:
4272 @@Name: parse
4273 @@Description:
4274 @@@lang:en
4275 @@@@:
4276 Parses a SuikaWikiConfig document from a resource.
4277 @@Param:
4278 @@@Name:input
4279 @@@Type: DISPerl|HASH||ManakaiDOM|all
4280 @@@Description:
4281 @@@@lang:en
4282 @@@@@:
4283 The <IF::DOMLS:LSInput> from which the source of the document
4284 is to be read.
4285 @@Return:
4286 @@@Type:SWCFGDocument
4287 @@@Description:
4288 @@@@lang:en
4289 @@@@@:
4290 The newly created SuikaWikiConfig document node.
4291 @@@RaiseException:
4292 @@@@@:SWCFG_PARSE_ERR
4293 @@@@Description:
4294 @@@@@lang:en
4295 @@@@@@:
4296 The <IF::SWCFGParser> was unable to load the SuikaWikiConfig
4297 document.
4298 @@@PerlDef:
4299 my $text;
4300 ## 1. characterStream
4301 if (defined (my $cs = $input->{character_stream})) {
4302 local $/ = undef;
4303 $text = \ (readline $cs);
4304 }
4305 ## 3. stringData
4306 elsif (defined (my $sd = $input->{string_data})) {
4307 $text = $sd;
4308 } else {
4309 ## TODO: no-input-specified DOM error
4310 __EXCEPTION{SWCFG_PARSE_ERR::
4311 MDOMX:param-name => 'input',
4312 }__;
4313 }
4314
4315 my $root = $self->{<H::f|implementation>}
4316 -><M::SWCFGImplementation.createSWCFGDocument>;
4317
4318 ## TODO: Make configurable
4319 my $no_magic_line = false;
4320 my $no_namespace = false;
4321 my $no_preserve_wsp = false;
4322 my $no_binding = false;
4323
4324 ## Magic line
4325 if (not $no_magic_line and
4326 $$text =~ s[^\#\?SuikaWikiConfig/(\d+\.\d+)\x0D?\x0A][]s) {
4327 my $version = $1;
4328 if ($version eq '2.1') {
4329 #
4330 } elsif ($version eq '2.0') {
4331 $no_namespace = true;
4332 $no_preserve_wsp = true;
4333 $no_binding = true;
4334 } else {
4335 ## TODO: Version unsupported DOM error
4336 __EXCEPTION{SWCFG_PARSE_ERR::
4337 MDOMX:param-name => 'input',
4338 }__;
4339 }
4340 }
4341
4342 my $current = $root;
4343 my $current_element = $root;
4344 my $is_new_element = 0;
4345 my $is_list_element = 0;
4346 my $wsp_length = 0;
4347 my $vfragment = '';
4348 for my $line (split /\x0D?\x0A/, $$text) {
4349 if ($line =~ /^([^#\s].*):\s*([^\s:][^:]*)?$/) {
4350 my ($name, $val) = ($1, $2);
4351 substr ($name, 0, 1) = '' if defined $name and
4352 substr ($name, 0, 1) eq '\\';
4353 substr ($val, 0, 1) = '' if defined $val and
4354 substr ($val, 0, 1) eq '\\';
4355 if (substr ($name, -6) eq '[list]') {
4356 substr ($name, -6) = '';
4357 $val = length ($val) ? [$val] : [];
4358 $is_list_element = 1;
4359 } else {
4360 $is_list_element = 0;
4361 }
4362 $current_element = $root-><M::SWCFGNode.appendNewNode>
4363 (type => '#element',
4364 local_name => $name,
4365 value => $val);
4366 $current_element->{<H::mn:node>}
4367 ->{<H::swcfg21:namespaceExpanded>} = false
4368 unless $no_namespace;
4369 $current_element->{<H::mn:node>}
4370 ->{<H::swcfg21:etExpanded>} = false
4371 unless $no_binding;
4372 if (defined $2) { ## Foo: bar
4373 $current = $root;
4374 $current_element = $root;
4375 } else { ## Foo:\n bar\n baz
4376 $current = $current_element;
4377 $is_new_element = 1;
4378 }
4379 } elsif ($line =~ /^\s+(\@+)(.*):\s*([^\s:][^:]*)?$/) {
4380 my ($nest, $name, $val) = (length $1, $2, $3);
4381 substr ($name, 0, 1) = '' if defined $name and
4382 substr ($name, 0, 1) eq '\\';
4383 substr ($val, 0, 1) = '' if defined $val and
4384 substr ($val, 0, 1) eq '\\';
4385 if (substr ($name, -6) eq '[list]') {
4386 substr ($name, -6) = '';
4387 $val = (defined ($val) and length ($val)) ? [$val] : [];
4388 $is_list_element = 1;
4389 } else {
4390 $is_list_element = 0;
4391 }
4392 my $ce;
4393 if (length ($name)) {
4394 while ($current_element-><M::SWCFGNode.flag>
4395 ('p__nest_level' => null,
4396 default => 0) >= $nest) {
4397 $current_element
4398 = $current_element-><AG::SWCFGNode.parentNode>;
4399 }
4400 $ce = $current_element-><M::SWCFGNode.appendNewNode>
4401 (type => '#element',
4402 local_name => $name,
4403 value => $val);
4404 $ce->{<H::mn:node>}
4405 ->{<H::swcfg21:namespaceExpanded>} = false
4406 unless $no_namespace;
4407 $ce->{<H::mn:node>}
4408 ->{<H::swcfg21:etExpanded>} = false
4409 unless $no_binding;
4410 $ce-><M::SWCFGNode.flag> ('p__nest_level'
4411 => $current_element-><M::SWCFGNode.flag>
4412 ('p__nest_level' => null,
4413 default => 0) + 1);
4414 unless (defined $3) { ## @foo: \nbar
4415 $current_element = $ce;
4416 $current = $ce;
4417 $is_new_element = 1;
4418 }
4419 } else { ## @@:
4420 while ($current_element-><M::SWCFGNode.flag>
4421 ('p__nest_level' => null,
4422 default => 0) >= $nest - 1) {
4423 $current_element
4424 = $current_element-><AG::SWCFGNode.parentNode>;
4425 }
4426 if (defined $val) {
4427 if (defined $current_element->{<H::mn:node>}
4428 ->{<H::swcfg21:value>}) {
4429 if (ref $current_element->{<H::mn:node>}->{<H::swcfg21:value>}
4430 eq 'ARRAY') {
4431 push @{$current_element->{<H::mn:node>}
4432 ->{<H::swcfg21:value>}}, $val;
4433 } else {
4434 $current_element->{<H::mn:node>}
4435 ->{<H::swcfg21:value>} .= $val;
4436 }
4437 } else {
4438 $current_element->{<H::mn:node>}->{<H::swcfg21:value>} = $val;
4439 }
4440 }
4441 $current = $current_element;
4442 unless (defined $3) { ## @@: \nbar
4443 $is_new_element = 1;
4444 }
4445 }
4446 } elsif ($line =~ /^(\s+)(\S.*)$/) {
4447 my ($wsp, $val) = ($1, $2);
4448 if (substr ($val, 0, 1) eq '#' and
4449 not $is_new_element and
4450 length $wsp < $wsp_length) { ## Not part of element
4451 $current = $root-><M::SWCFGNode.appendNewNode>
4452 (type => '#comment',
4453 value => substr ($val, 1));
4454 } else {
4455 if (substr ($val, 0, 1) eq '\\') {
4456 substr ($val, 0, 1) = '';
4457 $wsp = '';
4458 }
4459 if ($is_new_element or $is_list_element) {
4460 $wsp_length = length $wsp;
4461 if (defined $current_element->{<H::mn:node>}
4462 ->{<H::swcfg21:value>}) {
4463 if (ref $current_element->{<H::mn:node>}
4464 ->{<H::swcfg21:value>} eq 'ARRAY') {
4465 push @{$current_element->{<H::mn:node>}
4466 ->{<H::swcfg21:value>}}, $val;
4467 } else {
4468 $current_element->{<H::mn:node>}
4469 ->{<H::swcfg21:value>} .= $val;
4470 }
4471 } else {
4472 $current_element->{<H::mn:node>}
4473 ->{<H::swcfg21:value>} = $val;
4474 }
4475 $is_new_element = 0;
4476 $vfragment = '';
4477 } else {
4478 $wsp = $no_preserve_wsp ? '' : substr ($wsp, $wsp_length);
4479 $val = $vfragment . "\x0A" . $wsp . $val;
4480 if (defined $current_element->{<H::mn:node>}
4481 ->{<H::swcfg21:value>}) {
4482 if (ref $current_element->{<H::mn:node>}
4483 ->{<H::swcfg21:value>} eq 'ARRAY') {
4484 push @{$current_element->{<H::mn:node>}
4485 ->{<H::swcfg21:value>}}, $val;
4486 } else {
4487 $current_element->{<H::mn:node>}
4488 ->{<H::swcfg21:value>} .= $val;
4489 }
4490 } else {
4491 $current_element->{<H::mn:node>}
4492 ->{<H::swcfg21:value>} = $val;
4493 }
4494 $vfragment = '';
4495 }
4496 }
4497 } elsif ($line =~ /^(\s*)$/) {
4498 $vfragment .= "\x0A" . substr ($1, $wsp_length)
4499 unless $no_preserve_wsp;
4500 $current = $root
4501 if $current-><AG::SWCFGNode.nodeType> eq '#comment';
4502 } else { $line =~ /^\#?(.*)$/;
4503 #} elsif ($line =~ /^\#(.*)$/) {
4504 my ($v) = ($1);
4505 if ($current-><AG::SWCFGNode.nodeType> eq '#comment') {
4506 $current-><M::SWCFGNode.appendText> ("\x0A" . $v);
4507 } else {
4508 $current = $root-><M::SWCFGNode.appendNewNode>
4509 (type => '#comment', value => $v);
4510 }
4511 #} else {
4512 # $current = $root;
4513 # #print STDERR qq(**$line**\n);
4514 }
4515 }
4516 unless ($no_namespace and $no_binding) {
4517 my @remove;
4518 for my $i (0..$#{$root->{<H::mn:node>}->{<H::swcfg21:childNodes>}}) {
4519 my $n = $root->{<H::mn:node>}->{<H::swcfg21:childNodes>}->[$i];
4520 next unless $n->{<H::swcfg21:nodeType>} eq '#element';
4521 if (not $no_namespace and $n->{<H::swcfg21:localName>} eq 'Namespace') {
4522 for my $cn (@{$n->{<H::swcfg21:childNodes>}}) {
4523 next unless $cn->{<H::swcfg21:nodeType>} eq '#element';
4524 if ($cn->{<H::swcfg21:value>}) {
4525 $root->{<H::mn:node>}->{<H::swcfg21:nsBinding>}
4526 ->{$cn->{<H::swcfg21:localName>}} = $cn->{<H::swcfg21:value>};
4527 } else {
4528 ISNULL: {
4529 for my $in (@{$cn->{<H::swcfg21:childNodes>}}) {
4530 if ($in->{<H::swcfg21:nodeType>} eq '#element' and
4531 $in->{<H::swcfg21:localName>} eq 'is-null' and
4532 $in->{<H::swcfg21:value>}) {
4533 $root->{<H::mn:node>}->{<H::swcfg21:nsBinding>}
4534 ->{$cn->{<H::swcfg21:localName>}} = undef;
4535 last ISNULL;
4536 }
4537 }
4538 $root->{<H::mn:node>}->{<H::swcfg21:nsBinding>}
4539 ->{$cn->{<H::swcfg21:localName>}} = $cn->{<H::swcfg21:value>};
4540 } # ISNULL
4541 }
4542 }
4543 ## TODO: DOM error if unknown node
4544 push @remove, $i;
4545 CORE::delete $n->{<H::swcfg21:parent>};
4546 $n-><M::NodeStem.orphanate>;
4547 } elsif (not $no_binding and
4548 $n->{<H::swcfg21:localName>} eq 'ElementTypeBinding') {
4549 my ($et, $sn, $sc, $ss) = ('', '');
4550 my @etr;
4551 CN: for my $cn (@{$n->{<H::swcfg21:childNodes>}}) {
4552 unless ($cn->{<H::swcfg21:nodeType>} eq '#element') {
4553 push @etr, $cn;
4554 next CN;
4555 }
4556 if ($cn->{<H::swcfg21:localName>} eq 'Name') {
4557 $et = $cn->{<H::swcfg21:value>} if defined $cn->{<H::swcfg21:value>};
4558 push @etr, $cn;
4559 } elsif ($cn->{<H::swcfg21:localName>} eq 'ElementType') {
4560 $sn = $cn->{<H::swcfg21:value>} if defined $cn->{<H::swcfg21:value>};
4561 push @etr, $cn;
4562 } elsif ($cn->{<H::swcfg21:localName>} eq 'ShadowContent') {
4563 $sc = $cn;
4564 $sc->{<H::swcfg21:nodeType>} = '#fragment';
4565 $sc->{<H::swcfg21:parent>} = null;
4566 $sc->{<H::swcfg21:isShadowMaster>} = true;
4567 $sc->{<H::swcfg21:shadowOwner>} = $root->{<H::mn:node>};
4568 $sc->{<H::swcfg21:namespaceExpanded>} = true;
4569 $sc->{<H::swcfg21:etExpanded>} = true;
4570 $sc->{<H::mn:type>}
4571 = <ClassName::ManakaiSWCFGDocumentFragment>;
4572 } elsif ($cn->{<H::swcfg21:localName>} eq 'ShadowSibling') {
4573 $ss = $cn;
4574 $ss->{<H::swcfg21:nodeType>} = '#fragment';
4575 $ss->{<H::swcfg21:parent>} = null;
4576 $ss->{<H::swcfg21:isShadowMaster>} = true;
4577 $ss->{<H::swcfg21:shadowOwner>} = $root->{<H::mn:node>};
4578 $ss->{<H::swcfg21:namespaceExpanded>} = true;
4579 $ss->{<H::swcfg21:etExpanded>} = true;
4580 $ss->{<H::mn:type>}
4581 = <ClassName::ManakaiSWCFGDocumentFragment>;
4582 } else {
4583 push @etr, $cn;
4584 }
4585 }
4586 $n->{<H::swcfg21:childNodes>} = [];
4587 for (@etr) {
4588 CORE::delete $_->{<H::swcfg21:parent>};
4589 $_-><M::NodeStem.orphanate>;
4590 }
4591 unless (defined $root->{<H::mn:node>}
4592 ->{<H::swcfg21:etBinding>}->{$et}) {
4593 $root->{<H::mn:node>}
4594 ->{<H::swcfg21:etBinding>}->{$et} = {
4595 elementType => $et,
4596 shadowLocalName => $sn,
4597 namespaceExpanded => false,
4598 shadowContent => $sc,
4599 shadowSibling => $ss,
4600 };
4601 }
4602 ## TODO: DOM error if unknown node
4603 push @remove, $i;
4604 CORE::delete $n->{<H::swcfg21:parent>};
4605 $n-><M::NodeStem.orphanate>;
4606 }
4607 } # $i
4608 for my $i (reverse @remove) {
4609 splice @{$root->{<H::mn:node>}->{<H::swcfg21:childNodes>}},
4610 $i, 1, ();
4611 }
4612 }
4613 $r = $root;
4614
4615 @IntMethod:
4616 @@ForCheck: ManakaiDOM|ForClass
4617 @@Operator:
4618 @@@@: DISPerl|NewMethod
4619 @@@ContentType: DISCore|QName
4620 @@ForCheck: ManakaiDOM|ForClass
4621 @@enDesc:
4622 Creates a new instance of the <IF::SWCFGParser> interface
4623 and returns it.
4624
4625 {NOTE:: This method is compatible with the role <Q::DOMLS:ParserRole>
4626 so that this class is accessible via the
4627 <M::DOMLS|DOMImplementationLSExtended.createMLSParser>
4628 method.
4629 }
4630 @@Param:
4631 @@@Name: impl
4632 @@@Type: f|MinimumImplementation||ManakaiDOM|ManakaiDOMLatest
4633 @@@enDesc:
4634 An implementation object. The <M::f|GetFeature.getFeature>
4635 method with parameter values <Feature::swcfg21|Core> and
4636 <FeatureVer::2.1> respectively <kwd:MUST> return
4637 an object implementing the <IF::SWCFGImplementation> interface.
4638 @@Param:
4639 @@@Name: features
4640 @@@Type: SWCFGString
4641 @@@dis:actualType: f|FeaturesString||ManakaiDOM|ManakaiDOMLatest
4642 @@@enDesc:
4643 A list of requested features. In the current implementation
4644 this parameter is ignored.
4645 @@Return:
4646 @@@Type: idl|Object||ManakaiDOM|all
4647 @@@actualType: ManakaiSWCFGParser
4648 @@@enDesc: The newly created parser object.
4649 @@@PerlDef:
4650 $r = bless {<H::f|implementation> =>
4651 $impl-><M::f|GetFeature
4652 ||ManakaiDOM|ManakaiDOMLatest.getFeature>
4653 (<Q::swcfg21:Core> => '2.1')},
4654 $self;
4655 ##SWCFGParser
4656
4657 PropDef:
4658 @QName: parent
4659 @enDesc:
4660 The parent node object of this node.
4661 @mn:stemName: p
4662
4663 ## -- Bootstraps
4664
4665 IFClsDef:
4666 @IFQName: SWCFGImplementation
4667 @ClsQName: ManakaiSWCFGImplementation
4668
4669 @ClsISA: f|ManakaiMinimumImplementation||ManakaiDOM|ManakaiDOMLatest
4670
4671 @f:provides: CoreFeature21
4672
4673 @Description:
4674 @@lang:en
4675 @@@:
4676 This interface allows applications to retrieve an instance of
4677 <IF::SWCFGParser>.
4678 @ImplNote:
4679 @@lang:en
4680 @@@:
4681 This interface should be implemented on the same object that
4682 implements <IF::DOMImplementation>.
4683 @@ForCheck: ManakaiDOM|ForIF
4684
4685 # recognizedVersions : StringList
4686
4687 @Method:
4688 @@Name: createSWCFGDocument
4689 @@Description:
4690 @@@lang:en
4691 @@@@:
4692 Creates an empty <IF::SWCFGDocument> object.
4693 @@NewIn21:
4694 @@Param:
4695 @@@Name:version
4696 @@@Type:SWCFGString
4697 @@@Description:
4698 @@@@lang:en
4699 @@@@@:
4700 The version of the SuikaWikiConfig format. Currently
4701 only the version <CODE::2.1> is supported.
4702 @@@InCase:
4703 @@@@Value:
4704 @@@@@is-null:1
4705 @@@@Type:SWCFGString
4706 @@@@Description:
4707 @@@@@lang:en
4708 @@@@@@:
4709 The latest version of the SuikaWikiConfig that the implementation
4710 supports is selected.
4711 @@Return:
4712 @@@Type:SWCFGDocument
4713 @@@actualType:ManakaiSWCFGDocument
4714 @@@Description:
4715 @@@@lang:en
4716 @@@@@:The newly created SuikaWikiConfig document object.
4717 @@@RaiseException:
4718 @@@@@:SWCFG_VERSION_NOT_SUPPORTED_ERR
4719 @@@@Description:
4720 @@@@@lang:en
4721 @@@@@@:
4722 The <P::version> is not supported.
4723 @@@PerlDef:
4724 if (defined $version and $version ne '2.1') {
4725 __EXCEPTION{SWCFG_VERSION_NOT_SUPPORTED_ERR::
4726 swcfg21:version => {$version},
4727 }__;
4728 }
4729 $r = <ClassM::ManakaiSWCFGDocument.newObject>;
4730 $r->{<H::f|implementation>} = $self;
4731 $r->{<H::swcfg21:version>} = $version || '2.1';
4732 $r = <ClassM::ManakaiSWCFGNode.getNodeReference> ($r);
4733
4734 @Method:
4735 @@Name: createSWCFGParser
4736 @@Description:
4737 @@@lang:en
4738 @@@@:
4739 Creates a new <IF::SWCFGParser>.
4740 @@NewIn21:
4741 @@Param:
4742 @@@Name:versions
4743 @@@Type: any
4744 @@@Description:
4745 @@@@lang:en
4746 @@@@@:
4747 Future version of this implementation will allow
4748 a list containing the versions of SuikaWikiConfig documents
4749 that can be loaded by the <IF::SWCFGParser> created.
4750 @@@InCase:
4751 @@@@Value:
4752 @@@@@is-null:1
4753 @@@@Type:SWCFGString
4754 @@@@Description:
4755 @@@@@lang:en
4756 @@@@@@:
4757 Permits SuikaWikiConfig documents of any recognized
4758 version to be loaded by the <IF::SWCFGParser>.
4759 @@Return:
4760 @@@Type: SWCFGParser
4761 @@@Description:
4762 @@@@lang:en
4763 @@@@@:
4764 The newly created <IF::SWCFGParser>.
4765 @@@RaiseException:
4766 @@@@@: SWCFG_VERSION_NOT_SUPPORTED_ERR
4767 @@@@Description:
4768 @@@@@lang:en
4769 @@@@@@:
4770 The implementation does not support one of the specified
4771 version.
4772 @@@PerlDef:
4773 ## TODO: Support $versions
4774 if (defined $versions) {
4775 __EXCEPTION{SWCFG_VERSION_NOT_SUPPORTED_ERR}__;
4776 }
4777 $r = <ClassName::ManakaiSWCFGParser>->new ($self);
4778
4779 ResourceDef:
4780 @QName: NodeStem
4781 @AliasFor: ManakaiNode|NodeStem||ManakaiDOM|Perl
4782
4783 ResourceDef:
4784 @QName: NodeRef
4785 @AliasFor: ManakaiNode|NodeRef||ManakaiDOM|Perl
4786
4787 ## -- Syntax sugar
4788
4789 ElementTypeBinding:
4790 @Name: PropDef
4791 @ElementType:
4792 dis:ResourceDef
4793 @ShadowContent:
4794 @@rdf:type:
4795 rdf:Property
4796 @@AliasFor:
4797 @@@@:
4798 ::ManakaiDOM:all
4799 @@@For:
4800 !=ManakaiDOM:all
4801
4802 ElementTypeBinding:
4803 @Name: IFQName
4804 @ElementType:
4805 dis:QName
4806 @ShadowContent:
4807 @@ForCheck: ManakaiDOM|ForIF
4808
4809 ElementTypeBinding:
4810 @Name: ClsQName
4811 @ElementType:
4812 dis:QName
4813 @ShadowContent:
4814 @@ForCheck: ManakaiDOM|ForClass
4815
4816 ElementTypeBinding:
4817 @Name: IFISA
4818 @ElementType:
4819 dis:ISA
4820 @ShadowContent:
4821 @@ForCheck: ManakaiDOM|ForIF
4822
4823 ElementTypeBinding:
4824 @Name: ClsISA
4825 @ElementType:
4826 dis:ISA
4827 @ShadowContent:
4828 @@ForCheck: ManakaiDOM|ForClass
4829
4830 ElementTypeBinding:
4831 @Name: Method
4832 @ElementType:
4833 dis:ResourceDef
4834 @ShadowContent:
4835 @@rdf:type:
4836 DISLang:Method
4837 @@For: !=ForEmpty
4838
4839 ElementTypeBinding:
4840 @Name: IntMethod
4841 @ElementType:
4842 dis:ResourceDef
4843 @ShadowContent:
4844 @@rdf:type:
4845 DISLang:Method
4846 @@ManakaiDOM:isForInternal:1
4847 @@ForCheck: ManakaiDOM|ForClass
4848
4849 ElementTypeBinding:
4850 @Name: RedefMethod
4851 @ElementType:
4852 dis:ResourceDef
4853 @ShadowContent:
4854 @@rdf:type:
4855 DISLang:Method
4856 @@ManakaiDOM:isRedefining:1
4857 @@ForCheck: ManakaiDOM|ForClass
4858
4859 ElementTypeBinding:
4860 @Name: Return
4861 @ElementType:
4862 dis:ResourceDef
4863 @ShadowContent:
4864 @@rdf:type:
4865 DISLang:MethodReturn
4866
4867 ElementTypeBinding:
4868 @Name: Param
4869 @ElementType:
4870 dis:ResourceDef
4871 @ShadowContent:
4872 @@rdf:type:
4873 DISLang:MethodParameter
4874
4875 ElementTypeBinding:
4876 @Name: NamedParam
4877 @ElementType:
4878 dis:ResourceDef
4879 @ShadowContent:
4880 @@rdf:type:
4881 DISLang:MethodParameter
4882 @@DISPerl:isNamedParameter:1
4883
4884 ElementTypeBinding:
4885 @Name: MakeNewNodeParam
4886 @ElementType:
4887 dis:ResourceDef
4888 @ShadowContent:
4889 @@rdf:type:
4890 DISLang:MethodParameter
4891 @@DISPerl:isNamedParameter:1
4892 @@Name:makeNewNode
4893 @@Type: boolean
4894 @@Description:
4895 @@@lang:en
4896 @@@@:
4897 Whether a new node should be made when one is not found.
4898 @@ResourceDef:
4899 @@@rdf:type:
4900 ManakaiDOM:InCase
4901 @@@Value:
4902 @@@@@:1
4903 @@@@ContentType: DISCore|Boolean
4904 @@@Type: boolean
4905 @@@Description:
4906 @@@@lang:en
4907 @@@@@: A new node is created when no such node found.
4908 @@ResourceDef:
4909 @@@rdf:type:
4910 ManakaiDOM:InCase
4911 @@@Value:
4912 @@@@@:0
4913 @@@@ContentType: DISCore|Boolean
4914 @@@Type: boolean
4915 @@@Description:
4916 @@@@lang:en
4917 @@@@@: A new node is not created even when no such node found.
4918
4919 ElementTypeBinding:
4920 @Name: DefaultParam
4921 @ElementType:
4922 dis:ResourceDef
4923 @ShadowContent:
4924 @@rdf:type:
4925 DISLang:MethodParameter
4926 @@DISPerl:isNamedParameter:1
4927 @@Name:default
4928 @@Type: any
4929 @@Description:
4930 @@@lang:en
4931 @@@@:
4932 Default value that is returned when no explicit value specification
4933 found.
4934 @@ResourceDef:
4935 @@@rdf:type:
4936 ManakaiDOM:InCase
4937 @@@Type: any
4938 @@@Value:
4939 @@@@is-null:1
4940 @@@Description:
4941 @@@@lang:en
4942 @@@@@: No default value.
4943
4944 ElementTypeBinding:
4945 @Name: DefaultListParam
4946 @ElementType:
4947 dis:ResourceDef
4948 @ShadowContent:
4949 @@rdf:type:
4950 DISLang:MethodParameter
4951 @@DISPerl:isNamedParameter:1
4952 @@Name:defaultList
4953 @@Type: any
4954 @@Description:
4955 @@@lang:en
4956 @@@@:
4957 Default list value that is returned when the value is of list
4958 but there is <EM::zero> item found. The <P::defaultList> value
4959 should be an array reference for consistency.
4960 @@ResourceDef:
4961 @@@rdf:type:
4962 ManakaiDOM:InCase
4963 @@@Value:
4964 @@@@is-null:1
4965 @@@Type: any
4966 @@@Description:
4967 @@@@lang:en
4968 @@@@@: No default list value.
4969
4970 ElementTypeBinding:
4971 @Name: TypeParam
4972 @ElementType:
4973 dis:ResourceDef
4974 @ShadowContent:
4975 @@rdf:type:
4976 DISLang:MethodParameter
4977 @@DISPerl:isNamedParameter:1
4978 @@Name:type
4979 @@Type:SWCFGString
4980 @@Description:
4981 @@@lang:en
4982 @@@@:
4983 Type of the node to create. This parameter is <EM::required>.
4984 @@ResourceDef:
4985 @@@rdf:type:
4986 ManakaiDOM:InCase
4987 @@@Value:\#comment
4988 @@@Type:SWCFGString
4989 @@@Description:
4990 @@@@lang:en
4991 @@@@@:Comment node.
4992 @@ResourceDef:
4993 @@@rdf:type:
4994 ManakaiDOM:InCase
4995 @@@Value:\#document
4996 @@@Type:SWCFGString
4997 @@@Description:
4998 @@@@lang:en
4999 @@@@@:Document node.
5000 @@ResourceDef:
5001 @@@rdf:type:
5002 ManakaiDOM:InCase
5003 @@@Value:\#element
5004 @@@Type:SWCFGString
5005 @@@Description:
5006 @@@@lang:en
5007 @@@@@:Element node.
5008 @@ResourceDef:
5009 @@@rdf:type:
5010 ManakaiDOM:InCase
5011 @@@Value:\#fragment
5012 @@@Type:SWCFGString
5013 @@@Description:
5014 @@@@lang:en
5015 @@@@@:Document fragment node.
5016
5017 ElementTypeBinding:
5018 @Name: LocalNameParam
5019 @ElementType:
5020 dis:ResourceDef
5021 @ShadowContent:
5022 @@rdf:type:
5023 DISLang:MethodParameter
5024 @@DISPerl:isNamedParameter:1
5025 @@Name:localName
5026 @@Type:SWCFGString
5027 @@Description:
5028 @@@lang:en
5029 @@@@:
5030 The local name of the node to create. This parameter is
5031 <EM::required> when the node <P::type> is set to <CODE::#element>.
5032
5033 ElementTypeBinding:
5034 @Name: NSURIParam
5035 @ElementType:
5036 dis:ResourceDef
5037 @ShadowContent:
5038 @@rdf:type:
5039 DISLang:MethodParameter
5040 @@DISPerl:isNamedParameter:1
5041 @@Name:namespaceURI
5042 @@Type:SWCFGString
5043 @@Description:
5044 @@@lang:en
5045 @@@@:
5046 The namespace URI of the node to create. This parameter should
5047 be specified if and only if the node <P::type> is <CODE::#element>.
5048
5049 ElementTypeBinding:
5050 @Name: ValueParam
5051 @ElementType:
5052 dis:ResourceDef
5053 @ShadowContent:
5054 @@rdf:type:
5055 DISLang:MethodParameter
5056 @@DISPerl:isNamedParameter:1
5057 @@Name:value
5058 @@Type:SWCFGString
5059 @@Description:
5060 @@@lang:en
5061 @@@@:
5062 The value of the node to create. This parameter should
5063 only be specified for the node of <P::type> <CODE::#element>
5064 or <CODE::#comment>.
5065 @@ResourceDef:
5066 @@@rdf:type:
5067 ManakaiDOM:InCase
5068 @@@Value:
5069 @@@@is-null:1
5070 @@@Type:SWCFGString
5071 @@@Description:
5072 @@@@lang:en
5073 @@@@@:
5074 If the <P::type> is set to <CODE::#comment>, a <DOM::null>
5075 value is equivalent to an empty string. Otherwise,
5076 the node created has no value.
5077
5078 ElementTypeBinding:
5079 @Name: actualType
5080 @ElementType:
5081 dis:actualType
5082 @ShadowContent:
5083 @@ForCheck: ManakaiDOM|ForClass
5084
5085 ElementTypeBinding:
5086 @Name: Attr
5087 @ElementType:
5088 dis:ResourceDef
5089 @ShadowContent:
5090 @@rdf:type:
5091 DISLang:Attribute
5092 @@For: !=ForEmpty
5093
5094 ElementTypeBinding:
5095 @Name: RedefAttr
5096 @ElementType:
5097 dis:ResourceDef
5098 @ShadowContent:
5099 @@rdf:type:
5100 DISLang:Attribute
5101 @@ManakaiDOM:isRedefining:1
5102 @@ForCheck: ManakaiDOM|ForClass
5103
5104 ElementTypeBinding:
5105 @Name: Get
5106 @ElementType:
5107 dis:ResourceDef
5108 @ShadowContent:
5109 @@rdf:type:
5110 DISLang:AttributeGet
5111
5112 ElementTypeBinding:
5113 @Name: Set
5114 @ElementType:
5115 dis:ResourceDef
5116 @ShadowContent:
5117 @@rdf:type:
5118 DISLang:AttributeSet
5119
5120 ElementTypeBinding:
5121 @Name: InCase
5122 @ElementType:
5123 dis:ResourceDef
5124 @ShadowContent:
5125 @@rdf:type:
5126 ManakaiDOM:InCase
5127
5128 ElementTypeBinding:
5129 @Name: disDef
5130 @ElementType:
5131 dis:Def
5132 @ShadowContent:
5133 @@ContentType:
5134 lang:dis
5135
5136 ElementTypeBinding:
5137 @Name: PerlDef
5138 @ElementType:
5139 dis:Def
5140 @ShadowContent:
5141 @@ContentType:
5142 lang:Perl
5143
5144 ElementTypeBinding:
5145 @Name: NSVariant
5146 @ElementType:
5147 swcfg21:namespaceAwareVariant
5148 @ShadowSibling:
5149 @@DISCore:isDeprecated:1
5150
5151 ElementTypeBinding:
5152 @Name: NonNSVariant
5153 @ElementType:
5154 swcfg21:namespaceUnawareVariant
5155
5156 ElementTypeBinding:
5157 @Name: NewIn21
5158 @ElementType:
5159 dis:Description
5160 @ShadowContent:
5161 @@lang:en
5162 @@@:
5163 {NOTE:: Introduced in SuikaWikiConfig/2.1 object model.
5164 \
5165 }
5166
5167 ElementTypeBinding:
5168 @Name: ModIn21
5169 @ElementType:
5170 dis:Description
5171 @ShadowContent:
5172 @@lang:en
5173 @@@:
5174 {NOTE:: Modified in SuikaWikiConfig/2.1 object model.
5175 \
5176 }
5177
5178 ElementTypeBinding:
5179 @Name: RaiseException
5180 @ElementType:
5181 dx:raises
5182
5183 ElementTypeBinding:
5184 @Name: XConst
5185 @ElementType:
5186 dis:ResourceDef
5187 @ShadowContent:
5188 @@rdf:type: dx|ErrorCode
5189
5190 ElementTypeBinding:
5191 @Name: XSubTypeDef
5192 @ElementType:
5193 dis:ResourceDef
5194 @ShadowContent:
5195 @@rdf:type: dx|ErrorSubCode
5196
5197 ElementTypeBinding:
5198 @Name: XParam
5199 @ElementType:
5200 ecore:hasParameter
5201
5202 ElementTypeBinding:
5203 @Name: XPropDef
5204 @ElementType:
5205 dis:ResourceDef
5206 @ShadowContent:
5207 @@rdf:type: ecore|Parameter
5208 @@For: =ManakaiDOM|all
5209
5210 ElementTypeBinding:
5211 @Name: ConstValue
5212 @ElementType:
5213 DISLang:value
5214 @ShadowContent:
5215 @@ContentType:
5216 DISCore:String
5217
5218 ElementTypeBinding:
5219 @Name: enMufDef
5220 @ElementType:
5221 ecore:defaultMessage
5222 @ShadowContent:
5223 @@ContentType:
5224 lang:muf
5225 @@lang:en

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24