src/server/test/xml.h

Sat, 01 Feb 2020 18:44:31 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 01 Feb 2020 18:44:31 +0100
branch
webdav
changeset 244
e59abb210584
parent 232
499711b2a970
child 319
a9b9344875aa
permissions
-rw-r--r--

add minimal mkcol implementation and prepare delete

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

mercurial