yaxml 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/LICENSE +165 -0
- data/README +49 -0
- data/Rakefile +53 -0
- data/doc/rdoc/classes/YAXML.html +465 -0
- data/doc/rdoc/classes/YAXML/Yaxml.html +277 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/CHANGELOG.html +126 -0
- data/doc/rdoc/files/LICENSE.html +311 -0
- data/doc/rdoc/files/README.html +176 -0
- data/doc/rdoc/files/lib/yaxml_rb.html +170 -0
- data/doc/rdoc/fr_class_index.html +28 -0
- data/doc/rdoc/fr_file_index.html +30 -0
- data/doc/rdoc/fr_method_index.html +34 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/lib/simple_test.xml +12 -0
- data/lib/simple_test.yml +9 -0
- data/lib/yaxml.rb +354 -0
- data/test/files/simple_test.xml +12 -0
- data/test/files/simple_test.yml +9 -0
- data/test/files/test.xml +5 -0
- data/test/files/test.xml~ +5 -0
- data/test/files/test.yml +28 -0
- data/test/load_files.rb +9 -0
- data/test/test_parser.rb +98 -0
- metadata +91 -0
@@ -0,0 +1,176 @@
|
|
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>File: README</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="fileHeader">
|
50
|
+
<h1>README</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Fri Mar 27 12:02:31 +0100 2009</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<h1><a href="../classes/YAXML.html">YAXML</a> Module</h1>
|
73
|
+
<p>
|
74
|
+
This code is released under LGPL. <a href="../classes/YAXML.html">YAXML</a>
|
75
|
+
module make the next conversions:
|
76
|
+
</p>
|
77
|
+
<pre>
|
78
|
+
* YAML -> YAXML
|
79
|
+
* JSON -> YAXML
|
80
|
+
* YAXML -> YAML
|
81
|
+
* YAXML -> JSON
|
82
|
+
</pre>
|
83
|
+
<p>
|
84
|
+
All conversions can use a file or a string as source.
|
85
|
+
</p>
|
86
|
+
<p>
|
87
|
+
You can use this module in two ways:
|
88
|
+
</p>
|
89
|
+
<p>
|
90
|
+
1) Creating a Yaxml object
|
91
|
+
</p>
|
92
|
+
<pre>
|
93
|
+
xml = Yaxml.new 'file.yml'
|
94
|
+
xml.write( $stdout, 2)
|
95
|
+
xml.to_json
|
96
|
+
xml.to_yaml
|
97
|
+
</pre>
|
98
|
+
<p>
|
99
|
+
2) Using static methods of Yaxml module
|
100
|
+
</p>
|
101
|
+
<pre>
|
102
|
+
xml = Yaxml::yaml2yaxml( 'file.yml' )
|
103
|
+
xml.write( $stdout, 2)
|
104
|
+
|
105
|
+
Also, you can use:
|
106
|
+
xml = Yaxml::json2yaxml( { numbers: [ 1, 2, 3 ]} )
|
107
|
+
yaml = Yaxml::yaxml2yaml( 'file.yaxml' )
|
108
|
+
json = Yaxml::yaxml2json( 'file.yaxml' )
|
109
|
+
</pre>
|
110
|
+
<p>
|
111
|
+
<a href="../classes/YAXML.html">YAXML</a> is <b>standalone library</b>. It
|
112
|
+
requires no other libraries. Just Ruby!
|
113
|
+
</p>
|
114
|
+
<table>
|
115
|
+
<tr><td valign="top">Author:</td><td>Diego Moreno (dmoreno@dit.upm.es)
|
116
|
+
|
117
|
+
</td></tr>
|
118
|
+
<tr><td valign="top">License:</td><td>GNU Lesser General Public License (aka LGPL)
|
119
|
+
|
120
|
+
</td></tr>
|
121
|
+
</table>
|
122
|
+
<h2>Installing <a href="../classes/YAXML.html">YAXML</a></h2>
|
123
|
+
<p>
|
124
|
+
You may get the latest stable version from Rubyforge.
|
125
|
+
</p>
|
126
|
+
<pre>
|
127
|
+
$ gem install yaxml
|
128
|
+
</pre>
|
129
|
+
<h2>Loading <a href="../classes/YAXML.html">YAXML</a></h2>
|
130
|
+
<p>
|
131
|
+
You have probably got the gem, right? To load <a
|
132
|
+
href="../classes/YAXML.html">YAXML</a>:
|
133
|
+
</p>
|
134
|
+
<pre>
|
135
|
+
require 'rubygems'
|
136
|
+
require 'yaxml'
|
137
|
+
</pre>
|
138
|
+
<p>
|
139
|
+
If you‘ve installed the plain source distribution, go ahead and just:
|
140
|
+
</p>
|
141
|
+
<pre>
|
142
|
+
require 'yaxml'
|
143
|
+
</pre>
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
|
154
|
+
<!-- if includes -->
|
155
|
+
|
156
|
+
<div id="section">
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
<!-- if method_list -->
|
166
|
+
|
167
|
+
|
168
|
+
</div>
|
169
|
+
|
170
|
+
|
171
|
+
<div id="validator-badges">
|
172
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
</body>
|
176
|
+
</html>
|
@@ -0,0 +1,170 @@
|
|
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>File: yaxml.rb</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="fileHeader">
|
50
|
+
<h1>yaxml.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>lib/yaxml.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Fri Mar 27 12:02:31 +0100 2009</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<p>
|
73
|
+
<a href="../../classes/YAXML.html">YAXML</a> Module
|
74
|
+
</p>
|
75
|
+
<p>
|
76
|
+
This code is released under LGPL.
|
77
|
+
</p>
|
78
|
+
<p>
|
79
|
+
This module make the next conversions:
|
80
|
+
</p>
|
81
|
+
<ul>
|
82
|
+
<li>YAML -> <a href="../../classes/YAXML.html">YAXML</a>
|
83
|
+
|
84
|
+
</li>
|
85
|
+
<li>JSON -> <a href="../../classes/YAXML.html">YAXML</a>
|
86
|
+
|
87
|
+
</li>
|
88
|
+
<li><a href="../../classes/YAXML.html">YAXML</a> -> YAML
|
89
|
+
|
90
|
+
</li>
|
91
|
+
<li><a href="../../classes/YAXML.html">YAXML</a> -> JSON
|
92
|
+
|
93
|
+
</li>
|
94
|
+
</ul>
|
95
|
+
<p>
|
96
|
+
All conversions can use a file or a string as source.
|
97
|
+
</p>
|
98
|
+
<p>
|
99
|
+
You can use this module in two ways:
|
100
|
+
</p>
|
101
|
+
<p>
|
102
|
+
1) Creating a Yaxml object
|
103
|
+
</p>
|
104
|
+
<pre>
|
105
|
+
xml = Yaxml.new 'file.yml'
|
106
|
+
xml.write( $stdout, 2)
|
107
|
+
xml.to_json
|
108
|
+
xml.to_yaml
|
109
|
+
</pre>
|
110
|
+
<p>
|
111
|
+
2) Using static methods of Yaxml module
|
112
|
+
</p>
|
113
|
+
<pre>
|
114
|
+
xml = Yaxml::yaml2yaxml( 'file.yml' )
|
115
|
+
xml.write( $stdout, 2)
|
116
|
+
|
117
|
+
Also, you can use:
|
118
|
+
xml = Yaxml::json2yaxml( { numbers: [ 1, 2, 3 ]} )
|
119
|
+
yaml = Yaxml::yaxml2yaml( 'file.yaxml' )
|
120
|
+
json = Yaxml::yaxml2json( 'file.yaxml' )
|
121
|
+
</pre>
|
122
|
+
<table>
|
123
|
+
<tr><td valign="top">Author:</td><td>Diego Moreno (dmoreno@dit.upm.es)
|
124
|
+
|
125
|
+
</td></tr>
|
126
|
+
<tr><td valign="top">License:</td><td>GNU Lesser General Public License (aka LGPL)
|
127
|
+
|
128
|
+
</td></tr>
|
129
|
+
</table>
|
130
|
+
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<div id="requires-list">
|
134
|
+
<h3 class="section-bar">Required files</h3>
|
135
|
+
|
136
|
+
<div class="name-list">
|
137
|
+
rexml/document
|
138
|
+
yaml
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
</div>
|
143
|
+
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
<!-- if includes -->
|
149
|
+
|
150
|
+
<div id="section">
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<!-- if method_list -->
|
160
|
+
|
161
|
+
|
162
|
+
</div>
|
163
|
+
|
164
|
+
|
165
|
+
<div id="validator-badges">
|
166
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
</body>
|
170
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Classes
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Classes</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Classes</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/YAXML.html">YAXML</a><br />
|
24
|
+
<a href="classes/YAXML/Yaxml.html">YAXML::Yaxml</a><br />
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Files
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Files</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Files</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="files/CHANGELOG.html">CHANGELOG</a><br />
|
24
|
+
<a href="files/LICENSE.html">LICENSE</a><br />
|
25
|
+
<a href="files/README.html">README</a><br />
|
26
|
+
<a href="files/lib/yaxml_rb.html">lib/yaxml.rb</a><br />
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Methods
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Methods</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Methods</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/YAXML.html#M000002">json2yaxml (YAXML)</a><br />
|
24
|
+
<a href="classes/YAXML/Yaxml.html#M000005">new (YAXML::Yaxml)</a><br />
|
25
|
+
<a href="classes/YAXML/Yaxml.html#M000007">to_json (YAXML::Yaxml)</a><br />
|
26
|
+
<a href="classes/YAXML/Yaxml.html#M000006">to_yaml (YAXML::Yaxml)</a><br />
|
27
|
+
<a href="classes/YAXML/Yaxml.html#M000008">to_yaxml (YAXML::Yaxml)</a><br />
|
28
|
+
<a href="classes/YAXML.html#M000001">yaml2yaxml (YAXML)</a><br />
|
29
|
+
<a href="classes/YAXML.html#M000004">yaxml2json (YAXML)</a><br />
|
30
|
+
<a href="classes/YAXML.html#M000003">yaxml2yaml (YAXML)</a><br />
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</body>
|
34
|
+
</html>
|
data/doc/rdoc/index.html
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
5
|
+
|
6
|
+
<!--
|
7
|
+
|
8
|
+
The YAXML Module Reference
|
9
|
+
|
10
|
+
-->
|
11
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
12
|
+
<head>
|
13
|
+
<title>The YAXML Module Reference</title>
|
14
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
15
|
+
</head>
|
16
|
+
<frameset rows="20%, 80%">
|
17
|
+
<frameset cols="25%,35%,45%">
|
18
|
+
<frame src="fr_file_index.html" title="Files" name="Files" />
|
19
|
+
<frame src="fr_class_index.html" name="Classes" />
|
20
|
+
<frame src="fr_method_index.html" name="Methods" />
|
21
|
+
</frameset>
|
22
|
+
<frame src="files/README.html" name="docwin" />
|
23
|
+
</frameset>
|
24
|
+
</html>
|