src/server/test/xml.h

changeset 385
a1f4cb076d2f
parent 319
a9b9344875aa
child 415
d938228c382e
equal deleted inserted replaced
210:21274e5950af 385:a1f4cb076d2f
1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 2020 Olaf Wintermann. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef TEST_XML_H
30 #define TEST_XML_H
31
32 #include "../public/nsapi.h"
33 #include <ucx/test.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 UCX_TEST(test_wsxml_iterator);
40 UCX_TEST(test_wsxml_get_required_namespaces);
41 UCX_TEST(test_wsxml_write_nodes);
42 UCX_TEST(test_wsxml_nslist2string);
43 UCX_TEST(test_wsxml_string2nslist);
44
45
46 #define XML_TESTDATA1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
47 <test> \
48 <elm1>teststr</elm1> \
49 <!-- comment -->\
50 <elm2 /> \
51 <c> \
52 <a>hello</a> \
53 world\
54 <d><e><b/></e></d>\
55 </c> \
56 <x><z/></x> \
57 </test>"
58
59 #define XML_TESTDATA2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
60 <root><wrapper><test> \
61 <elm1>teststr</elm1> \
62 <!-- comment -->\
63 <elm2 /> \
64 <c> \
65 <a>hello</a> \
66 world\
67 <d><e><b/></e></d>\
68 </c> \
69 <x><z/></x> \
70 </test><nextelm/></wrapper><ignore/></root>"
71
72 #define XML_TESTDATA3 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
73 <x1:prop \
74 xmlns:x1=\"http://example.com/ns1/\" \
75 xmlns:x2=\"http://example.com/ns2/\" \
76 xmlns:x3=\"http://example.com/ns_0/\" \
77 xmlns:x4=\"http://example.com/ns_0/\" > \
78 <x1:elm1>str1</x1:elm1>\
79 <x2:elm2>str1</x2:elm2>\
80 <x3:elm3>str1</x3:elm3>\
81 <x4:elm4>str1</x4:elm4>\
82 </x1:prop>"
83
84 #define XML_TESTDATA4 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
85 <x1:prop \
86 xmlns:x1=\"http://example.com/ns1/\" \
87 xmlns:x2=\"http://example.com/ns2/\" \
88 xmlns:x3=\"http://example.com/ns_0/\" \
89 xmlns:x4=\"http://example.com/ns_0/\" >\
90 <x1:elm1>str1</x1:elm1>\
91 <x2:elm2>str1</x2:elm2>\
92 </x1:prop>"
93
94 #define XML_TESTDATA5 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
95 <x1:prop \
96 xmlns:x1=\"http://example.com/ns1/\" \
97 xmlns:x2=\"http://example.com/ns2/\" > \
98 <x1:elm1>str1</x1:elm1>\
99 <x2:elm2>str1</x2:elm2>\
100 <x3:elm3 xmlns:x3=\"http://example.com/ns_0/\" >str1</x3:elm3>\
101 <x4:elm4 xmlns:x4=\"http://example.com/ns_0/\" >str1</x4:elm4>\
102 </x1:prop>"
103
104 #define XML_TESTDATA6 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \n\
105 <x1:test \n\
106 xmlns:x1=\"http://example.com/ns1/\" \n\
107 xmlns:x2=\"http://example.com/ns2/\" > \n\
108 <x1:elm1>str1</x1:elm1>\n\
109 <x2:elm2>str1</x2:elm2>\n\
110 <x3:elm3 xmlns:x3=\"http://example.com/ns_0/\" >str1</x3:elm3>\n\
111 <x1:sub> \n\
112 <x1:a attr1=\"val1\"/> \n\
113 <x1:a attr2=\"val2\">text</x1:a>\n\
114 <x1:b x2:nsattr=\"nsval\"><x1:c/></x1:b>\n\
115 </x1:sub> \n\
116 <x1:newns xmlns:x4=\"http://example.com/0/\" x4:attr3=\"val3\">\n\
117 </x1:newns>\n\
118 <x1:text>Hello\n\
119 World\n\
120 end.\n\
121 </x1:text>\n\
122 <x1:entityref ea=\"test &amp; value\">\n\
123 entity reference test &amp;quote&amp; \n\
124 &#x3C;xml&#x3E;\n\
125 </x1:entityref>\n\
126 </x1:test>\n"
127
128 #ifdef __cplusplus
129 }
130 #endif
131
132 #endif /* TEST_XML_H */
133

mercurial