xmlmapper 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +605 -0
  4. data/lib/happymapper.rb +776 -0
  5. data/lib/happymapper/anonymous_mapper.rb +114 -0
  6. data/lib/happymapper/attribute.rb +21 -0
  7. data/lib/happymapper/element.rb +55 -0
  8. data/lib/happymapper/item.rb +160 -0
  9. data/lib/happymapper/supported_types.rb +140 -0
  10. data/lib/happymapper/text_node.rb +8 -0
  11. data/lib/happymapper/version.rb +3 -0
  12. data/lib/xmlmapper.rb +1 -0
  13. data/spec/attribute_default_value_spec.rb +50 -0
  14. data/spec/attributes_spec.rb +36 -0
  15. data/spec/fixtures/address.xml +9 -0
  16. data/spec/fixtures/ambigous_items.xml +22 -0
  17. data/spec/fixtures/analytics.xml +61 -0
  18. data/spec/fixtures/analytics_profile.xml +127 -0
  19. data/spec/fixtures/atom.xml +19 -0
  20. data/spec/fixtures/commit.xml +52 -0
  21. data/spec/fixtures/current_weather.xml +89 -0
  22. data/spec/fixtures/current_weather_missing_elements.xml +18 -0
  23. data/spec/fixtures/default_namespace_combi.xml +6 -0
  24. data/spec/fixtures/dictionary.xml +20 -0
  25. data/spec/fixtures/family_tree.xml +21 -0
  26. data/spec/fixtures/inagy.xml +85 -0
  27. data/spec/fixtures/lastfm.xml +355 -0
  28. data/spec/fixtures/multiple_namespaces.xml +170 -0
  29. data/spec/fixtures/multiple_primitives.xml +5 -0
  30. data/spec/fixtures/optional_attributes.xml +6 -0
  31. data/spec/fixtures/pita.xml +133 -0
  32. data/spec/fixtures/posts.xml +23 -0
  33. data/spec/fixtures/product_default_namespace.xml +18 -0
  34. data/spec/fixtures/product_no_namespace.xml +10 -0
  35. data/spec/fixtures/product_single_namespace.xml +10 -0
  36. data/spec/fixtures/quarters.xml +19 -0
  37. data/spec/fixtures/radar.xml +21 -0
  38. data/spec/fixtures/set_config_options.xml +3 -0
  39. data/spec/fixtures/statuses.xml +422 -0
  40. data/spec/fixtures/subclass_namespace.xml +50 -0
  41. data/spec/fixtures/wrapper.xml +11 -0
  42. data/spec/happymapper/attribute_spec.rb +12 -0
  43. data/spec/happymapper/element_spec.rb +9 -0
  44. data/spec/happymapper/item_spec.rb +115 -0
  45. data/spec/happymapper/text_node_spec.rb +9 -0
  46. data/spec/happymapper_parse_spec.rb +113 -0
  47. data/spec/happymapper_spec.rb +1116 -0
  48. data/spec/has_many_empty_array_spec.rb +43 -0
  49. data/spec/ignay_spec.rb +95 -0
  50. data/spec/inheritance_spec.rb +107 -0
  51. data/spec/mixed_namespaces_spec.rb +61 -0
  52. data/spec/parse_with_object_to_update_spec.rb +111 -0
  53. data/spec/spec_helper.rb +7 -0
  54. data/spec/to_xml_spec.rb +200 -0
  55. data/spec/to_xml_with_namespaces_spec.rb +231 -0
  56. data/spec/wilcard_tag_name_spec.rb +96 -0
  57. data/spec/wrap_spec.rb +82 -0
  58. data/spec/xpath_spec.rb +89 -0
  59. metadata +182 -0
