Skip to content
Newer
Older
100644 80 lines (68 sloc) 1.94 KB
dc5be1c Initial check-in.
uli authored Jul 4, 2009
1 //
2 // UKXMLToDictionary.h
3 // MobileMoose
4 //
5 // Created by Uli Kusterer on 13.07.08.
6 // Copyright 2008 Uli Kusterer. All rights reserved.
7 //
720b0e7 @uliwitness Added licensing information to the source files.
authored Mar 4, 2010
8 // This software is provided 'as-is', without any express or implied
9 // warranty. In no event will the authors be held liable for any damages
10 // arising from the use of this software.
11 //
12 // Permission is granted to anyone to use this software for any purpose,
13 // including commercial applications, and to alter it and redistribute it
14 // freely, subject to the following restrictions:
15 //
16 // 1. The origin of this software must not be misrepresented; you must not
17 // claim that you wrote the original software. If you use this software
18 // in a product, an acknowledgment in the product documentation would be
19 // appreciated but is not required.
20 //
21 // 2. Altered source versions must be plainly marked as such, and must not be
22 // misrepresented as being the original software.
23 //
24 // 3. This notice may not be removed or altered from any source
25 // distribution.
26 //
dc5be1c Initial check-in.
uli authored Jul 4, 2009
27
28 /*
29 Handy utility functions for turning XML into a dictionary that is a bit
30 easier to work with. As an example:
31
32 <foo>
33 <bar>
34 Welcome to Abu Dhabi
35 <snort>50</snort>
36 </bar>
37 <bazzes>
38 <baz>one</baz>
39 <baz>two</baz>
40 <baz>three</baz>
41 </bazzes>
42 </foo>
43
44 will be turned into:
45
46 {
47 UKNameOfXMLTagKey = "foo"
48 bar =
49 {
50 UKNameOfXMLTagKey = "bar"
51 UKTextOfXMLTagKey = "Welcome to Abu Dhabi"
52 snort = "50"
53 }
54 bazzes =
55 {
56 baz =
57 (
58 "one",
59 "two",
60 "three"
61 )
62 }
63 }
64
65 (where curly brackets indicate dictionaries, regular brackets indicate arrays)
66 */
67
68 #import <Foundation/Foundation.h>
69
70
71 // The following keys share a namespace with the actual tag names, so should
72 // be invalid XML tag names to avoid collisions:
73
74 #define UKNameOfXMLTagKey @" NAME"
75 #define UKTextOfXMLTagKey @" TEXT"
76
77
78 NSDictionary* UKXMLDataToDictionary( NSData* inXMLData );
79 NSDictionary* UKXMLStringToDictionary( NSString* inXMLString );
Something went wrong with that request. Please try again.