roxml 1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/classes/ROXML.html +374 -0
- data/doc/classes/ROXML.src/M000003.html +19 -0
- data/doc/classes/ROXML.src/M000004.html +25 -0
- data/doc/classes/ROXML.src/M000005.html +22 -0
- data/doc/classes/ROXML/ROXML_Class.html +429 -0
- data/doc/classes/ROXML/ROXML_Class.src/M000006.html +27 -0
- data/doc/classes/ROXML/ROXML_Class.src/M000007.html +18 -0
- data/doc/classes/ROXML/ROXML_Class.src/M000008.html +19 -0
- data/doc/classes/ROXML/ROXML_Class.src/M000009.html +25 -0
- data/doc/classes/ROXML/ROXML_Class.src/M000010.html +24 -0
- data/doc/classes/ROXML/ROXML_Class.src/M000011.html +18 -0
- data/doc/classes/ROXML/ROXML_Class.src/M000012.html +18 -0
- data/doc/classes/ROXML/XMLAttributeRef.html +175 -0
- data/doc/classes/ROXML/XMLAttributeRef.src/M000015.html +19 -0
- data/doc/classes/ROXML/XMLAttributeRef.src/M000016.html +19 -0
- data/doc/classes/ROXML/XMLObjectRef.html +175 -0
- data/doc/classes/ROXML/XMLObjectRef.src/M000013.html +26 -0
- data/doc/classes/ROXML/XMLObjectRef.src/M000014.html +32 -0
- data/doc/classes/ROXML/XMLRef.html +166 -0
- data/doc/classes/ROXML/XMLRef.src/M000017.html +21 -0
- data/doc/classes/ROXML/XMLTextRef.html +198 -0
- data/doc/classes/ROXML/XMLTextRef.src/M000018.html +28 -0
- data/doc/classes/ROXML/XMLTextRef.src/M000019.html +34 -0
- data/doc/classes/String.html +165 -0
- data/doc/classes/String.src/M000001.html +23 -0
- data/doc/classes/String.src/M000002.html +23 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/roxml_rb.html +234 -0
- data/doc/fr_class_index.html +33 -0
- data/doc/fr_file_index.html +27 -0
- data/doc/fr_method_index.html +45 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/roxml.rb +1 -1
- data/test/fixtures/person.xml +1 -0
- data/test/mocks/mocks.rb +4 -0
- data/test/test_roxml.rb +9 -1
- metadata +54 -12
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>update_xml (ROXML::XMLObjectRef)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/roxml.rb, line 195</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_xml</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">value</span>)
|
15
|
+
<span class="ruby-identifier">parent</span> = (<span class="ruby-identifier">wrapper</span> <span class="ruby-value">? </span><span class="ruby-identifier">xml</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-identifier">wrapper</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">xml</span>)
|
16
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">array</span>
|
17
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_xml</span>)
|
18
|
+
<span class="ruby-keyword kw">else</span>
|
19
|
+
<span class="ruby-identifier">value</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
20
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_xml</span>)
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
<span class="ruby-keyword kw">end</span>
|
23
|
+
<span class="ruby-identifier">xml</span>
|
24
|
+
<span class="ruby-keyword kw">end</span></pre>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>populate (ROXML::XMLObjectRef)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/roxml.rb, line 209</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">populate</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">instance</span>)
|
15
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-keyword kw">nil</span>
|
16
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">array</span>
|
17
|
+
<span class="ruby-identifier">child</span> = <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">elements</span>[<span class="ruby-value">1</span>, <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">tag_name</span>]
|
18
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">child</span>
|
19
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">child</span>)
|
20
|
+
<span class="ruby-keyword kw">end</span>
|
21
|
+
<span class="ruby-keyword kw">else</span>
|
22
|
+
<span class="ruby-identifier">xpath</span> = (<span class="ruby-identifier">wrapper</span> <span class="ruby-value">? </span><span class="ruby-node">"#{wrapper}/#{klass.tag_name}"</span> <span class="ruby-operator">:</span> <span class="ruby-node">"#{klass.tag_name}"</span>)
|
23
|
+
<span class="ruby-identifier">data</span> = []
|
24
|
+
<span class="ruby-identifier">xml</span>.<span class="ruby-identifier">each_element</span>(<span class="ruby-identifier">xpath</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
25
|
+
<span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">e</span>)
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
<span class="ruby-keyword kw">end</span>
|
28
|
+
<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{accessor}"</span>, <span class="ruby-identifier">data</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">data</span>
|
29
|
+
<span class="ruby-identifier">instance</span>
|
30
|
+
<span class="ruby-keyword kw">end</span></pre>
|
31
|
+
</body>
|
32
|
+
</html>
|
@@ -0,0 +1,166 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: ROXML::XMLRef</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">ROXML::XMLRef</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/roxml_rb.html">
|
59
|
+
lib/roxml.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
Internal base class that represents an XML - Class binding.
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000017">new</a>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if includes -->
|
103
|
+
|
104
|
+
<div id="section">
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<div id="attribute-list">
|
111
|
+
<h3 class="section-bar">Attributes</h3>
|
112
|
+
|
113
|
+
<div class="name-list">
|
114
|
+
<table>
|
115
|
+
<tr class="top-aligned-row context-row">
|
116
|
+
<td class="context-item-name">accessor</td>
|
117
|
+
<td class="context-item-value"> [RW] </td>
|
118
|
+
<td class="context-item-desc"></td>
|
119
|
+
</tr>
|
120
|
+
<tr class="top-aligned-row context-row">
|
121
|
+
<td class="context-item-name">array</td>
|
122
|
+
<td class="context-item-value"> [RW] </td>
|
123
|
+
<td class="context-item-desc"></td>
|
124
|
+
</tr>
|
125
|
+
<tr class="top-aligned-row context-row">
|
126
|
+
<td class="context-item-name">name</td>
|
127
|
+
<td class="context-item-value"> [RW] </td>
|
128
|
+
<td class="context-item-desc"></td>
|
129
|
+
</tr>
|
130
|
+
</table>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
<!-- if method_list -->
|
137
|
+
<div id="methods">
|
138
|
+
<h3 class="section-bar">Public Class methods</h3>
|
139
|
+
|
140
|
+
<div id="method-M000017" class="method-detail">
|
141
|
+
<a name="M000017"></a>
|
142
|
+
|
143
|
+
<div class="method-heading">
|
144
|
+
<a href="XMLRef.src/M000017.html" target="Code" class="method-signature"
|
145
|
+
onclick="popupCode('XMLRef.src/M000017.html');return false;">
|
146
|
+
<span class="method-name">new</span><span class="method-args">(accessor, name = nil) {|self if block_given?| ...}</span>
|
147
|
+
</a>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
<div class="method-description">
|
151
|
+
</div>
|
152
|
+
</div>
|
153
|
+
|
154
|
+
|
155
|
+
</div>
|
156
|
+
|
157
|
+
|
158
|
+
</div>
|
159
|
+
|
160
|
+
|
161
|
+
<div id="validator-badges">
|
162
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
</body>
|
166
|
+
</html>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (ROXML::XMLRef)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/roxml.rb, line 112</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">accessor</span>, <span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">nil</span>)
|
15
|
+
<span class="ruby-ivar">@accessor</span> = <span class="ruby-identifier">accessor</span>
|
16
|
+
<span class="ruby-ivar">@name</span> = (<span class="ruby-identifier">name</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">accessor</span>.<span class="ruby-identifier">id2name</span>)
|
17
|
+
<span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
18
|
+
<span class="ruby-ivar">@array</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@array</span>
|
19
|
+
<span class="ruby-keyword kw">end</span></pre>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -0,0 +1,198 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: ROXML::XMLTextRef</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">ROXML::XMLTextRef</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/roxml_rb.html">
|
59
|
+
lib/roxml.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="XMLRef.html">
|
69
|
+
XMLRef
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
Interal class representing XML content text binding
|
86
|
+
</p>
|
87
|
+
<p>
|
88
|
+
In context:
|
89
|
+
</p>
|
90
|
+
<pre>
|
91
|
+
<element attribute="XMLAttributeRef">
|
92
|
+
XMLTextRef
|
93
|
+
</element>
|
94
|
+
</pre>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<div id="method-list">
|
102
|
+
<h3 class="section-bar">Methods</h3>
|
103
|
+
|
104
|
+
<div class="name-list">
|
105
|
+
<a href="#M000019">populate</a>
|
106
|
+
<a href="#M000018">update_xml</a>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
</div>
|
111
|
+
|
112
|
+
|
113
|
+
<!-- if includes -->
|
114
|
+
|
115
|
+
<div id="section">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<div id="attribute-list">
|
122
|
+
<h3 class="section-bar">Attributes</h3>
|
123
|
+
|
124
|
+
<div class="name-list">
|
125
|
+
<table>
|
126
|
+
<tr class="top-aligned-row context-row">
|
127
|
+
<td class="context-item-name">cdata</td>
|
128
|
+
<td class="context-item-value"> [RW] </td>
|
129
|
+
<td class="context-item-desc"></td>
|
130
|
+
</tr>
|
131
|
+
<tr class="top-aligned-row context-row">
|
132
|
+
<td class="context-item-name">text_content</td>
|
133
|
+
<td class="context-item-value"> [RW] </td>
|
134
|
+
<td class="context-item-desc"></td>
|
135
|
+
</tr>
|
136
|
+
<tr class="top-aligned-row context-row">
|
137
|
+
<td class="context-item-name">wrapper</td>
|
138
|
+
<td class="context-item-value"> [RW] </td>
|
139
|
+
<td class="context-item-desc"></td>
|
140
|
+
</tr>
|
141
|
+
</table>
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<!-- if method_list -->
|
148
|
+
<div id="methods">
|
149
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
150
|
+
|
151
|
+
<div id="method-M000019" class="method-detail">
|
152
|
+
<a name="M000019"></a>
|
153
|
+
|
154
|
+
<div class="method-heading">
|
155
|
+
<a href="XMLTextRef.src/M000019.html" target="Code" class="method-signature"
|
156
|
+
onclick="popupCode('XMLTextRef.src/M000019.html');return false;">
|
157
|
+
<span class="method-name">populate</span><span class="method-args">(xml, instance)</span>
|
158
|
+
</a>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="method-description">
|
162
|
+
<p>
|
163
|
+
Reads data from the XML element and populates the text accordingly.
|
164
|
+
</p>
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div id="method-M000018" class="method-detail">
|
169
|
+
<a name="M000018"></a>
|
170
|
+
|
171
|
+
<div class="method-heading">
|
172
|
+
<a href="XMLTextRef.src/M000018.html" target="Code" class="method-signature"
|
173
|
+
onclick="popupCode('XMLTextRef.src/M000018.html');return false;">
|
174
|
+
<span class="method-name">update_xml</span><span class="method-args">(xml, value)</span>
|
175
|
+
</a>
|
176
|
+
</div>
|
177
|
+
|
178
|
+
<div class="method-description">
|
179
|
+
<p>
|
180
|
+
Updates the text in the given <em>xml</em> block to the <em>value</em>
|
181
|
+
provided.
|
182
|
+
</p>
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
|
190
|
+
</div>
|
191
|
+
|
192
|
+
|
193
|
+
<div id="validator-badges">
|
194
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
</body>
|
198
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>update_xml (ROXML::XMLTextRef)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/roxml.rb, line 153</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_xml</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-identifier">value</span>)
|
15
|
+
<span class="ruby-identifier">parent</span> = (<span class="ruby-identifier">wrapper</span> <span class="ruby-value">? </span><span class="ruby-identifier">xml</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-identifier">wrapper</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">xml</span>)
|
16
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text_content</span>
|
17
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">text</span> = (<span class="ruby-identifier">cdata</span> <span class="ruby-value">? </span><span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">CData</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_utf</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_utf</span>)
|
18
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">array</span>
|
19
|
+
<span class="ruby-identifier">value</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
20
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-identifier">name</span>).<span class="ruby-identifier">text</span> = (<span class="ruby-identifier">cdata</span> <span class="ruby-value">? </span><span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">CData</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_utf</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_utf</span>)
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
<span class="ruby-keyword kw">else</span>
|
23
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-identifier">name</span>).<span class="ruby-identifier">text</span> = (<span class="ruby-identifier">cdata</span> <span class="ruby-value">? </span><span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">CData</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_utf</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_utf</span>)
|
24
|
+
<span class="ruby-keyword kw">end</span>
|
25
|
+
<span class="ruby-identifier">xml</span>
|
26
|
+
<span class="ruby-keyword kw">end</span></pre>
|
27
|
+
</body>
|
28
|
+
</html>
|