@@ -0,0 +1,18 @@
1
+ <aws:weather xmlns:aws="http://www.aws.com/aws">
2
+ <aws:api version="2.0"/>
3
+ <aws:WebURL>http://weather.weatherbug.com/IN/Carmel-weather.html?ZCode=Z5546&amp;Units=0&amp;stat=MOCAR</aws:WebURL>
4
+ <aws:ob>
5
+ <aws:ob-date>
6
+ <aws:year number="2008"/>
7
+ <aws:month number="12" text="December" abbrv="Dec"/>
8
+ <aws:day number="30" text="Tuesday" abbrv="Tue"/>
9
+ <aws:hour number="4" hour-24="16"/>
10
+ <aws:minute number="18"/>
11
+ <aws:second number="01"/>
12
+ <aws:am-pm abbrv="PM"/>
13
+ <aws:time-zone offset="-5" text="Eastern Standard Time" abbrv="EST"/>
14
+ </aws:ob-date>
15
+ <aws:feels-like units="&amp;deg;F">51</aws:feels-like>
16
+ <aws:temp units="&amp;deg;F">51.8</aws:temp>
17
+ </aws:ob>
18
+ </aws:weather>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0"?>
2
+ <bk:book xmlns:bk="urn:loc.gov:books" xmlns:p="urn:loc.gov:people" xmlns="urn:ISBN:0-395-36341-6">
3
+ <p:author>Frank Gilbreth</p:author>
4
+ <bk:title>Cheaper by the Dozen</bk:title>
5
+ <number>1568491379</number>
6
+ </bk:book>
@@ -0,0 +1,20 @@
1
+ <dictionary>
2
+ <record id="000035426">
3
+ <head>sulphur-crested cockatoo</head>
4
+ <pron>
5
+ <prn>.sxlf7-kr8st7d k6k7'tu</prn>
6
+ </pron>
7
+ <body>
8
+ <chunk>
9
+ <pos>noun</pos>
10
+ <def id="915">
11
+ <dtext>a large common parrot, <bn>Cacatua galerita</bn>, predominantly white, with yellow on the undersides of wings and tail and a forward curving yellow crest, found in Australia, New Guinea and nearby islands.</dtext>
12
+ </def>
13
+ </chunk>
14
+ <variants>
15
+ <var>white <tag>cockatoo</tag></var>
16
+ <var><tag>white</tag> cockatoo</var>
17
+ </variants>
18
+ </body>
19
+ </record>
20
+ </dictionary>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <familytree xmlns="http://api.familysearch.org/familytree/v1" xmlns:fsapi-v1="http://api.familysearch.org/v1" version="1.0.20071213.942" statusMessage="OK" statusCode="200">
3
+ <persons>
4
+ <person version="1199378491000" modified="2008-01-03T09:41:31-07:00" id="KWQS-BBQ">
5
+ <information>
6
+ <alternateIds>
7
+ <id>gedcom.1B5E3087E36D814FA9CBE0BE5B3721EA</id>
8
+ <id>KWQS-BB3</id>
9
+ <id>KWQS-W23</id>
10
+ <id>KWQS-W2S</id>
11
+ <id>KWQS-W29</id>
12
+ <id>KWQM-MMM</id>
13
+ <id>KWQS-W2Q</id>
14
+ <id>KWQS-BBQ</id>
15
+ </alternateIds>
16
+ <gender>Male</gender>
17
+ <living>false</living>
18
+ </information>
19
+ </person>
20
+ </persons>
21
+ </familytree>
@@ -0,0 +1,85 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <CatalogTree code="NLD" xmlns="urn:eventis:prodis:onlineapi:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3
+ <Node vodBackOfficeId="69fcb5eb-1020-4053-8fce-6bce030cac5b">
4
+ <Name>Parent 1</Name>
5
+ <Description>
6
+ 111#111#120#NPO-BrowseMode.jpg#NPO-ExtendedMode.jpg
7
+ </Description>
8
+ <Translations>
9
+ <Translation Language="en-GB">
10
+ <Name>Parent 1 en</Name>
11
+ </Translation>
12
+ <Translation Language="de-DE">
13
+ <Name>Parent 1 de</Name>
14
+ </Translation>
15
+ </Translations>
16
+ <Rating>0</Rating>
17
+ <Adult>false</Adult>
18
+ <CatalogCode>NLD</CatalogCode>
19
+ <Position>1</Position>
20
+ <SubNodes>
21
+ <Node vodBackOfficeId="27feedad-dead-4721-ba61-c3f9f17d0956">
22
+ <Name>First</Name>
23
+ <Translations>
24
+ <Translation Language="en-GB">
25
+ <Name>First en</Name>
26
+ </Translation>
27
+ </Translations>
28
+ <Rating>0</Rating>
29
+ <Adult>false</Adult>
30
+ <CatalogCode>NLD</CatalogCode>
31
+ <ParentId>69fcb5eb-1020-4053-8fce-6bce030cac5b</ParentId>
32
+ <Position>0</Position>
33
+ <SubNodes>
34
+ <Node vodBackOfficeId="7edbcc13-2d03-4254-aaf6-307ba553d4fd">
35
+ <Name>Second</Name>
36
+ <Translations>
37
+ <Translation Language="en-GB">
38
+ <Name>Second en</Name>
39
+ </Translation>
40
+ </Translations>
41
+ <Rating>0</Rating>
42
+ <Adult>false</Adult>
43
+ <CatalogCode>NLD</CatalogCode>
44
+ <ParentId>b17dd22b-c028-44ad-8e75-e676e2619ceb</ParentId>
45
+ <Position>0</Position>
46
+ <SubNodes>
47
+ <Node vodBackOfficeId="27feedad-dead-4721-ba61-c3f9f17d1111">
48
+ <Name>Third</Name>
49
+ <Translations>
50
+ <Translation Language="en-GB">
51
+ <Name>Third en</Name>
52
+ </Translation>
53
+ </Translations>
54
+ <Rating>0</Rating>
55
+ <Adult>false</Adult>
56
+ <CatalogCode>NLD</CatalogCode>
57
+ <ParentId>69fcb5eb-1020-4053-8fce-6bce030cac5b</ParentId>
58
+ <Position>0</Position>
59
+ </Node>
60
+ </SubNodes>
61
+ </Node>
62
+ </SubNodes>
63
+ </Node>
64
+ </SubNodes>
65
+ </Node>
66
+ <Node vodBackOfficeId="69fcb5eb-1020-4053-8fce-12312312312">
67
+ <Name>Parent 2</Name>
68
+ <Description>
69
+ 111#111#120#NPO-BrowseMode.jpg#NPO-ExtendedMode.jpg
70
+ </Description>
71
+ <Translations>
72
+ <Translation Language="en-GB">
73
+ <Name>Parent 2 en</Name>
74
+ </Translation>
75
+ <Translation Language="de-DE">
76
+ <Name>Parent 2 de</Name>
77
+ </Translation>
78
+ </Translations>
79
+ <Rating>0</Rating>
80
+ <Adult>false</Adult>
81
+ <CatalogCode>NLD</CatalogCode>
82
+ <Position>1</Position>
83
+ <SubNodes/>
84
+ </Node>
85
+ </CatalogTree>
@@ -0,0 +1,355 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <lfm status="ok">
3
+ <results for="Koko" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
4
+ <opensearch:Query role="request" searchTerms="Koko" startPage="1" />
5
+ <opensearch:totalResults>37</opensearch:totalResults>
6
+ <opensearch:startIndex>0</opensearch:startIndex>
7
+ <opensearch:itemsPerPage>50</opensearch:itemsPerPage>
8
+ <venuematches>
9
+ <venue>
10
+ <id>8777134</id>
11
+ <name>Koko</name>
12
+ <location>
13
+ <city>London</city>
14
+ <country>United Kingdom</country>
15
+ <street>1a Camden High Street, Camden</street>
16
+ <postalcode>NW1 7JE</postalcode>
17
+ <geo:point>
18
+ <geo:lat>51.53469</geo:lat>
19
+ <geo:long>-0.138434</geo:long>
20
+ </geo:point>
21
+ </location>
22
+ <url>http://www.last.fm/venue/8777134</url>
23
+ </venue>
24
+ <venue>
25
+ <id>8839165</id>
26
+ <name>koko</name>
27
+ <location>
28
+ <city>Layer de la Haye</city>
29
+ <country>United Kingdom</country>
30
+ <street></street>
31
+ <postalcode></postalcode>
32
+ <geo:point>
33
+ <geo:lat>51.888862</geo:lat>
34
+ <geo:long>0.895354</geo:long>
35
+ </geo:point>
36
+ </location>
37
+ <url>http://www.last.fm/venue/8839165</url>
38
+ </venue>
39
+ <venue>
40
+ <id>8923849</id>
41
+ <name>Koko's</name>
42
+ <location>
43
+ <city>Burnley</city>
44
+ <country>United Kingdom</country>
45
+ <street></street>
46
+ <postalcode></postalcode>
47
+ <geo:point>
48
+ <geo:lat>53.787316</geo:lat>
49
+ <geo:long>-2.2437</geo:long>
50
+ </geo:point>
51
+ </location>
52
+ <url>http://www.last.fm/venue/8923849</url>
53
+ </venue>
54
+ <venue>
55
+ <id>8965110</id>
56
+ <name>koko</name>
57
+ <location>
58
+ <city>London</city>
59
+ <country>United Kingdom</country>
60
+ <street></street>
61
+ <postalcode></postalcode>
62
+ <geo:point>
63
+ <geo:lat>51.53469</geo:lat>
64
+ <geo:long>-0.138434</geo:long>
65
+ </geo:point>
66
+ </location>
67
+ <url>http://www.last.fm/venue/8965110</url>
68
+ </venue>
69
+ <venue>
70
+ <id>8971623</id>
71
+ <name>Koko</name>
72
+ <location>
73
+ <city>Castelletto Cervo-Biella</city>
74
+ <country>Italy</country>
75
+ <street></street>
76
+ <postalcode></postalcode>
77
+ <geo:point>
78
+ <geo:lat>45.467809</geo:lat>
79
+ <geo:long>8.460168</geo:long>
80
+ </geo:point>
81
+ </location>
82
+ <url>http://www.last.fm/venue/8971623</url>
83
+ </venue>
84
+ <venue>
85
+ <id>8989111</id>
86
+ <name>Koko</name>
87
+ <location>
88
+ <city>Camden, London</city>
89
+ <country>United Kingdom</country>
90
+ <street></street>
91
+ <postalcode></postalcode>
92
+ <geo:point>
93
+ <geo:lat>51.53469</geo:lat>
94
+ <geo:long>-0.138434</geo:long>
95
+ </geo:point>
96
+ </location>
97
+ <url>http://www.last.fm/venue/8989111</url>
98
+ </venue>
99
+ <venue>
100
+ <id>8997379</id>
101
+ <name>koko</name>
102
+ <location>
103
+ <city>Castelletto</city>
104
+ <country>Italy</country>
105
+ <street></street>
106
+ <postalcode></postalcode>
107
+ <geo:point>
108
+ <geo:lat>45.5833333</geo:lat>
109
+ <geo:long>8.5833333</geo:long>
110
+ </geo:point>
111
+ </location>
112
+ <url>http://www.last.fm/venue/8997379</url>
113
+ </venue>
114
+ <venue>
115
+ <id>8877867</id>
116
+ <name>Koko Teatteri</name>
117
+ <location>
118
+ <city>Helsinki</city>
119
+ <country>Finland</country>
120
+ <street></street>
121
+ <postalcode></postalcode>
122
+ <geo:point>
123
+ <geo:lat>60.175745</geo:lat>
124
+ <geo:long>24.950355</geo:long>
125
+ </geo:point>
126
+ </location>
127
+ <url>http://www.last.fm/venue/8877867</url>
128
+ </venue>
129
+ <venue>
130
+ <id>8906962</id>
131
+ <name>Koko Gorilaz</name>
132
+ <location>
133
+ <city>Cardiff</city>
134
+ <country>United Kingdom</country>
135
+ <street></street>
136
+ <postalcode></postalcode>
137
+ <geo:point>
138
+ <geo:lat>51.480283</geo:lat>
139
+ <geo:long>-3.173233</geo:long>
140
+ </geo:point>
141
+ </location>
142
+ <url>http://www.last.fm/venue/8906962</url>
143
+ </venue>
144
+ <venue>
145
+ <id>8913762</id>
146
+ <name>Koko Cocktails</name>
147
+ <location>
148
+ <city>San Francisco, CA</city>
149
+ <country>United States</country>
150
+ <street></street>
151
+ <postalcode></postalcode>
152
+ <geo:point>
153
+ <geo:lat>37.785804</geo:lat>
154
+ <geo:long>-122.420718</geo:long>
155
+ </geo:point>
156
+ </location>
157
+ <url>http://www.last.fm/venue/8913762</url>
158
+ </venue>
159
+ <venue>
160
+ <id>8960307</id>
161
+ <name>koko, camden</name>
162
+ <location>
163
+ <city>london</city>
164
+ <country>United Kingdom</country>
165
+ <street></street>
166
+ <postalcode></postalcode>
167
+ <geo:point>
168
+ <geo:lat>51.53469</geo:lat>
169
+ <geo:long>-0.138434</geo:long>
170
+ </geo:point>
171
+ </location>
172
+ <url>http://www.last.fm/venue/8960307</url>
173
+ </venue>
174
+ <venue>
175
+ <id>8972179</id>
176
+ <name>koko club</name>
177
+ <location>
178
+ <city>Castelletto Cervo (Biella)</city>
179
+ <country>Italy</country>
180
+ <street></street>
181
+ <postalcode></postalcode>
182
+ <geo:point>
183
+ <geo:lat>45.5833333</geo:lat>
184
+ <geo:long>8.5833333</geo:long>
185
+ </geo:point>
186
+ </location>
187
+ <url>http://www.last.fm/venue/8972179</url>
188
+ </venue>
189
+ <venue>
190
+ <id>8987071</id>
191
+ <name>Koko Club</name>
192
+ <location>
193
+ <city>London</city>
194
+ <country>United Kingdom</country>
195
+ <street></street>
196
+ <postalcode></postalcode>
197
+ <geo:point>
198
+ <geo:lat>51.53469</geo:lat>
199
+ <geo:long>-0.138434</geo:long>
200
+ </geo:point>
201
+ </location>
202
+ <url>http://www.last.fm/venue/8987071</url>
203
+ </venue>
204
+ <venue>
205
+ <id>8996214</id>
206
+ <name>Koko Gorillaz</name>
207
+ <location>
208
+ <city>Roath, Cardiff</city>
209
+ <country>United Kingdom</country>
210
+ <street></street>
211
+ <postalcode></postalcode>
212
+ <geo:point>
213
+ <geo:lat>51.485545</geo:lat>
214
+ <geo:long>-3.193589</geo:long>
215
+ </geo:point>
216
+ </location>
217
+ <url>http://www.last.fm/venue/8996214</url>
218
+ </venue>
219
+ <venue>
220
+ <id>9011083</id>
221
+ <name>Koko Club</name>
222
+ <location>
223
+ <city>Castelletto (BI)</city>
224
+ <country>Italy</country>
225
+ <street></street>
226
+ <postalcode></postalcode>
227
+ <geo:point>
228
+ <geo:lat>45.4</geo:lat>
229
+ <geo:long>8.9333333</geo:long>
230
+ </geo:point>
231
+ </location>
232
+ <url>http://www.last.fm/venue/9011083</url>
233
+ </venue>
234
+ <venue>
235
+ <id>9011085</id>
236
+ <name>Koko Club</name>
237
+ <location>
238
+ <city>Castelletto Cervo (BI)</city>
239
+ <country>Italy</country>
240
+ <street>VIA PER COSSATO / A4 USCITA BALOCCO</street>
241
+ <postalcode></postalcode>
242
+ <geo:point>
243
+ <geo:lat>45.5833333</geo:lat>
244
+ <geo:long>8.5833333</geo:long>
245
+ </geo:point>
246
+ </location>
247
+ <url>http://www.last.fm/venue/9011085</url>
248
+ </venue>
249
+ <venue>
250
+ <id>9016513</id>
251
+ <name>KOKO Bar</name>
252
+ <location>
253
+ <city>Katowice</city>
254
+ <country>Poland</country>
255
+ <street>ul. 3go Maja 23</street>
256
+ <postalcode></postalcode>
257
+ <geo:point>
258
+ <geo:lat>50.2302967966042</geo:lat>
259
+ <geo:long>19.0139007568359</geo:long>
260
+ </geo:point>
261
+ </location>
262
+ <url>http://www.last.fm/venue/9016513</url>
263
+ </venue>
264
+ <venue>
265
+ <id>8870061</id>
266
+ <name>KokoTeatteri</name>
267
+ <location>
268
+ <city>Helsinki</city>
269
+ <country>Finland</country>
270
+ <street>Siltavuorenranta 18</street>
271
+ <postalcode></postalcode>
272
+ <geo:point>
273
+ <geo:lat>60.175745</geo:lat>
274
+ <geo:long>24.950355</geo:long>
275
+ </geo:point>
276
+ </location>
277
+ <url>http://www.last.fm/venue/8870061</url>
278
+ </venue>
279
+ <venue>
280
+ <id>8877869</id>
281
+ <name>KokoTeatteri</name>
282
+ <location>
283
+ <city>Helsinki</city>
284
+ <country>Finland</country>
285
+ <street></street>
286
+ <postalcode></postalcode>
287
+ <geo:point>
288
+ <geo:lat>60.175745</geo:lat>
289
+ <geo:long>24.950355</geo:long>
290
+ </geo:point>
291
+ </location>
292
+ <url>http://www.last.fm/venue/8877869</url>
293
+ </venue>
294
+ <venue>
295
+ <id>8951971</id>
296
+ <name>Bajka/Koko-Bongo</name>
297
+ <location>
298
+ <city>Mielno</city>
299
+ <country>Poland</country>
300
+ <street></street>
301
+ <postalcode></postalcode>
302
+ <geo:point>
303
+ <geo:lat>54.3</geo:lat>
304
+ <geo:long>17.1166667</geo:long>
305
+ </geo:point>
306
+ </location>
307
+ <url>http://www.last.fm/venue/8951971</url>
308
+ </venue>
309
+ <venue>
310
+ <id>8958085</id>
311
+ <name>Bajka/Koko-Bongo</name>
312
+ <location>
313
+ <city>Mielno</city>
314
+ <country>Poland</country>
315
+ <street></street>
316
+ <postalcode></postalcode>
317
+ <geo:point>
318
+ <geo:lat>54.2666667</geo:lat>
319
+ <geo:long>16.05</geo:long>
320
+ </geo:point>
321
+ </location>
322
+ <url>http://www.last.fm/venue/8958085</url>
323
+ </venue>
324
+ <venue>
325
+ <id>9017902</id>
326
+ <name>Klub Bajka/Koko-Bongo</name>
327
+ <location>
328
+ <city>Mielno</city>
329
+ <country>Poland</country>
330
+ <street></street>
331
+ <postalcode></postalcode>
332
+ <geo:point>
333
+ <geo:lat>54.2666667</geo:lat>
334
+ <geo:long>16.05</geo:long>
335
+ </geo:point>
336
+ </location>
337
+ <url>http://www.last.fm/venue/9017902</url>
338
+ </venue>
339
+ <venue>
340
+ <id>8965534</id>
341
+ <name>KOKO, 1a Camden High Street</name>
342
+ <location>
343
+ <city>London</city>
344
+ <country>United Kingdom</country>
345
+ <street></street>
346
+ <postalcode></postalcode>
347
+ <geo:point>
348
+ <geo:lat>51.541474</geo:lat>
349
+ <geo:long>-0.145325</geo:long>
350
+ </geo:point>
351
+ </location>
352
+ <url>http://www.last.fm/venue/8965534</url>
353
+ </venue>
354
+ </venuematches>
355
+ </results></lfm>