1 |
wakaba |
1.1 |
Module: |
2 |
|
|
@QName: |
3 |
|
|
Util:DIS |
4 |
|
|
@FullName: |
5 |
|
|
@@lang: en |
6 |
|
|
@@@: |
7 |
|
|
<QUOTE::DIS> Object Model |
8 |
|
|
@Namespace: |
9 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS# |
10 |
|
|
|
11 |
|
|
@Description: |
12 |
|
|
@@lang:en |
13 |
|
|
@@@: |
14 |
|
|
This module provides an object model for <QUITE::dis> document format. |
15 |
|
|
|
16 |
|
|
@Author: |
17 |
|
|
@@FullName: Wakaba |
18 |
|
|
@@Mail: w@suika.fam.cx |
19 |
|
|
@License: |
20 |
|
|
@@@: |
21 |
|
|
license:Perl+MPL |
22 |
|
|
@@Original: |
23 |
|
|
@@@FullName: |
24 |
|
|
manakai <CODE::lib/manakai/dis.pl> |
25 |
|
|
@@@Year:2004 |
26 |
|
|
@@@Author: |
27 |
|
|
@@@@FullName:Wakaba |
28 |
|
|
@@@@Mail:w@suika.fam.cx |
29 |
|
|
@Date: |
30 |
|
|
@@@: |
31 |
|
|
$Date: 2005/02/20 12:28:07 $ |
32 |
|
|
@@ContentType: |
33 |
|
|
dis:Date.RCS |
34 |
|
|
|
35 |
|
|
@Require: |
36 |
|
|
@@Module: |
37 |
|
|
@@@Name: SuikaWikiConfig21 |
38 |
|
|
@@@WithFor: |
39 |
|
|
ManakaiDOM:Perl |
40 |
|
|
@defaultFor: ForLatest |
41 |
|
|
|
42 |
|
|
Namespace: |
43 |
|
|
@DIS: |
44 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS# |
45 |
|
|
@dis: |
46 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis-- |
47 |
|
|
@dis2pm: |
48 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/11/8/dis2pm# |
49 |
|
|
@lang: |
50 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/lang# |
51 |
|
|
@license: |
52 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/license# |
53 |
|
|
@ManakaiDOM: |
54 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom# |
55 |
|
|
@owl: |
56 |
|
|
http://www.w3.org/2002/07/owl# |
57 |
|
|
@Perl: |
58 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#Perl-- |
59 |
|
|
@rdf: |
60 |
|
|
http://www.w3.org/1999/02/22-rdf-syntax-ns# |
61 |
|
|
@rdfs: |
62 |
|
|
http://www.w3.org/2000/01/rdf-schema# |
63 |
|
|
@TreeCore:\ |
64 |
|
|
@Util: |
65 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/ |
66 |
|
|
|
67 |
|
|
## -- "For" definitions |
68 |
|
|
|
69 |
|
|
ForDef: |
70 |
|
|
@QName: |
71 |
|
|
DIS:ForLatest |
72 |
|
|
@Description: |
73 |
|
|
@@lang:en |
74 |
|
|
@@@: |
75 |
|
|
For latest version of the <Module::Util:DIS> module implementation |
76 |
|
|
@ISA: |
77 |
|
|
ManakaiDOM:Perl |
78 |
|
|
|
79 |
|
|
## -- Features |
80 |
|
|
|
81 |
|
|
ElementTypeBinding: |
82 |
|
|
@Name: FeatureDef |
83 |
|
|
@ElementType: |
84 |
|
|
dis:ResourceDef |
85 |
|
|
@ShadowContent: |
86 |
|
|
@@rdf:type: |
87 |
|
|
DOMMain:DOMFeature |
88 |
|
|
@@AliasFor: |
89 |
|
|
@@@@: |
90 |
|
|
::ManakaiDOM:all |
91 |
|
|
@@@For: |
92 |
|
|
!=ManakaiDOM:all |
93 |
|
|
|
94 |
|
|
ElementTypeBinding: |
95 |
|
|
@Name: FeatureVerDef |
96 |
|
|
@ElementType: |
97 |
|
|
dis:ResourceDef |
98 |
|
|
@ShadowContent: |
99 |
|
|
@@rdf:type: |
100 |
|
|
DOMMain:DOMFeature |
101 |
|
|
|
102 |
|
|
ElementTypeBinding: |
103 |
|
|
@Name: featureQName |
104 |
|
|
@ElementType: |
105 |
|
|
dis:AppName |
106 |
|
|
@ShadowContent: |
107 |
|
|
@@ContentType: |
108 |
|
|
dis:TypeQName |
109 |
|
|
|
110 |
|
|
FeatureDef: |
111 |
|
|
@QName: Core |
112 |
|
|
@FeatureVerDef: |
113 |
|
|
@@QName: CoreFeature10 |
114 |
|
|
@@Version: 1.0 |
115 |
|
|
@@ISA: Core |
116 |
|
|
@@FullName: |
117 |
|
|
@@@lang:en |
118 |
|
|
@@@@: |
119 |
|
|
The <QUOTE::dis> object model, version 1.0 |
120 |
|
|
@@Description: |
121 |
|
|
@@@lang:en |
122 |
|
|
@@@@: |
123 |
|
|
The <QUOTE::dis> object model, version 1.0. |
124 |
|
|
@@DOMMain:requireFeature: |
125 |
|
|
swcfg21:CoreFeature21 |
126 |
|
|
|
127 |
|
|
## -- SuikaWikiConfig/2.1 extended classes |
128 |
|
|
|
129 |
|
|
ClsDef: |
130 |
|
|
@ClsQName: ManakaiDISImplementation |
131 |
|
|
@ClsISA: |
132 |
|
|
swcfg21:SWCFGImplementation |
133 |
|
|
@Description: |
134 |
|
|
@@lang:en |
135 |
|
|
@@@: |
136 |
|
|
A <QUOTE::dis> implementation object. |
137 |
|
|
|
138 |
|
|
@Method: |
139 |
|
|
@@Name: createDISDocument |
140 |
|
|
@@Description: |
141 |
|
|
@@@lang:en |
142 |
|
|
@@@@: |
143 |
|
|
Creates an empty <Class::ManakaiDISDocument> object. |
144 |
|
|
@@Return: |
145 |
|
|
@@@Type:ManakaiDISDocument |
146 |
|
|
@@@Description: |
147 |
|
|
@@@@lang:en |
148 |
|
|
@@@@@: |
149 |
|
|
The newly created <QUOTE::dis> document object. |
150 |
|
|
@@@PerlDef: |
151 |
|
|
$r = $self-><M::swcfg21:SWCFGImplementation.createSWCFGDocument>; |
152 |
|
|
$r-><AS::swcfg21:SWCFGDocument.defaultElementTypeNamespaceURI> |
153 |
|
|
(<Q::dis:>); |
154 |
|
|
|
155 |
|
|
@Method: |
156 |
|
|
@Name: createDISParser |
157 |
|
|
@Description: |
158 |
|
|
@@lang:en |
159 |
|
|
@@@: |
160 |
|
|
Creates a <Class::ManakaiDISParser> object. |
161 |
|
|
@Return: |
162 |
|
|
@@Type: ManakaiDISParser |
163 |
|
|
@@Description: |
164 |
|
|
@@@lang:en |
165 |
|
|
@@@@: |
166 |
|
|
A newly created <QUOTE::dis> parser. |
167 |
|
|
@@PerlDef: |
168 |
|
|
$r = bless $self-><M::swcfg21:SWCFGImplementation.createParser>, |
169 |
|
|
<ClassName::ManakaiDISParser>; |
170 |
|
|
|
171 |
|
|
@Method: |
172 |
|
|
@@Name: typeforurisToURI |
173 |
|
|
@@Description: |
174 |
|
|
@@@lang:en |
175 |
|
|
@@@@: |
176 |
|
|
Converts a pair of name URI reference and <QUOTE::for> URI reference |
177 |
|
|
into a <TYPE::dis:TypeForQNames>-expanded URI reference. |
178 |
|
|
@@Param: |
179 |
|
|
@@@Name: typeURI |
180 |
|
|
@@@Type: NameURI |
181 |
|
|
@@@Description: |
182 |
|
|
@@@@lang:en |
183 |
|
|
@@@@@: |
184 |
|
|
A URI reference to identify a resource. |
185 |
|
|
@@@InCase: |
186 |
|
|
@@@@Value: |
187 |
|
|
@@@@@is-null:1 |
188 |
|
|
@@@@Description: |
189 |
|
|
@@@@@lang:en |
190 |
|
|
@@@@@@: |
191 |
|
|
Equivalent to <Q::DOMMain:any> (for historical reason). |
192 |
|
|
@@Param: |
193 |
|
|
@@@Name: forURI |
194 |
|
|
@@@Type: ForURI |
195 |
|
|
@@@Description: |
196 |
|
|
@@@@lang:en |
197 |
|
|
@@@@@: |
198 |
|
|
A <QUOTE::for> URI reference. |
199 |
|
|
@@@InCase: |
200 |
|
|
@@@@Value: |
201 |
|
|
@@@@@is-null:1 |
202 |
|
|
@@@@Description: |
203 |
|
|
@@@@@lang:en |
204 |
|
|
@@@@@@: |
205 |
|
|
Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>. |
206 |
|
|
@@Return: |
207 |
|
|
@@@Type: |
208 |
|
|
DISCore:TypeForURI |
209 |
|
|
@@@Description: |
210 |
|
|
@@@@lang:en |
211 |
|
|
@@@@@: |
212 |
|
|
The <TYPE::dis:TypeForQNames>-expanded URI references. |
213 |
|
|
If it is canonicalizable, this method does canonicalize it. |
214 |
|
|
@@@PerlDef: |
215 |
|
|
$typeURI = <Q::DOMMain:any> unless defined $typeURI; |
216 |
|
|
$forURI = <Q::ManakaiDOM:all> unless defined $forURI; |
217 |
|
|
if ($forURI eq <Q::ManakaiDOM:all>) { |
218 |
|
|
## TODO: |
219 |
|
|
$r = dis_type_canon_uri ($typeURI); |
220 |
|
|
} else { |
221 |
|
|
## NOTE: [RFC 3986] |
222 |
|
|
## fragment := *(pchar / "/" / "?") |
223 |
|
|
## pchar := unreserved / pct-encoded / sub-delims / [:@] |
224 |
|
|
## unreserved := ALPHA / DIGIT / [._~-] |
225 |
|
|
## sub-delims := [!$&'()*+,;=] |
226 |
|
|
## NOTE: [XPointer Framework] |
227 |
|
|
## SchemeData := *EscapedData |
228 |
|
|
## EscapedData := NormalChar / "^(" / "^)" / "^^" |
229 |
|
|
## / "(" SchemeData ")" |
230 |
|
|
## NormalChar := UnicodeChar - [()^] |
231 |
|
|
for my $uri ($typeURI, $forURI) { |
232 |
|
|
$uri =~ s{([^0-9A-Za-z:;?=_./-])}{sprintf '%%%02X', ord $1}ge; |
233 |
|
|
} |
234 |
|
|
## TODO: |
235 |
|
|
$r = dis_type_canon_uri |
236 |
|
|
(qq<data:,200411tf#xmlns(t=data:,200411tf%23)>. |
237 |
|
|
qq<t:tf($typeURI,$forURI)>); |
238 |
|
|
} |
239 |
|
|
##DISImplementation |
240 |
|
|
|
241 |
|
|
ClsDef: |
242 |
|
|
@ClsQName: ManakaiDISParser |
243 |
|
|
@ClsISA: |
244 |
|
|
swcfg21:SWCFGParser |
245 |
|
|
@Description: |
246 |
|
|
@@lang:en |
247 |
|
|
@@@: |
248 |
|
|
A SuikaWikiConfig/2.1 parser that returns <QUOTE::dis> object. |
249 |
|
|
@Method: |
250 |
|
|
@Name: parse |
251 |
|
|
@Description: |
252 |
|
|
@@lang:en |
253 |
|
|
@@@: |
254 |
|
|
Parses a <QUOTE::dis> document and returns it as an object tree. |
255 |
|
|
@Param: |
256 |
|
|
@@Name: input |
257 |
|
|
@@Type: |
258 |
|
|
DOMLS:LSInput |
259 |
|
|
@@Description: |
260 |
|
|
@@@lang:en |
261 |
|
|
@@@@: |
262 |
|
|
The input source. |
263 |
|
|
@Return: |
264 |
|
|
@@Type: DISDocument |
265 |
|
|
@@Description: |
266 |
|
|
@@@lang:en |
267 |
|
|
@@@@: |
268 |
|
|
The <QUOTE::dis> document object created from the <P::input>. |
269 |
|
|
@@@RaiseException: |
270 |
|
|
@@@@@: |
271 |
|
|
swcfg21:SWCFG_PARSE_ERR |
272 |
|
|
@@@@Description: |
273 |
|
|
@@@@@lang:en |
274 |
|
|
@@@@@@: |
275 |
|
|
The <IF::swcfg21:SWCFGParser> was unable to load the SuikaWikiConfig |
276 |
|
|
document. |
277 |
|
|
@@@PerlDef: |
278 |
|
|
__DEEP{ |
279 |
|
|
$r = $self-><M::swcfg21:ManakaiSWCFGParser.parse> ($input); |
280 |
|
|
}__; |
281 |
|
|
if (defined $r) { |
282 |
|
|
$r = bless $r, <ClassName::ManakaiDISDocument>; |
283 |
|
|
} |
284 |
|
|
##DISParser |
285 |
|
|
|
286 |
|
|
ClsDef: |
287 |
|
|
@ClsQName: ManakaiDISNode |
288 |
|
|
@ClsISA: |
289 |
|
|
swcfg21:ManakaiSWCFGNode |
290 |
|
|
@Description: |
291 |
|
|
@@lang:en |
292 |
|
|
@@@: |
293 |
|
|
<QUOTE::dis> node objects. |
294 |
|
|
|
295 |
|
|
@MethodRedef: |
296 |
|
|
@@Name:lookupNamespacePrefix |
297 |
|
|
@@Description: |
298 |
|
|
@@@lang:en |
299 |
|
|
@@@@: |
300 |
|
|
Looks up the namespace prefix associated to the given |
301 |
|
|
namespace URI. The default namespaces are ignored. |
302 |
|
|
@@Param: |
303 |
|
|
@@@Name:namespaceURI |
304 |
|
|
@@@Type: |
305 |
|
|
swcfg21:SWCFGString |
306 |
|
|
@@@Description: |
307 |
|
|
@@@@lang:en |
308 |
|
|
@@@@@: |
309 |
|
|
The namespace URI to look for. |
310 |
|
|
@@@InCase: |
311 |
|
|
@@@@Value: |
312 |
|
|
@@@@@is-null:1 |
313 |
|
|
@@@@Description: |
314 |
|
|
@@@@@lang:en |
315 |
|
|
@@@@@@: |
316 |
|
|
The <DOM::null> namespace. |
317 |
|
|
@@NamedParam: |
318 |
|
|
@@@Name: makeNewBinding |
319 |
|
|
@@@Type: |
320 |
|
|
DOMMain:boolean |
321 |
|
|
@@@Description: |
322 |
|
|
@@@@lang:en |
323 |
|
|
@@@@@: |
324 |
|
|
Whether a new namespace prefix should be bound when |
325 |
|
|
no namespace URI has been associated yet. |
326 |
|
|
@@@InCase: |
327 |
|
|
@@@@Value:true |
328 |
|
|
@@@@Description: |
329 |
|
|
@@@@@lang:en |
330 |
|
|
@@@@@@: |
331 |
|
|
New binding is made if no prefix associated. |
332 |
|
|
@@@InCase: |
333 |
|
|
@@@@Value:false |
334 |
|
|
@@@@Description: |
335 |
|
|
@@@@@lang:en |
336 |
|
|
@@@@@@: |
337 |
|
|
Simply returns the <DOM::null> if no prefix associated. |
338 |
|
|
@@Return: |
339 |
|
|
@@@Type: |
340 |
|
|
swcfg21:SWCFGString |
341 |
|
|
@@@Description: |
342 |
|
|
@@@@lang:en |
343 |
|
|
@@@@@: |
344 |
|
|
An associated namespace prefix. If more than one prefix |
345 |
|
|
are associated to the namespace URI, the returned prefix |
346 |
|
|
is implementation dependent. |
347 |
|
|
@@@InCase: |
348 |
|
|
@@@@Value: |
349 |
|
|
@@@@@is-null:1 |
350 |
|
|
@@@@Type: |
351 |
|
|
swcfg21:SWCFGString |
352 |
|
|
@@@@Description: |
353 |
|
|
@@@@@lang:en |
354 |
|
|
@@@@@@: |
355 |
|
|
No associated namespace prefix found. |
356 |
|
|
@@@PerlDef: |
357 |
|
|
$r = null; |
358 |
|
|
my $od = $self-><AG::swcfg21:SWCFGNode.ownerDocument> || $self; |
359 |
|
|
my $binds = $od->{<Q::TreeCore:node>}->{<Q::nsBinding>}; |
360 |
|
|
if (defined $namespaceURI) { |
361 |
|
|
FIND: { |
362 |
|
|
for my $prefix (keys %$binds) { |
363 |
|
|
if (defined $binds->{$prefix} and |
364 |
|
|
$binds->{$prefix} eq $namespaceURI) { |
365 |
|
|
$r = $prefix; |
366 |
|
|
last FIND; |
367 |
|
|
} |
368 |
|
|
} |
369 |
|
|
last FIND unless $makeNewBinding; |
370 |
|
|
## Not found |
371 |
|
|
if ($namespaceURI =~ /(\w+)$/) { |
372 |
|
|
my $prefix = $1; |
373 |
|
|
unless (exists $binds->{$prefix}) { |
374 |
|
|
$binds->{$prefix} = $namespaceURI; |
375 |
|
|
$r = $prefix; |
376 |
|
|
last FIND; |
377 |
|
|
} |
378 |
|
|
} |
379 |
|
|
my $i = 1; |
380 |
|
|
{ |
381 |
|
|
unless (exists $binds->{'ns'.$i}) { |
382 |
|
|
$binds->{$r = 'ns'.$i} = $namespaceURI; |
383 |
|
|
last FIND; |
384 |
|
|
} |
385 |
|
|
$i++; |
386 |
|
|
redo; |
387 |
|
|
} |
388 |
|
|
} # FIND |
389 |
|
|
} else { ## Null namespace |
390 |
|
|
FIND: { |
391 |
|
|
if (exists $binds->{'nu'.'ll'} and not defined $binds->{'nu'.'ll'}) { |
392 |
|
|
$r = 'nu'.'ll'; |
393 |
|
|
last FIND; |
394 |
|
|
} |
395 |
|
|
for my $prefix (keys %$binds) { |
396 |
|
|
if (not defined $prefix) { |
397 |
|
|
$r = $prefix; |
398 |
|
|
last FIND; |
399 |
|
|
} |
400 |
|
|
} |
401 |
|
|
last FIND unless $makeNewBinding; |
402 |
|
|
## Not found |
403 |
|
|
my $i = ''; |
404 |
|
|
{ |
405 |
|
|
unless (exists $binds->{'nu'.'ll'.$i}) { |
406 |
|
|
$binds->{$r = 'nu'.'ll'.$i} = null; |
407 |
|
|
last FIND; |
408 |
|
|
} |
409 |
|
|
$i++; |
410 |
|
|
redo; |
411 |
|
|
} |
412 |
|
|
} |
413 |
|
|
} |
414 |
|
|
## TODO: Module ns support |
415 |
|
|
|
416 |
|
|
@MethodRedef: |
417 |
|
|
@@Name:lookupNamespaceURI |
418 |
|
|
@@Description: |
419 |
|
|
@@@lang:en |
420 |
|
|
@@@@: |
421 |
|
|
Looks up the namespace URI associated to the given prefix. |
422 |
|
|
@@Param: |
423 |
|
|
@@@Name:prefix |
424 |
|
|
@@@Type: |
425 |
|
|
swcfg21:SWCFGString |
426 |
|
|
@@@Description: |
427 |
|
|
@@@@lang:en |
428 |
|
|
@@@@@: |
429 |
|
|
The namespace URI to look for. |
430 |
|
|
@@NamedParam: |
431 |
|
|
@@@Name: makeNewBinding |
432 |
|
|
@@@Type: |
433 |
|
|
DOMMain:boolean |
434 |
|
|
@@@Description: |
435 |
|
|
@@@@lang:en |
436 |
|
|
@@@@@: |
437 |
|
|
Whether a new binding should be created if no namespace URI |
438 |
|
|
is associated with the <P::prefix> or not. |
439 |
|
|
@@@InCase: |
440 |
|
|
@@@@Value:true |
441 |
|
|
@@@@Description: |
442 |
|
|
@@@@@lang:en |
443 |
|
|
@@@@@@: |
444 |
|
|
A new binding to the temporary namespace URI |
445 |
|
|
exactly same as <P::prefix> is created |
446 |
|
|
if no binding found. |
447 |
|
|
@@@InCase: |
448 |
|
|
@@@@Value:false |
449 |
|
|
@@@@Description: |
450 |
|
|
@@@@@lang:en |
451 |
|
|
@@@@@@: |
452 |
|
|
No new binding is created if no binding found. Note that |
453 |
|
|
even if no association newly created, this method |
454 |
|
|
returns the <DOM::null> value. |
455 |
|
|
@@Return: |
456 |
|
|
@@@Type: |
457 |
|
|
swcfg21:SWCFGString |
458 |
|
|
@@@Description: |
459 |
|
|
@@@@lang:en |
460 |
|
|
@@@@@:The associated namespace URI. |
461 |
|
|
@@@InCase: |
462 |
|
|
@@@@Value: |
463 |
|
|
@@@@@is-null:1 |
464 |
|
|
@@@@Type: |
465 |
|
|
swcfg21:SWCFGString |
466 |
|
|
@@@@Description: |
467 |
|
|
@@@@@lang:en |
468 |
|
|
@@@@@@: |
469 |
|
|
No namespace prefix is associated to the prefix or |
470 |
|
|
the <DOM::null> namespace is associated. |
471 |
|
|
@@@PerlDef: |
472 |
|
|
my $od = $self-><AG::swcfg21:SWCFGNode.ownerDocument> || $self; |
473 |
|
|
my $binds = $od->{<Q::TreeCore:node>}->{<Q::nsBinding>}; |
474 |
|
|
if (exists $binds->{$prefix}) { |
475 |
|
|
$r = $binds->{$prefix}; |
476 |
|
|
} elsif ($makeNewBinding) { |
477 |
|
|
$r = $binds->{$prefix} = $prefix; |
478 |
|
|
} else { |
479 |
|
|
$r = null; |
480 |
|
|
} |
481 |
|
|
## TODO: Module ns support |
482 |
|
|
|
483 |
|
|
@IntMethod: |
484 |
|
|
@@Name:getNodeReference |
485 |
|
|
@@Description: |
486 |
|
|
@@@lang:en |
487 |
|
|
@@@@: |
488 |
|
|
Returns a new reference to the node object. |
489 |
|
|
@@ManakaiDOM:isStatic:1 |
490 |
|
|
@@Param: |
491 |
|
|
@@@Name:object |
492 |
|
|
@@@Type: |
493 |
|
|
ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl |
494 |
|
|
@@@Description: |
495 |
|
|
@@@@lang:en |
496 |
|
|
@@@@@: |
497 |
|
|
The node object to be referred. |
498 |
|
|
@@Return: |
499 |
|
|
@@@Type: ManakaiDISNode |
500 |
|
|
@@@Description: |
501 |
|
|
@@@@lang:en |
502 |
|
|
@@@@@: |
503 |
|
|
A newly created reference. |
504 |
|
|
@@@PerlDef: |
505 |
|
|
my $class; |
506 |
|
|
if ($object->{<Q::nodeType>} eq '#element') { |
507 |
|
|
$class = <ClassName::ManakaiDISElement>; |
508 |
|
|
} elsif ($object->{<Q::nodeType>} eq '#comment') { |
509 |
|
|
$class = <ClassName::ManakaiDISComment>; |
510 |
|
|
} elsif ($object->{<Q::nodeType>} eq '#document') { |
511 |
|
|
$class = <ClassName::ManakaiDISDocument>; |
512 |
|
|
} elsif ($object->{<Q::nodeType>} eq '#fragment') { |
513 |
|
|
$class = <ClassName::ManakaiDISDocumentFragment>; |
514 |
|
|
} else { |
515 |
|
|
__ASSERT{DISPerl:invariant:: |
516 |
|
|
msg => {qq[Node type: "$object->{<Q::nodeType>}" ]. |
517 |
|
|
qq[(ref: "@{[ref $object]}")]}, |
518 |
|
|
}__; |
519 |
|
|
} |
520 |
|
|
$r = $object-><M::ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl |
521 |
|
|
.newReference> ($class); |
522 |
|
|
|
523 |
|
|
##DISNode |
524 |
|
|
|
525 |
|
|
ClsDef: |
526 |
|
|
@ClsQName: ManakaiDISElement |
527 |
|
|
@ClsISA: |
528 |
|
|
swcfg21:ManakaiSWCFGElement |
529 |
|
|
@ClsISA: ManakaiDISNode |
530 |
|
|
@Description: |
531 |
|
|
@@lang:en |
532 |
|
|
@@@: |
533 |
|
|
<QUOTE::dis> element node objects. |
534 |
|
|
|
535 |
|
|
@Method: |
536 |
|
|
@@Name: forMatch |
537 |
|
|
@@Description: |
538 |
|
|
@@@lang:en |
539 |
|
|
@@@@: |
540 |
|
|
Tests whether this element is for a <QUOTE::for> or not. |
541 |
|
|
@@Param: |
542 |
|
|
@@@Name: forArg |
543 |
|
|
@@@Type: ForURI |
544 |
|
|
@@@Description: |
545 |
|
|
@@@@lang:en |
546 |
|
|
@@@@@: |
547 |
|
|
The <QUOTE::For> URI reference to test against. |
548 |
|
|
@@Param: |
549 |
|
|
@@@Name: forpArg |
550 |
|
|
@@@Type: ForURIList |
551 |
|
|
@@@Description: |
552 |
|
|
@@@@lang:en |
553 |
|
|
@@@@@: |
554 |
|
|
The <QUOTE::For+> URI references to test against. |
555 |
|
|
@@@InCase: |
556 |
|
|
@@@@Value: |
557 |
|
|
@@@@@is-null:1 |
558 |
|
|
@@@@Description: |
559 |
|
|
@@@@@lang:en |
560 |
|
|
@@@@@@: |
561 |
|
|
No additional <QUOTE::For> URI reference. |
562 |
|
|
@@Return: |
563 |
|
|
@@@Type: |
564 |
|
|
DOMMain:boolean |
565 |
|
|
@@@Description: |
566 |
|
|
@@@@lang:en |
567 |
|
|
@@@@@: |
568 |
|
|
Whether this element is for <P::forArg> and <P::forpArg> or not. |
569 |
|
|
|
570 |
|
|
@Method: |
571 |
|
|
@@Name: mediaTypeMatch |
572 |
|
|
@@Description: |
573 |
|
|
@@@lang:en |
574 |
|
|
@@@@: |
575 |
|
|
Tests whether the content media type of this element matches to |
576 |
|
|
a type or not. |
577 |
|
|
@@Param: |
578 |
|
|
@@@Name: mediaType |
579 |
|
|
@@@Type: MediaTypeURI |
580 |
|
|
@@@Description: |
581 |
|
|
@@@@lang:en |
582 |
|
|
@@@@@: |
583 |
|
|
A media type URI reference to test against. |
584 |
|
|
@@Param: |
585 |
|
|
@@@Name: mediaTypeDefault |
586 |
|
|
@@@Type: MediaTypeURI |
587 |
|
|
@@@Description: |
588 |
|
|
@@@@lang:en |
589 |
|
|
@@@@@: |
590 |
|
|
The default media type for this element. |
591 |
|
|
@@@InCase: |
592 |
|
|
@@@@Value: |
593 |
|
|
@@@@@is-null:1 |
594 |
|
|
@@@@Description: |
595 |
|
|
@@@@@lang:en |
596 |
|
|
@@@@@@: |
597 |
|
|
No default type provided. All <P::mediaType> will match. |
598 |
|
|
@@Return: |
599 |
|
|
@@@Type: |
600 |
|
|
DOMMain:boolean |
601 |
|
|
@@@Description: |
602 |
|
|
@@@@lang:en |
603 |
|
|
@@@@@: |
604 |
|
|
Whether this element is of <P::mediaType> or not. |
605 |
|
|
|
606 |
|
|
@Method: |
607 |
|
|
@@Name: prefixToURI |
608 |
|
|
@@Description: |
609 |
|
|
@@@lang:en |
610 |
|
|
@@@@: |
611 |
|
|
Converts a namespace prefix into associated URI reference. |
612 |
|
|
@@Param: |
613 |
|
|
@@@Name: prefix |
614 |
|
|
@@@Type: |
615 |
|
|
swcfg21:SWCFGString |
616 |
|
|
@@@Description: |
617 |
|
|
@@@@lang:en |
618 |
|
|
@@@@@: |
619 |
|
|
A namespace prefix to look for. |
620 |
|
|
@@@InCase: |
621 |
|
|
@@@@Value: |
622 |
|
|
@@@@@is-null:1 |
623 |
|
|
@@@@Description: |
624 |
|
|
@@@@@lang:en |
625 |
|
|
@@@@@@: |
626 |
|
|
Returns the default namespace URI. |
627 |
|
|
@@NodeParam: |
628 |
|
|
@@Return: |
629 |
|
|
@@@Type: |
630 |
|
|
swcfg21:SWCFGString |
631 |
|
|
@@@Description: |
632 |
|
|
@@@@lang:en |
633 |
|
|
@@@@@: The URI references associated. |
634 |
|
|
@@@UndeclaredPrefixException: |
635 |
|
|
@@@PerlDef: |
636 |
|
|
if (defined $param) { |
637 |
|
|
__DEEP{ |
638 |
|
|
$r = $self-><M::swcfg21:SWCFGNode.lookupNamespaceURI> ($prefix); |
639 |
|
|
}__; |
640 |
|
|
unless (defined $r) { |
641 |
|
|
__EXCEPTION{UNDECLARED_NS_PREFIX_ERR:: |
642 |
|
|
infoset:prefix => {$prefix}, |
643 |
|
|
MDOMX:param-name => 'prefix', |
644 |
|
|
DIS:sourceNode => {$node}, |
645 |
|
|
}__; |
646 |
|
|
} |
647 |
|
|
} else { |
648 |
|
|
## TODO: default namespace |
649 |
|
|
} |
650 |
|
|
|
651 |
|
|
@Method: |
652 |
|
|
@@QName: qnameToURI |
653 |
|
|
@@Description: |
654 |
|
|
@@@lang:en |
655 |
|
|
@@@@: |
656 |
|
|
Converts a qualified name (<TYPE::dis:TypeQName>) to |
657 |
|
|
an expanded URI reference. |
658 |
|
|
@@Param: |
659 |
|
|
@@@Name: qname |
660 |
|
|
@@@Type: |
661 |
|
|
dis:TypeQName |
662 |
|
|
@@@Description: |
663 |
|
|
@@@@lang:en |
664 |
|
|
@@@@@: |
665 |
|
|
A qualified name. |
666 |
|
|
@@NodeParam: |
667 |
|
|
@@Return: |
668 |
|
|
@@@Type: AnyURI |
669 |
|
|
@@@Description: |
670 |
|
|
@@@@lang:en |
671 |
|
|
@@@@@: |
672 |
|
|
The expanded URI reference. |
673 |
|
|
@@@UndeclaredPrefixException: |
674 |
|
|
@@@PerlDef: |
675 |
|
|
$qname =~ s/^\s+//; $qname =~ s/\s+$//; |
676 |
|
|
my ($prefix, $lname) = split /:/, $qname; |
677 |
|
|
__DEEP{ |
678 |
|
|
if (defined $lname) { |
679 |
|
|
$r = $self-><M::ManakaiDISElement.prefixToURI> ($prefix) . $lname; |
680 |
|
|
} else { ## In default namespace |
681 |
|
|
$r = $self-><M::ManakaiDISElement.prefixToURI> (null) . $prefix; |
682 |
|
|
} |
683 |
|
|
} |
684 |
|
|
|
685 |
|
|
@Method: |
686 |
|
|
@@QName: qnameToPair |
687 |
|
|
@@Description: |
688 |
|
|
@@@lang:en |
689 |
|
|
@@@@: |
690 |
|
|
Converts a qualified name (<TYPE::dis:TypeQName>) to |
691 |
|
|
a pair of namespace URI and local name. |
692 |
|
|
@@Param: |
693 |
|
|
@@@Name: qname |
694 |
|
|
@@@Type: |
695 |
|
|
dis:TypeQName |
696 |
|
|
@@@Description: |
697 |
|
|
@@@@lang:en |
698 |
|
|
@@@@@: |
699 |
|
|
A qualified name. |
700 |
|
|
@@NodeParam: |
701 |
|
|
@@Return: |
702 |
|
|
@@@Type: |
703 |
|
|
Perl:ARRAY |
704 |
|
|
@@@Description: |
705 |
|
|
@@@@lang:en |
706 |
|
|
@@@@@: |
707 |
|
|
A list of namespace URI and local name. |
708 |
|
|
@@@UndeclaredPrefixException: |
709 |
|
|
@@@PerlDef: |
710 |
|
|
$qname =~ s/^\s+//; $qname =~ s/\s+$//; |
711 |
|
|
my ($prefix, $lname) = split /:/, $qname; |
712 |
|
|
__DEEP{ |
713 |
|
|
if (defined $lname) { |
714 |
|
|
$r = [$self-><M::ManakaiDISElement.prefixToURI> ($prefix), $lname]; |
715 |
|
|
} else { ## In default namespace |
716 |
|
|
$r = [$self-><M::ManakaiDISElement.prefixToURI> (null), $prefix]; |
717 |
|
|
} |
718 |
|
|
} |
719 |
|
|
|
720 |
|
|
@Method: |
721 |
|
|
@@Name: typeforqnamesToURI |
722 |
|
|
@@Description: |
723 |
|
|
@@@lang:en |
724 |
|
|
@@@@: |
725 |
|
|
Converts a <TYPE::dis:TypeForQNames> |
726 |
|
|
into an expanded URI reference. |
727 |
|
|
@@Param: |
728 |
|
|
@@@Name: tfqnames |
729 |
|
|
@@@Type: |
730 |
|
|
dis:TypeForQNames |
731 |
|
|
@@@Description: |
732 |
|
|
@@@@lang:en |
733 |
|
|
@@@@@: |
734 |
|
|
A <TYPE::dis:TypeForQNames> to identify a resource. |
735 |
|
|
@@Param: |
736 |
|
|
@@@Name: defaultTypeURI |
737 |
|
|
@@@Type: NameURI |
738 |
|
|
@@@Description: |
739 |
|
|
@@@@lang:en |
740 |
|
|
@@@@@: |
741 |
|
|
A name URI reference used if it is missing from |
742 |
|
|
<P::tfqnames>. |
743 |
|
|
@@@InCase: |
744 |
|
|
@@@@Value: |
745 |
|
|
@@@@@is-null:1 |
746 |
|
|
@@@@Description: |
747 |
|
|
@@@@@lang:en |
748 |
|
|
@@@@@@: |
749 |
|
|
Equivalent to <Q::DOMMain:any>. |
750 |
|
|
@@Param: |
751 |
|
|
@@@Name: defaultForURI |
752 |
|
|
@@@Type: ForURI |
753 |
|
|
@@@Description: |
754 |
|
|
@@@@lang:en |
755 |
|
|
@@@@@: |
756 |
|
|
A <QUOTE::for> URI reference used if it is missing from |
757 |
|
|
<P::tfqnames>. |
758 |
|
|
@@@InCase: |
759 |
|
|
@@@@Value: |
760 |
|
|
@@@@@is-null:1 |
761 |
|
|
@@@@Description: |
762 |
|
|
@@@@@lang:en |
763 |
|
|
@@@@@@: |
764 |
|
|
Equivalent to <QUOTE::for all>, i.e. <Q::ManakaiDOM:all>. |
765 |
|
|
@@NodeParam: |
766 |
|
|
@@Return: |
767 |
|
|
@@@Type: |
768 |
|
|
DISCore:TypeForURI |
769 |
|
|
@@@Description: |
770 |
|
|
@@@@lang:en |
771 |
|
|
@@@@@: |
772 |
|
|
The <TYPE::dis:TypeForQNames>-expanded URI references. |
773 |
|
|
If it is canonicalizable, this method does canonicalize it. |
774 |
|
|
@@@UndeclaredPrefixException: |
775 |
|
|
@@@PerlDef: |
776 |
|
|
my ($typeq, $forq) = split /\s*::\s*/, $tfqnames, 2; |
777 |
|
|
my ($typeURI, $forURI); |
778 |
|
|
if (defined $forq) { |
779 |
|
|
__DEEP{ |
780 |
|
|
$typeURI = $typeq eq '' |
781 |
|
|
? defined $defaultTypeURI ? $defaultTypeURI |
782 |
|
|
: <Q::DOMMain:any> |
783 |
|
|
: $self-><M::ManakaiDISElement.qnameToURI> ($typeq, %opt); |
784 |
|
|
}__; |
785 |
|
|
if (length $forq) { |
786 |
|
|
$forURI = $self-><M::ManakaiDISElement.qnameToURI> ($forq, %opt); |
787 |
|
|
} else { |
788 |
|
|
$forURI = <Q::ManakaiDOM:all>; |
789 |
|
|
} |
790 |
|
|
} else { ## "For" omitted |
791 |
|
|
__DEEP{ |
792 |
|
|
$typeURI = $typeq eq '' |
793 |
|
|
? defined $defaultTypeURI ? $defaultTypeURI |
794 |
|
|
: <Q::DOMMain:any> |
795 |
|
|
: $self-><M::ManakaiDISElement.qnameToURI> ($typeq, %opt); |
796 |
|
|
}__; |
797 |
|
|
$for = defined $defaultForURI ? $defaultForURI : <Q::ManakaiDOM:all>; |
798 |
|
|
} |
799 |
|
|
__DEEP{ |
800 |
|
|
$r = $self-><AG::swcfg21:SWCFGNode.ownerDocument> |
801 |
|
|
-><AG::swcfg21:SWCFGDocument.implementation> |
802 |
|
|
-><M::DISImplementation.typeforqnamesToURI> |
803 |
|
|
($typeURI, $forURI); |
804 |
|
|
}__; |
805 |
|
|
##DISElement |
806 |
|
|
|
807 |
|
|
ClsDef: |
808 |
|
|
@ClsQName: ManakaiDISComment |
809 |
|
|
@ClsISA: |
810 |
|
|
swcfg21:ManakaiSWCFGComment |
811 |
|
|
@ClsISA: ManakaiDISNode |
812 |
|
|
@Description: |
813 |
|
|
@@lang:en |
814 |
|
|
@@@: |
815 |
|
|
<QUOTE::dis> comment node objects. |
816 |
|
|
##DISComment |
817 |
|
|
|
818 |
|
|
ClsDef: |
819 |
|
|
@ClsQName: ManakaiDISDocumentFragment |
820 |
|
|
@ClsISA: |
821 |
|
|
swcfg21:ManakaiSWCFGDocumentFragment |
822 |
|
|
@ClsISA: ManakaiDISNode |
823 |
|
|
@Description: |
824 |
|
|
@@lang:en |
825 |
|
|
@@@: |
826 |
|
|
<QUOTE::dis> document fragment node objects. |
827 |
|
|
##DISDocumentFragment |
828 |
|
|
|
829 |
|
|
ClsDef: |
830 |
|
|
@ClsQName: ManakaiDISDocument |
831 |
|
|
@ClsISA: |
832 |
|
|
swcfg21:ManakaiSWCFGDocument |
833 |
|
|
@ClsISA: ManakaiDISNode |
834 |
|
|
@Description: |
835 |
|
|
@@lang:en |
836 |
|
|
@@@: |
837 |
|
|
<QUOTE::dis> document node objects. |
838 |
|
|
##DISDocument |
839 |
|
|
|
840 |
|
|
## -- Datatypes |
841 |
|
|
|
842 |
|
|
URITypeDef: |
843 |
|
|
@QName: ForURI |
844 |
|
|
@Description: |
845 |
|
|
@@lang:en |
846 |
|
|
@@@: |
847 |
|
|
<QUOTE::For> URI references. |
848 |
|
|
|
849 |
|
|
DataTypeDef: |
850 |
|
|
@QName: ForURIList |
851 |
|
|
@Description: |
852 |
|
|
@@lang:en |
853 |
|
|
@@@: |
854 |
|
|
References to the array containing <QUOTE::for> URI references. |
855 |
|
|
|
856 |
|
|
URITypeDef: |
857 |
|
|
@QName: MediaTypeURI |
858 |
|
|
@Description: |
859 |
|
|
@@lang:en |
860 |
|
|
@@@: |
861 |
|
|
Media type URI references. |
862 |
|
|
|
863 |
|
|
## -- Exceptions |
864 |
|
|
|
865 |
|
|
XParamDef: |
866 |
|
|
@QName: sourceNode |
867 |
|
|
@Description: |
868 |
|
|
@@lang:en |
869 |
|
|
@@@: |
870 |
|
|
The node from which the string has come. |
871 |
|
|
@Type: DISNode |