1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.json.xml;
18
19 import junit.framework.TestCase;
20 import net.sf.json.Assertions;
21 import net.sf.json.JSON;
22 import net.sf.json.JSONArray;
23 import net.sf.json.JSONNull;
24 import net.sf.json.JSONObject;
25 import net.sf.json.test.JSONAssert;
26
27
28
29
30 public class TestXMLSerializer_reads extends TestCase {
31 public static void main( String[] args ) {
32 junit.textui.TestRunner.run( TestXMLSerializer_reads.class );
33 }
34
35 private XMLSerializer xmlSerializer;
36
37 public TestXMLSerializer_reads( String testName ) {
38 super( testName );
39 }
40
41 public void testNullObjectArray() {
42 String xml = "<a><e class=\"object\" null=\"true\"/><e class=\"object\" null=\"true\"/></a>";
43 JSON actual = xmlSerializer.read( xml );
44 JSON expected = JSONArray.fromObject( "[null,null]" );
45 Assertions.assertEquals( expected, actual );
46 }
47
48 public void testNullObjectArray_noTypeHintsCompatibility() {
49 String xml = "<a><e json_class=\"object\" json_null=\"true\"/><e json_class=\"object\" json_null=\"true\"/></a>";
50 xmlSerializer.setTypeHintsCompatibility( false );
51 JSON actual = xmlSerializer.read( xml );
52 JSON expected = JSONArray.fromObject( "[null,null]" );
53 Assertions.assertEquals( expected, actual );
54 }
55
56 public void testRead_nullObject() {
57 String xml = "<o/>";
58 JSON actual = xmlSerializer.read( xml );
59 Assertions.assertEquals( JSONNull.getInstance(), actual );
60 }
61
62 public void testRead_nullObject_2() {
63 String xml = "<o null=\"true\"/>";
64 JSON actual = xmlSerializer.read( xml );
65 Assertions.assertEquals( JSONNull.getInstance(), actual );
66 }
67
68 public void testRead_nullObject_2_noTypeHintsCompatibility() {
69 String xml = "<o json_null=\"true\"/>";
70 xmlSerializer.setTypeHintsCompatibility( false );
71 JSON actual = xmlSerializer.read( xml );
72 Assertions.assertEquals( JSONNull.getInstance(), actual );
73 }
74
75 public void testRead_nullObject_3() {
76 String xml = "<o class=\"object\"/>";
77 JSON actual = xmlSerializer.read( xml );
78 Assertions.assertEquals( JSONNull.getInstance(), actual );
79 }
80
81 public void testRead_nullObject_3_noTypeHintsCompatibility() {
82 String xml = "<o json_class=\"object\"/>";
83 xmlSerializer.setTypeHintsCompatibility( false );
84 JSON actual = xmlSerializer.read( xml );
85 Assertions.assertEquals( JSONNull.getInstance(), actual );
86 }
87
88 public void testRead_nullObject_4() {
89 String xml = "<o type=\"string\"/>";
90 JSON actual = xmlSerializer.read( xml );
91 Assertions.assertEquals( JSONNull.getInstance(), actual );
92 }
93
94 public void testRead_nullObject_4_noTypeHintsCompatibility() {
95 String xml = "<o json_type=\"string\"/>";
96 xmlSerializer.setTypeHintsCompatibility( false );
97 JSON actual = xmlSerializer.read( xml );
98 Assertions.assertEquals( JSONNull.getInstance(), actual );
99 }
100
101 public void testRead_nullObject_5() {
102 String xml = "<o class=\"object\" type=\"string\"/>";
103 JSON actual = xmlSerializer.read( xml );
104 Assertions.assertEquals( JSONNull.getInstance(), actual );
105 }
106
107 public void testRead_nullObject_5_noTypeHintsCompatibility() {
108 String xml = "<o json_class=\"object\" json_type=\"string\"/>";
109 xmlSerializer.setTypeHintsCompatibility( false );
110 JSON actual = xmlSerializer.read( xml );
111 Assertions.assertEquals( JSONNull.getInstance(), actual );
112 }
113
114 public void testReadArray_forceTopLevelObject() {
115 String xml = "<a>json</a>";
116 xmlSerializer.setForceTopLevelObject( true );
117 JSON actual = xmlSerializer.read( xml );
118 JSON expected = new JSONObject().element( "a", new JSONArray().element( "json" ) );
119 Assertions.assertEquals( expected, actual );
120 }
121
122 public void testReadArray_withText() {
123 String xml = "<a>json</a>";
124 JSON actual = xmlSerializer.read( xml );
125 JSON expected = new JSONArray().element( "json" );
126 Assertions.assertEquals( expected, actual );
127 }
128
129 public void testReadBooleanArray_withDefaultType() {
130 String xml = "<a type=\"boolean\"><e>true</e><e>false</e></a>";
131 JSON actual = xmlSerializer.read( xml );
132 JSON expected = JSONArray.fromObject( "[true,false]" );
133 Assertions.assertEquals( expected, actual );
134 }
135
136 public void testReadBooleanArray_withoutDefaultType() {
137 String xml = "<a><e type=\"boolean\">true</e><e type=\"boolean\">false</e></a>";
138 JSON actual = xmlSerializer.read( xml );
139 JSON expected = JSONArray.fromObject( "[true,false]" );
140 Assertions.assertEquals( expected, actual );
141 }
142
143 public void testReadFloatArray_withDefaultType() {
144 String xml = "<a type=\"float\"><e>1.1</e><e>2.2</e><e>3.3</e></a>";
145 JSON actual = xmlSerializer.read( xml );
146 JSON expected = JSONArray.fromObject( "[1.1,2.2,3.3]" );
147 Assertions.assertEquals( expected, actual );
148 }
149
150 public void testReadFloatArray_withoutDefaultType() {
151 String xml = "<a><e type=\"float\">1.1</e><e type=\"float\">2.2</e><e type=\"float\">3.3</e></a>";
152 JSON actual = xmlSerializer.read( xml );
153 JSON expected = JSONArray.fromObject( "[1.1,2.2,3.3]" );
154 Assertions.assertEquals( expected, actual );
155 }
156
157 public void testReadFunctionObject() {
158 String xml = "<o><func params=\"a\" ><![CDATA[return a;]]></func></o>";
159 JSON actual = xmlSerializer.read( xml );
160 JSON expected = JSONObject.fromObject( "{func:function(a){ return a; }}" );
161 Assertions.assertEquals( expected, actual );
162 }
163
164 public void testReadFunctionObject_noTypeHintsCompatibility() {
165 String xml = "<o><func json_params=\"a\" ><![CDATA[return a;]]></func></o>";
166 xmlSerializer.setTypeHintsCompatibility( false );
167 JSON actual = xmlSerializer.read( xml );
168 JSON expected = JSONObject.fromObject( "{func:function(a){ return a; }}" );
169 Assertions.assertEquals( expected, actual );
170 }
171
172 public void testReadFunctionObject_withDefaultType() {
173 String xml = "<o type=\"function\"><func params=\"a\"><![CDATA[return a;]]></func></o>";
174 JSON actual = xmlSerializer.read( xml );
175 JSON expected = JSONObject.fromObject( "{func:function(a){ return a; }}" );
176 Assertions.assertEquals( expected, actual );
177 }
178
179 public void testReadFunctionObject_withoutDefaultType() {
180 String xml = "<o><func params=\"a\" type=\"function\"><![CDATA[return a;]]></func></o>";
181 JSON actual = xmlSerializer.read( xml );
182 JSON expected = JSONObject.fromObject( "{func:function(a){ return a; }}" );
183 Assertions.assertEquals( expected, actual );
184 }
185
186 public void testReadIntegerArray_withDefaultType() {
187 String xml = "<a type=\"integer\"><e>1</e><e>2</e><e>3</e></a>";
188 JSON actual = xmlSerializer.read( xml );
189 JSON expected = JSONArray.fromObject( "[1,2,3]" );
190 Assertions.assertEquals( expected, actual );
191 }
192
193 public void testReadIntegerArray_withoutDefaultType() {
194 String xml = "<a><e type=\"integer\">1</e><e type=\"integer\">2</e><e type=\"integer\">3</e></a>";
195 JSON actual = xmlSerializer.read( xml );
196 JSON expected = JSONArray.fromObject( "[1,2,3]" );
197 Assertions.assertEquals( expected, actual );
198 }
199
200 public void testReadMixedArray_withDefaultType() {
201 String xml = "<a type=\"string\"><e type=\"boolean\">true</e><e type=\"number\">2.2</e><e>3</e></a>";
202 JSON actual = xmlSerializer.read( xml );
203 JSON expected = JSONArray.fromObject( "[true,2.2,\"3\"]" );
204 Assertions.assertEquals( expected, actual );
205 }
206
207 public void testReadMixedArray_withoutDefaultType() {
208 String xml = "<a><e type=\"boolean\">true</e><e type=\"number\">2.2</e><e type=\"string\">3</e></a>";
209 JSON actual = xmlSerializer.read( xml );
210 JSON expected = JSONArray.fromObject( "[true,2.2,\"3\"]" );
211 Assertions.assertEquals( expected, actual );
212 }
213
214 public void testReadMultiBooleanArray_withDefaultType() {
215 String xml = "<a type=\"boolean\"><e>true</e><e>false</e><e class=\"array\"><e>false</e><e>true</e></e></a>";
216 JSON actual = xmlSerializer.read( xml );
217 JSON expected = JSONArray.fromObject( "[true,false,[false,true]]" );
218 Assertions.assertEquals( expected, actual );
219 }
220
221 public void testReadMultiBooleanArray_withoutDefaultType() {
222 String xml = "<a><e type=\"boolean\">true</e><e type=\"boolean\">false</e><e class=\"array\"><e type=\"boolean\">false</e><e type=\"boolean\">true</e></e></a>";
223 JSON actual = xmlSerializer.read( xml );
224 JSON expected = JSONArray.fromObject( "[true,false,[false,true]]" );
225 Assertions.assertEquals( expected, actual );
226 }
227
228 public void testReadMultiFloatArray_withDefaultType() {
229 String xml = "<a type=\"float\"><e>1.1</e><e>2.2</e><e>3.3</e><e class=\"array\"><e>1.1</e><e>2.2</e><e>3.3</e></e></a>";
230 JSON actual = xmlSerializer.read( xml );
231 JSON expected = JSONArray.fromObject( "[1.1,2.2,3.3,[1.1,2.2,3.3]]" );
232 Assertions.assertEquals( expected, actual );
233 }
234
235 public void testReadMultiFloatArray_withoutDefaultType() {
236 String xml = "<a><e type=\"float\">1.1</e><e type=\"float\">2.2</e><e type=\"float\">3.3</e><e class=\"array\"><e type=\"float\">1.1</e><e type=\"float\">2.2</e><e type=\"float\">3.3</e></e></a>";
237 JSON actual = xmlSerializer.read( xml );
238 JSON expected = JSONArray.fromObject( "[1.1,2.2,3.3,[1.1,2.2,3.3]]" );
239 Assertions.assertEquals( expected, actual );
240 }
241
242 public void testReadMultiIntegerArray_withDefaultType() {
243 String xml = "<a type=\"integer\"><e>1</e><e>2</e><e>3</e><e class=\"array\"><e>1</e><e>2</e><e>3</e></e></a>";
244 JSON actual = xmlSerializer.read( xml );
245 JSON expected = JSONArray.fromObject( "[1,2,3,[1,2,3]]" );
246 Assertions.assertEquals( expected, actual );
247 }
248
249 public void testReadMultiIntegerArray_withoutDefaultType() {
250 String xml = "<a><e type=\"integer\">1</e><e type=\"integer\">2</e><e type=\"integer\">3</e><e class=\"array\"><e type=\"integer\">1</e><e type=\"integer\">2</e><e type=\"integer\">3</e></e></a>";
251 JSON actual = xmlSerializer.read( xml );
252 JSON expected = JSONArray.fromObject( "[1,2,3,[1,2,3]]" );
253 Assertions.assertEquals( expected, actual );
254 }
255
256 public void testReadMultiMixedArray_withDefaultType() {
257 String xml = "<a type=\"string\"><e type=\"boolean\">true</e><e type=\"number\">2.2</e><e>3</e><e class=\"array\"><e type=\"boolean\">true</e><e type=\"number\">2.2</e><e>3</e></e></a>";
258 JSON actual = xmlSerializer.read( xml );
259 JSON expected = JSONArray.fromObject( "[true,2.2,\"3\",[true,2.2,\"3\"]]" );
260 Assertions.assertEquals( expected, actual );
261 }
262
263 public void testReadMultiMixedArray_withoutDefaultType() {
264 String xml = "<a><e type=\"boolean\">true</e><e type=\"number\">2.2</e><e type=\"string\">3</e><e class=\"array\"><e type=\"boolean\">true</e><e type=\"number\">2.2</e><e type=\"string\">3</e></e></a>";
265 JSON actual = xmlSerializer.read( xml );
266 JSON expected = JSONArray.fromObject( "[true,2.2,\"3\",[true,2.2,\"3\"]]" );
267 Assertions.assertEquals( expected, actual );
268 }
269
270 public void testReadMultiNumberArray_withDefaultType() {
271 String xml = "<a type=\"number\"><e>1.1</e><e>2.2</e><e>3</e><e class=\"array\"><e>1.1</e><e>2.2</e><e>3</e></e></a>";
272 JSON actual = xmlSerializer.read( xml );
273 JSON expected = JSONArray.fromObject( "[1.1,2.2,3,[1.1,2.2,3]]" );
274 Assertions.assertEquals( expected, actual );
275 }
276
277 public void testReadMultiNumberArray_withoutDefaultType() {
278 String xml = "<a><e type=\"number\">1.1</e><e type=\"number\">2.2</e><e type=\"number\">3</e><e class=\"array\"><e type=\"number\">1.1</e><e type=\"number\">2.2</e><e type=\"number\">3</e></e></a>";
279 JSON actual = xmlSerializer.read( xml );
280 JSON expected = JSONArray.fromObject( "[1.1,2.2,3,[1.1,2.2,3]]" );
281 Assertions.assertEquals( expected, actual );
282 }
283
284 public void testReadMultiStringArray_withDefaultType() {
285 String xml = "<a type=\"string\"><e>1.1</e><e>2.2</e><e>3</e><e class=\"array\"><e>1.1</e><e>2.2</e><e>3</e></e></a>";
286 JSON actual = xmlSerializer.read( xml );
287 JSON expected = JSONArray.fromObject( "[\"1.1\",\"2.2\",\"3\",[\"1.1\",\"2.2\",\"3\"]]" );
288 Assertions.assertEquals( expected, actual );
289 }
290
291 public void testReadMultiStringArray_withoutDefaultType() {
292 String xml = "<a><e type=\"string\">1.1</e><e type=\"string\">2.2</e><e type=\"string\">3</e><e class=\"array\"><e type=\"string\">1.1</e><e type=\"string\">2.2</e><e type=\"string\">3</e></e></a>";
293 JSON actual = xmlSerializer.read( xml );
294 JSON expected = JSONArray.fromObject( "[\"1.1\",\"2.2\",\"3\",[\"1.1\",\"2.2\",\"3\"]]" );
295 Assertions.assertEquals( expected, actual );
296 }
297
298 public void testReadNestedObject() {
299 String xml = "<o><name>json</name><nested class=\"object\"><id type=\"number\">1</id></nested></o>";
300 JSONObject actual = (JSONObject) xmlSerializer.read( xml );
301 JSONObject expected = JSONObject.fromObject( "{name:\"json\",nested:{id:1}}" );
302 Assertions.assertEquals( expected, actual );
303 }
304
305 public void testReadNumberArray_withDefaultType() {
306 String xml = "<a type=\"number\"><e>1.1</e><e>2.2</e><e>3</e></a>";
307 JSON actual = xmlSerializer.read( xml );
308 JSON expected = JSONArray.fromObject( "[1.1,2.2,3]" );
309 Assertions.assertEquals( expected, actual );
310 }
311
312 public void testReadNumberArray_withoutDefaultType() {
313 String xml = "<a><e type=\"number\">1.1</e><e type=\"number\">2.2</e><e type=\"number\">3</e></a>";
314 JSON actual = xmlSerializer.read( xml );
315 JSON expected = JSONArray.fromObject( "[1.1,2.2,3]" );
316 Assertions.assertEquals( expected, actual );
317 }
318
319 public void testReadObject_withAttributes() {
320 String xml = "<o string=\"json\" number=\"1\"/>";
321 JSON actual = xmlSerializer.read( xml );
322 JSON expected = new JSONObject().element( "@string", "json" ).element( "@number", "1" );
323 Assertions.assertEquals( expected, actual );
324 }
325
326 public void testReadObject_withAttributes_noTypeHintsEnabled() {
327 String xml = "<o class=\"Java.class\" type=\"object\" string=\"json\" number=\"1\"/>";
328 xmlSerializer.setTypeHintsEnabled( false );
329 JSON actual = xmlSerializer.read( xml );
330 JSON expected = new JSONObject().element( "@class", "Java.class" ).element( "@type", "object" ).element(
331 "@string", "json" ).element( "@number", "1" );
332 Assertions.assertEquals( expected, actual );
333 }
334
335 public void testReadObject_withAttributes_noTypeHintsEnabled_noTypeHintsCompatibility() {
336 String xml = "<o json_class=\"Java.class\" json_type=\"object\" string=\"json\" number=\"1\"/>";
337 xmlSerializer.setTypeHintsEnabled( false );
338 xmlSerializer.setTypeHintsCompatibility( false );
339 JSON actual = xmlSerializer.read( xml );
340 JSON expected = new JSONObject().element( "@json_class", "Java.class" ).element( "@json_type", "object" )
341 .element( "@string", "json" ).element( "@number", "1" );
342 Assertions.assertEquals( expected, actual );
343 }
344
345 public void testReadObject_withText() {
346 String xml = "<o>first<string>json</string>\n</o>";
347 JSON actual = xmlSerializer.read( xml );
348 JSON expected = new JSONObject().element( "string", "json" ).element( "#text", "first" );
349 Assertions.assertEquals( expected, actual );
350 }
351
352 public void testReadObject_withText_2() {
353 String xml = "<o>first<string>json</string>second</o>";
354 JSON actual = xmlSerializer.read( xml );
355 JSON expected = new JSONObject().element( "string", "json" ).element( "#text",
356 new JSONArray().element( "first" ).element( "second" ) );
357 Assertions.assertEquals( expected, actual );
358 }
359
360 public void testReadObjectFullTypes() {
361 String xml = "<o><int type=\"integer\">1</int>" + "<decimal type=\"float\">2.0</decimal>"
362 + "<number type=\"number\">3.1416</number>" + "<bool type=\"boolean\">true</bool>"
363 + "<string>json</string>" + "<func type=\"function\" params=\"a\" ><![CDATA[return a;]]></func></o>";
364 JSONObject actual = (JSONObject) xmlSerializer.read( xml );
365 JSONObject expected = JSONObject.fromObject( "{func:function(a){ return a; }}" );
366 expected.element( "int", new Integer( 1 ) );
367 expected.element( "decimal", new Double( 2.0 ) );
368 expected.element( "number", new Double( 3.1416 ) );
369 expected.element( "bool", Boolean.TRUE );
370 expected.element( "string", "json" );
371 Assertions.assertEquals( expected, actual );
372 }
373
374 public void testReadSimpleObject_withDefaultType() {
375 String xml = "<o type=\"number\"><bool type=\"boolean\">true</bool><int>1</int><double>2.2</double><string type=\"string\">json</string><numbers class=\"array\"><e>4.44</e><e>5</e></numbers></o>";
376 JSONObject actual = (JSONObject) xmlSerializer.read( xml );
377 JSONObject expected = JSONObject.fromObject( "{bool:true,int:1,double:2.2,string:'json',numbers:[4.44,5]}" );
378 Assertions.assertEquals( expected, actual );
379 }
380
381 public void testReadStringArray_withDefaultType() {
382 String xml = "<a type=\"string\"><e>1.1</e><e>2.2</e><e>3</e></a>";
383 JSON actual = xmlSerializer.read( xml );
384 JSON expected = JSONArray.fromObject( "[\"1.1\",\"2.2\",\"3\"]" );
385 Assertions.assertEquals( expected, actual );
386 }
387
388 public void testReadStringArray_withoutDefaultType() {
389 String xml = "<a><e type=\"string\">1.1</e><e type=\"string\">2.2</e><e type=\"string\">3</e></a>";
390 JSON actual = xmlSerializer.read( xml );
391 JSON expected = JSONArray.fromObject( "[\"1.1\",\"2.2\",\"3\"]" );
392 Assertions.assertEquals( expected, actual );
393 }
394
395 public void testReadWithNamespace_array() {
396 String xml = "<a xmlns=\"http://json.org/json/1.0\" xmlns:ns=\"http://www.w3.org/2001/XMLSchema-instance\"><ns:string>json</ns:string><ns:string>1</ns:string></a>";
397 JSON actual = xmlSerializer.read( xml );
398 JSONObject expected = new JSONObject().element( "@xmlns", "http://json.org/json/1.0" ).element( "@xmlns:ns",
399 "http://www.w3.org/2001/XMLSchema-instance" ).element( "ns:string", "json" ).accumulate( "ns:string", "1" );
400 Assertions.assertEquals( expected, actual );
401 }
402
403 public void testReadWithNamespace_object() {
404 String xml = "<o xmlns=\"http://json.org/json/1.0\" xmlns:ns=\"http://www.w3.org/2001/XMLSchema-instance\"><ns:string>json</ns:string><ns:number>1</ns:number></o>";
405 JSON actual = xmlSerializer.read( xml );
406 JSONObject expected = new JSONObject().element( "@xmlns", "http://json.org/json/1.0" ).element( "@xmlns:ns",
407 "http://www.w3.org/2001/XMLSchema-instance" ).element( "ns:string", "json" ).element( "ns:number", "1" );
408 Assertions.assertEquals( expected, actual );
409 }
410
411 public void testRemoveNameSpacePrefixFromElements() throws Exception {
412 xmlSerializer.setRemoveNamespacePrefixFromElements( true );
413
414 JSONObject json = (JSONObject) xmlSerializer.readFromFile( "net/sf/json/xml/delicious.xml" );
415 assertFalse( json.getJSONObject( "item" ).has( "@rdf:about" ) );
416 assertTrue( json.getJSONObject( "item" ).has( "@about" ) );
417 }
418
419 public void testSkipNamespaces() throws Exception {
420 xmlSerializer.setSkipNamespaces( true );
421
422 JSONObject json = (JSONObject) xmlSerializer.readFromFile( "net/sf/json/xml/delicious.xml" );
423 assertFalse( json.getJSONObject( "item" ).has( "@xmlns" ) );
424 }
425
426 public void testTrimSpaces() throws Exception {
427 JSONObject json = (JSONObject) xmlSerializer.readFromFile( "net/sf/json/xml/delicious.xml" );
428 String link = json.getJSONObject( "item" ).getString( "link" );
429 assertTrue( link.startsWith( " " ) );
430 assertTrue( link.endsWith( " " ) );
431
432 xmlSerializer.setTrimSpaces( true );
433 json = (JSONObject) xmlSerializer.readFromFile( "net/sf/json/xml/delicious.xml" );
434 link = json.getJSONObject( "item" ).getString( "link" );
435 assertFalse( link.startsWith( " " ) );
436 assertFalse( link.endsWith( " " ) );
437 }
438
439 public void testXmlConversionRules() {
440 String xml = "<span class=\"vevent\">" + "<a class=\"url\" href=\"http://www.web2con.com/\">"
441 + "<span class=\"summary\">Web 2.0 Conference</span>"
442 + "<abbr class=\"dtstart\" title=\"2005-10-05\">October 5</abbr>"
443 + "<abbr class=\"dtend\" title=\"2005-10-08\">7</abbr>"
444 + "<span class=\"location\">Argent Hotel, San Francisco, CA</span>" + "</a>" + "</span>";
445
446 xmlSerializer.setTypeHintsCompatibility( false );
447 xmlSerializer.setForceTopLevelObject( true );
448 JSONObject actual = (JSONObject) xmlSerializer.read( xml );
449 assertNotNull( actual );
450 JSONObject expected = new JSONObject()
451 .element(
452 "span",
453 new JSONObject()
454 .element( "@class", "vevent" )
455 .element(
456 "a",
457 new JSONObject()
458 .element( "@class", "url" )
459 .element( "@href", "http://www.web2con.com/" )
460 .element( "span",
461 JSONObject.fromObject( "{'@class':'summary','#text':'Web 2.0 Conference'}" ) )
462 .element(
463 "abbr",
464 JSONObject
465 .fromObject( "{'@class':'dtstart','@title': '2005-10-05','#text':'October 5'}" ) )
466 .accumulate(
467 "abbr",
468 JSONObject
469 .fromObject( "{'@class':'dtend','@title': '2005-10-08','#text':'7'}" ) )
470 .accumulate(
471 "span",
472 JSONObject
473 .fromObject( "{'@class':'location','#text':'Argent Hotel, San Francisco, CA'}" ) ) ) );
474 JSONAssert.assertEquals( expected, actual );
475 }
476
477 protected void setUp() throws Exception {
478 super.setUp();
479 xmlSerializer = new XMLSerializer();
480 }
481 }