1
<?xml version="1.0" encoding="iso-8859-1"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
"DTD/xhtml1-transitional.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
<title>CedarBackup2.xmlutil</title>
7
<link rel="stylesheet" href="epydoc.css" type="text/css"></link>
9
<body bgcolor="white" text="black" link="blue" vlink="#204080"
12
<!-- =========== START OF NAVBAR =========== -->
13
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
15
<th class="navbar"> <a class="navbar" href="CedarBackup2-module.html">Home</a> </th>
16
<th class="navbar"> <a class="navbar" href="trees.html">Trees</a> </th>
17
<th class="navbar"> <a class="navbar" href="indices.html">Index</a> </th>
18
<th class="navbar"> <a class="navbar" href="help.html">Help</a> </th>
19
<th class="navbar" align="right" width="100%">
20
<table border="0" cellpadding="0" cellspacing="0">
21
<tr><th class="navbar" align="center">
23
<a class="navbar" target="_top" href="http://cedar-solutions.com/software/cedar-backup">CedarBackup2</a>
24
</p></th></tr></table>
28
<table width="100%" cellpadding="0" cellspacing="0">
31
<font size="-1"><b class="breadcrumbs">
32
<a href="CedarBackup2-module.html">Package CedarBackup2</a> ::
36
<td><table cellpadding="0" cellspacing="0">
37
<tr><td align="right"><font size="-2">[<b>show private</b> | hide private]</font></td></tr>
38
<tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a> | <a href="../private/CedarBackup2.xmlutil-module.html" target="_top">no frames</a>]</font></td></tr>
42
<!-- =========== START OF MODULE DESCRIPTION =========== -->
43
<h2 class="module">Module CedarBackup2.xmlutil</h2>
45
<p>Provides general XML-related functionality.</p>
46
<p>What I'm trying to do here is abstract much of the functionality that
47
directly accesses the DOM tree. This is not so much to
48
"protect" the other code from the DOM, but to standardize the
49
way it's used. It will also help extension authors write code that easily
50
looks more like the rest of Cedar Backup.</p>
51
This module is one of the few pieces of code in the CedarBackup2
52
package that requires functionality outside of the Python 2.3 standard
53
library. It requires the PyXML package, mostly for the pretty-print
54
functionality provided there.
56
<p><b>Author:</b> Kenneth J. Pronovici <pronovic@ieee.org>
60
<!-- =========== START OF CLASSES =========== -->
61
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
62
<tr bgcolor="#70b0f0" class="summary">
63
<th colspan="2">Classes</th></tr>
65
<b><a href="../private/CedarBackup2.xmlutil.Serializer-class.html"><code>Serializer</code></a></b></td>
66
<td>XML serializer class.</td></tr>
70
<!-- =========== START OF FUNCTION SUMMARY =========== -->
71
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
72
<tr bgcolor="#70b0f0" class="summary">
73
<th colspan="2">Function Summary</th></tr>
74
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
75
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#createInputDom" class="summary-sig-name"><code>createInputDom</code></a>(<span class=summary-sig-arg>xmlData</span>,
76
<span class=summary-sig-arg>name</span>)</span></code>
78
Creates a DOM tree based on reading an XML string.</td></tr>
79
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
80
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#createOutputDom" class="summary-sig-name"><code>createOutputDom</code></a>(<span class=summary-sig-arg>name</span>)</span></code>
82
Creates a DOM tree used for writing an XML document.</td></tr>
83
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
84
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#serializeDom" class="summary-sig-name"><code>serializeDom</code></a>(<span class=summary-sig-arg>xmlDom</span>,
85
<span class=summary-sig-arg>indent</span>)</span></code>
87
Serializes a DOM tree and returns the result in a string.</td></tr>
88
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
89
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#isElement" class="summary-sig-name"><code>isElement</code></a>(<span class=summary-sig-arg>node</span>)</span></code>
91
Returns True or False depending on whether the XML node is an element
93
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
94
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#readChildren" class="summary-sig-name"><code>readChildren</code></a>(<span class=summary-sig-arg>parent</span>,
95
<span class=summary-sig-arg>name</span>)</span></code>
97
Returns a list of nodes with a given name immediately beneath the
99
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
100
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#readFirstChild" class="summary-sig-name"><code>readFirstChild</code></a>(<span class=summary-sig-arg>parent</span>,
101
<span class=summary-sig-arg>name</span>)</span></code>
103
Returns the first child with a given name immediately beneath the
105
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
106
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#readStringList" class="summary-sig-name"><code>readStringList</code></a>(<span class=summary-sig-arg>parent</span>,
107
<span class=summary-sig-arg>name</span>)</span></code>
109
Returns a list of the string contents associated with nodes with a
110
given name immediately beneath the parent.</td></tr>
111
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
112
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#readString" class="summary-sig-name"><code>readString</code></a>(<span class=summary-sig-arg>parent</span>,
113
<span class=summary-sig-arg>name</span>)</span></code>
115
Returns string contents of the first child with a given name
116
immediately beneath the parent.</td></tr>
117
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
118
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#readInteger" class="summary-sig-name"><code>readInteger</code></a>(<span class=summary-sig-arg>parent</span>,
119
<span class=summary-sig-arg>name</span>)</span></code>
121
Returns integer contents of the first child with a given name
122
immediately beneath the parent.</td></tr>
123
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
124
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#readBoolean" class="summary-sig-name"><code>readBoolean</code></a>(<span class=summary-sig-arg>parent</span>,
125
<span class=summary-sig-arg>name</span>)</span></code>
127
Returns boolean contents of the first child with a given name
128
immediately beneath the parent.</td></tr>
129
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
130
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#addContainerNode" class="summary-sig-name"><code>addContainerNode</code></a>(<span class=summary-sig-arg>xmlDom</span>,
131
<span class=summary-sig-arg>parentNode</span>,
132
<span class=summary-sig-arg>nodeName</span>)</span></code>
134
Adds a container node as the next child of a parent node.</td></tr>
135
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
136
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#addStringNode" class="summary-sig-name"><code>addStringNode</code></a>(<span class=summary-sig-arg>xmlDom</span>,
137
<span class=summary-sig-arg>parentNode</span>,
138
<span class=summary-sig-arg>nodeName</span>,
139
<span class=summary-sig-arg>nodeValue</span>)</span></code>
141
Adds a text node as the next child of a parent, to contain a
143
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
144
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#addIntegerNode" class="summary-sig-name"><code>addIntegerNode</code></a>(<span class=summary-sig-arg>xmlDom</span>,
145
<span class=summary-sig-arg>parentNode</span>,
146
<span class=summary-sig-arg>nodeName</span>,
147
<span class=summary-sig-arg>nodeValue</span>)</span></code>
149
Adds a text node as the next child of a parent, to contain an
151
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
152
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#addBooleanNode" class="summary-sig-name"><code>addBooleanNode</code></a>(<span class=summary-sig-arg>xmlDom</span>,
153
<span class=summary-sig-arg>parentNode</span>,
154
<span class=summary-sig-arg>nodeName</span>,
155
<span class=summary-sig-arg>nodeValue</span>)</span></code>
157
Adds a text node as the next child of a parent, to contain a
159
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
160
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#_encodeText" class="summary-sig-name"><code>_encodeText</code></a>(<span class=summary-sig-arg>text</span>,
161
<span class=summary-sig-arg>encoding</span>)</span></code>
163
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
164
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#_translateCDATA" class="summary-sig-name"><code>_translateCDATA</code></a>(<span class=summary-sig-arg>characters</span>,
165
<span class=summary-sig-arg>encoding</span>,
166
<span class=summary-sig-arg>prev_chars</span>,
167
<span class=summary-sig-arg>markupSafe</span>)</span></code>
169
<tr><td align="right" valign="top" width="15%"><font size="-1"> </font></td>
170
<td><code><span class="summary-sig"><a href="../private/CedarBackup2.xmlutil-module.html#_translateCDATAAttr" class="summary-sig-name"><code>_translateCDATAAttr</code></a>(<span class=summary-sig-arg>characters</span>)</span></code>
172
Handles normalization and some intelligence about quoting.</td></tr>
176
<!-- =========== START OF VARIABLE SUMMARY =========== -->
177
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
178
<tr bgcolor="#70b0f0" class="summary">
179
<th colspan="2">Variable Summary</th></tr>
180
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>list</code></font></td>
181
<td><b><a href="../private/CedarBackup2.xmlutil-module.html#TRUE_BOOLEAN_VALUES"><code>TRUE_BOOLEAN_VALUES</code></a></b>: List of boolean values in XML representing <code>True</code>.</td></tr>
182
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>list</code></font></td>
183
<td><b><a href="../private/CedarBackup2.xmlutil-module.html#FALSE_BOOLEAN_VALUES"><code>FALSE_BOOLEAN_VALUES</code></a></b>: List of boolean values in XML representing <code>False</code>.</td></tr>
184
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>list</code></font></td>
185
<td><b><a href="../private/CedarBackup2.xmlutil-module.html#VALID_BOOLEAN_VALUES"><code>VALID_BOOLEAN_VALUES</code></a></b>: List of valid boolean values in XML.</td></tr>
189
<!-- =========== START OF FUNCTION DETAILS =========== -->
190
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
191
<tr bgcolor="#70b0f0" class="details">
192
<th colspan="2">Function Details</th></tr>
195
<a name="createInputDom"></a>
196
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
197
<h3><span class="sig"><span class="sig-name">createInputDom</span>(<span class=sig-arg>xmlData</span>,
198
<span class=sig-arg>name</span>=<span class=sig-default>'cb_config'</span>)</span>
200
Creates a DOM tree based on reading an XML string.
202
<dl><dt><b>Parameters:</b></dt>
203
<dd><code><b>name</b></code> -
204
Assumed base name of the document (root node name).
207
<dl><dt><b>Returns:</b></dt>
209
Tuple (xmlDom, parentNode) for the parsed document
212
<dl><dt><b>Raises:</b></dt>
213
<dd><code><b>ValueError</b></code> -
214
If the document can't be parsed.
219
<a name="createOutputDom"></a>
220
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
221
<h3><span class="sig"><span class="sig-name">createOutputDom</span>(<span class=sig-arg>name</span>=<span class=sig-default>'cb_config'</span>)</span>
223
Creates a DOM tree used for writing an XML document.
225
<dl><dt><b>Parameters:</b></dt>
226
<dd><code><b>name</b></code> -
227
Base name of the document (root node name).
230
<dl><dt><b>Returns:</b></dt>
232
Tuple (xmlDom, parentNode) for the new document
238
<a name="serializeDom"></a>
239
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
240
<h3><span class="sig"><span class="sig-name">serializeDom</span>(<span class=sig-arg>xmlDom</span>,
241
<span class=sig-arg>indent</span>=<span class=sig-default>3</span>)</span>
243
Serializes a DOM tree and returns the result in a string.
245
<dl><dt><b>Parameters:</b></dt>
246
<dd><code><b>xmlDom</b></code> -
247
XML DOM tree to serialize
248
<dd><code><b>indent</b></code> -
249
Number of spaces to indent, as an integer
252
<dl><dt><b>Returns:</b></dt>
254
String form of DOM tree, pretty-printed.
260
<a name="isElement"></a>
261
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
262
<h3><span class="sig"><span class="sig-name">isElement</span>(<span class=sig-arg>node</span>)</span>
264
Returns True or False depending on whether the XML node is an
270
<a name="readChildren"></a>
271
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
272
<h3><span class="sig"><span class="sig-name">readChildren</span>(<span class=sig-arg>parent</span>,
273
<span class=sig-arg>name</span>)</span>
275
<p>Returns a list of nodes with a given name immediately beneath the
277
<p>By "immediately beneath" the parent, we mean from among
278
nodes that are direct children of the passed-in parent node.</p>
279
Underneath, we use the Python <code>getElementsByTagName</code>
280
method, which is pretty cool, but which (surprisingly?) returns a list
281
of all children with a given name below the parent, at any level. We
282
just prune that list to include only children whose
283
<code>parentNode</code> matches the passed-in parent.
285
<dl><dt><b>Parameters:</b></dt>
286
<dd><code><b>parent</b></code> -
287
Parent node to search beneath.
288
<dd><code><b>name</b></code> -
289
Name of nodes to search for.
292
<dl><dt><b>Returns:</b></dt>
294
List of child nodes with correct parent, or an empty list if
295
no matching nodes are found.
301
<a name="readFirstChild"></a>
302
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
303
<h3><span class="sig"><span class="sig-name">readFirstChild</span>(<span class=sig-arg>parent</span>,
304
<span class=sig-arg>name</span>)</span>
306
<p>Returns the first child with a given name immediately beneath the
308
By "immediately beneath" the parent, we mean from among
309
nodes that are direct children of the passed-in parent node.
311
<dl><dt><b>Parameters:</b></dt>
312
<dd><code><b>parent</b></code> -
313
Parent node to search beneath.
314
<dd><code><b>name</b></code> -
315
Name of node to search for.
318
<dl><dt><b>Returns:</b></dt>
320
First properly-named child of parent, or <code>None</code> if
321
no matching nodes are found.
327
<a name="readStringList"></a>
328
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
329
<h3><span class="sig"><span class="sig-name">readStringList</span>(<span class=sig-arg>parent</span>,
330
<span class=sig-arg>name</span>)</span>
332
<p>Returns a list of the string contents associated with nodes with a
333
given name immediately beneath the parent.</p>
334
<p>By "immediately beneath" the parent, we mean from among
335
nodes that are direct children of the passed-in parent node.</p>
336
First, we find all of the nodes using <a
337
href="../private/CedarBackup2.xmlutil-module.html#readChildren"
338
class="link"><code>readChildren</code></a>, and then we retrieve the
339
"string contents" of each of those nodes. The returned list
340
has one entry per matching node. We assume that string contents of a
341
given node belong to the first <code>TEXT_NODE</code> child of that
342
node. Nodes which have no <code>TEXT_NODE</code> children are not
343
represented in the returned list.
345
<dl><dt><b>Parameters:</b></dt>
346
<dd><code><b>parent</b></code> -
347
Parent node to search beneath.
348
<dd><code><b>name</b></code> -
349
Name of node to search for.
352
<dl><dt><b>Returns:</b></dt>
354
List of strings as described above, or <code>None</code> if no
355
matching nodes are found.
361
<a name="readString"></a>
362
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
363
<h3><span class="sig"><span class="sig-name">readString</span>(<span class=sig-arg>parent</span>,
364
<span class=sig-arg>name</span>)</span>
366
<p>Returns string contents of the first child with a given name
367
immediately beneath the parent.</p>
368
By "immediately beneath" the parent, we mean from among
369
nodes that are direct children of the passed-in parent node. We assume
370
that string contents of a given node belong to the first
371
<code>TEXT_NODE</code> child of that node.
373
<dl><dt><b>Parameters:</b></dt>
374
<dd><code><b>parent</b></code> -
375
Parent node to search beneath.
376
<dd><code><b>name</b></code> -
377
Name of node to search for.
380
<dl><dt><b>Returns:</b></dt>
382
String contents of node or <code>None</code> if no matching
389
<a name="readInteger"></a>
390
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
391
<h3><span class="sig"><span class="sig-name">readInteger</span>(<span class=sig-arg>parent</span>,
392
<span class=sig-arg>name</span>)</span>
394
<p>Returns integer contents of the first child with a given name
395
immediately beneath the parent.</p>
396
By "immediately beneath" the parent, we mean from among
397
nodes that are direct children of the passed-in parent node.
399
<dl><dt><b>Parameters:</b></dt>
400
<dd><code><b>parent</b></code> -
401
Parent node to search beneath.
402
<dd><code><b>name</b></code> -
403
Name of node to search for.
406
<dl><dt><b>Returns:</b></dt>
408
Integer contents of node or <code>None</code> if no matching
412
<dl><dt><b>Raises:</b></dt>
413
<dd><code><b>ValueError</b></code> -
414
If the string at the location can't be converted to an
420
<a name="readBoolean"></a>
421
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
422
<h3><span class="sig"><span class="sig-name">readBoolean</span>(<span class=sig-arg>parent</span>,
423
<span class=sig-arg>name</span>)</span>
425
<p>Returns boolean contents of the first child with a given name
426
immediately beneath the parent.</p>
427
<p>By "immediately beneath" the parent, we mean from among
428
nodes that are direct children of the passed-in parent node.</p>
429
The string value of the node must be one of the values in <a
430
href="../private/CedarBackup2.xmlutil-module.html#VALID_BOOLEAN_VALUES"
431
class="link"><code>VALID_BOOLEAN_VALUES</code></a>.
433
<dl><dt><b>Parameters:</b></dt>
434
<dd><code><b>parent</b></code> -
435
Parent node to search beneath.
436
<dd><code><b>name</b></code> -
437
Name of node to search for.
440
<dl><dt><b>Returns:</b></dt>
442
Boolean contents of node or <code>None</code> if no matching
446
<dl><dt><b>Raises:</b></dt>
447
<dd><code><b>ValueError</b></code> -
448
If the string at the location can't be converted to a
454
<a name="addContainerNode"></a>
455
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
456
<h3><span class="sig"><span class="sig-name">addContainerNode</span>(<span class=sig-arg>xmlDom</span>,
457
<span class=sig-arg>parentNode</span>,
458
<span class=sig-arg>nodeName</span>)</span>
460
Adds a container node as the next child of a parent node.
462
<dl><dt><b>Parameters:</b></dt>
463
<dd><code><b>xmlDom</b></code> -
464
DOM tree as from <code>impl.createDocument()</code>.
465
<dd><code><b>parentNode</b></code> -
466
Parent node to create child for.
467
<dd><code><b>nodeName</b></code> -
468
Name of the new container node.
471
<dl><dt><b>Returns:</b></dt>
473
Reference to the newly-created node.
479
<a name="addStringNode"></a>
480
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
481
<h3><span class="sig"><span class="sig-name">addStringNode</span>(<span class=sig-arg>xmlDom</span>,
482
<span class=sig-arg>parentNode</span>,
483
<span class=sig-arg>nodeName</span>,
484
<span class=sig-arg>nodeValue</span>)</span>
486
<p>Adds a text node as the next child of a parent, to contain a
488
If the <code>nodeValue</code> is None, then the node will be
489
created, but will be empty (i.e. will contain no text node child).
491
<dl><dt><b>Parameters:</b></dt>
492
<dd><code><b>xmlDom</b></code> -
493
DOM tree as from <code>impl.createDocument()</code>.
494
<dd><code><b>parentNode</b></code> -
495
Parent node to create child for.
496
<dd><code><b>nodeName</b></code> -
497
Name of the new container node.
498
<dd><code><b>nodeValue</b></code> -
499
The value to put into the node.
502
<dl><dt><b>Returns:</b></dt>
504
Reference to the newly-created node.
510
<a name="addIntegerNode"></a>
511
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
512
<h3><span class="sig"><span class="sig-name">addIntegerNode</span>(<span class=sig-arg>xmlDom</span>,
513
<span class=sig-arg>parentNode</span>,
514
<span class=sig-arg>nodeName</span>,
515
<span class=sig-arg>nodeValue</span>)</span>
517
<p>Adds a text node as the next child of a parent, to contain an
519
<p>If the <code>nodeValue</code> is None, then the node will be
520
created, but will be empty (i.e. will contain no text node child).</p>
521
The integer will be converted to a string using "%d". The
522
result will be added to the document via <a
523
href="../private/CedarBackup2.xmlutil-module.html#addStringNode"
524
class="link"><code>addStringNode</code></a>.
526
<dl><dt><b>Parameters:</b></dt>
527
<dd><code><b>xmlDom</b></code> -
528
DOM tree as from <code>impl.createDocument()</code>.
529
<dd><code><b>parentNode</b></code> -
530
Parent node to create child for.
531
<dd><code><b>nodeName</b></code> -
532
Name of the new container node.
533
<dd><code><b>nodeValue</b></code> -
534
The value to put into the node.
537
<dl><dt><b>Returns:</b></dt>
539
Reference to the newly-created node.
545
<a name="addBooleanNode"></a>
546
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
547
<h3><span class="sig"><span class="sig-name">addBooleanNode</span>(<span class=sig-arg>xmlDom</span>,
548
<span class=sig-arg>parentNode</span>,
549
<span class=sig-arg>nodeName</span>,
550
<span class=sig-arg>nodeValue</span>)</span>
552
<p>Adds a text node as the next child of a parent, to contain a
554
<p>If the <code>nodeValue</code> is None, then the node will be
555
created, but will be empty (i.e. will contain no text node child).</p>
556
Boolean <code>True</code>, or anything else interpreted as
557
<code>True</code> by Python, will be converted to a string
558
"Y". Anything else will be converted to a string
559
"N". The result is added to the document via <a
560
href="../private/CedarBackup2.xmlutil-module.html#addStringNode"
561
class="link"><code>addStringNode</code></a>.
563
<dl><dt><b>Parameters:</b></dt>
564
<dd><code><b>xmlDom</b></code> -
565
DOM tree as from <code>impl.createDocument()</code>.
566
<dd><code><b>parentNode</b></code> -
567
Parent node to create child for.
568
<dd><code><b>nodeName</b></code> -
569
Name of the new container node.
570
<dd><code><b>nodeValue</b></code> -
571
The value to put into the node.
574
<dl><dt><b>Returns:</b></dt>
576
Reference to the newly-created node.
582
<a name="_encodeText"></a>
583
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
584
<h3><span class="sig"><span class="sig-name">_encodeText</span>(<span class=sig-arg>text</span>,
585
<span class=sig-arg>encoding</span>)</span>
588
<p><b>Copyright:</b> This code, prior to customization, was part of the PyXML codebase, and
589
before that was part of the 4DOM suite developed by Fourthought, Inc. It
590
its original form, it was attributed to Martin v. L�wis and was Copyright
591
(c) 2000 Fourthought Inc, USA; All Rights Reserved.
597
<a name="_translateCDATA"></a>
598
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
599
<h3><span class="sig"><span class="sig-name">_translateCDATA</span>(<span class=sig-arg>characters</span>,
600
<span class=sig-arg>encoding</span>=<span class=sig-default>'UTF-8'</span>,
601
<span class=sig-arg>prev_chars</span>=<span class=sig-default>''</span>,
602
<span class=sig-arg>markupSafe</span>=<span class=sig-default>0</span>)</span>
605
<p><b>Copyright:</b> This code, prior to customization, was part of the PyXML codebase, and
606
before that was part of the 4DOM suite developed by Fourthought, Inc. It
607
its original form, it was Copyright (c) 2000 Fourthought Inc, USA; All
614
<a name="_translateCDATAAttr"></a>
615
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
616
<h3><span class="sig"><span class="sig-name">_translateCDATAAttr</span>(<span class=sig-arg>characters</span>)</span>
618
Handles normalization and some intelligence about quoting.
620
<p><b>Copyright:</b> This code, prior to customization, was part of the PyXML codebase, and
621
before that was part of the 4DOM suite developed by Fourthought, Inc. It
622
its original form, it was Copyright (c) 2000 Fourthought Inc, USA; All
631
<!-- =========== START OF VARIABLE DETAILS =========== -->
632
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
633
<tr bgcolor="#70b0f0" class="details">
634
<th colspan="2">Variable Details</th></tr>
636
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
637
<a name="TRUE_BOOLEAN_VALUES"></a>
638
<h3>TRUE_BOOLEAN_VALUES</h3>
639
List of boolean values in XML representing <code>True</code>.
644
<dt><b>Type:</b></dt>
649
<span title="['Y', 'y']"> <dt><b>Value:</b></dt>
651
<pre class="variable">
653
</td></tr></table></dd>
656
</dl></td></tr></table>
657
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
658
<a name="FALSE_BOOLEAN_VALUES"></a>
659
<h3>FALSE_BOOLEAN_VALUES</h3>
660
List of boolean values in XML representing <code>False</code>.
665
<dt><b>Type:</b></dt>
670
<span title="['N', 'n']"> <dt><b>Value:</b></dt>
672
<pre class="variable">
674
</td></tr></table></dd>
677
</dl></td></tr></table>
678
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
679
<a name="VALID_BOOLEAN_VALUES"></a>
680
<h3>VALID_BOOLEAN_VALUES</h3>
681
List of valid boolean values in XML.
686
<dt><b>Type:</b></dt>
691
<span title="['Y', 'y', 'N', 'n']"> <dt><b>Value:</b></dt>
693
<pre class="variable">
694
['Y', 'y', 'N', 'n'] </pre>
695
</td></tr></table></dd>
698
</dl></td></tr></table>
702
<!-- =========== START OF NAVBAR =========== -->
703
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
705
<th class="navbar"> <a class="navbar" href="CedarBackup2-module.html">Home</a> </th>
706
<th class="navbar"> <a class="navbar" href="trees.html">Trees</a> </th>
707
<th class="navbar"> <a class="navbar" href="indices.html">Index</a> </th>
708
<th class="navbar"> <a class="navbar" href="help.html">Help</a> </th>
709
<th class="navbar" align="right" width="100%">
710
<table border="0" cellpadding="0" cellspacing="0">
711
<tr><th class="navbar" align="center">
713
<a class="navbar" target="_top" href="http://cedar-solutions.com/software/cedar-backup">CedarBackup2</a>
714
</p></th></tr></table>
719
<table border="0" cellpadding="0" cellspacing="0" width="100%">
721
<td align="left"><font size="-2">Generated by Epydoc 2.1 on Tue Dec 13 16:00:22 2005</font></td>
722
<td align="right"><a href="http://epydoc.sourceforge.net"
723
><font size="-2">http://epydoc.sf.net</font></a></td>