MCPcopy Create free account
hub / github.com/acl-dev/acl / parse_xml_file

Function parse_xml_file

lib_acl/samples/xml/xml6/xml.c:176–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176static int parse_xml_file(const char *filepath)
177{
178 acl_int64 len;
179 ACL_VSTREAM *fp = acl_vstream_fopen(filepath, O_RDWR, 0600, 8192);
180 char *addr;
181 ACL_XML3 *xml;
182
183 if (fp == NULL) {
184 printf("open %s error %s\r\n", filepath, acl_last_serror());
185 return -1;
186 }
187 len = acl_vstream_fsize(fp);
188 if (len <= 0) {
189 printf("fsize %s error %s\r\n", filepath, acl_last_serror());
190 acl_vstream_close(fp);
191 return -1;
192 }
193
194 addr = mmap_addr(ACL_VSTREAM_SOCK(fp), (size_t) len);
195 if (addr == NULL)
196 {
197 printf("mmap_addr error %s\r\n", acl_last_serror());
198 acl_vstream_close(fp);
199 return -1;
200 }
201 xml = acl_xml3_alloc();
202
203 ACL_METER_TIME("-------------begin--------------");
204 acl_xml3_update(xml, addr);
205 ACL_METER_TIME("-------------end--------------");
206
207 acl_vstream_close(fp);
208
209 if (acl_xml3_is_complete(xml, "root"))
210 printf("Xml is complete OK, filepath: %s\r\n", filepath);
211 else
212 printf("Xml is not complete, filepath: %s\r\n", filepath);
213 acl_xml3_free(xml);
214
215 ummap_addr(addr, len);
216
217 printf("Enter any key to continue ...\r\n");
218 getchar();
219
220 return 0;
221}
222
223static void walk_xml(ACL_XML3* xml)
224{

Callers 1

mainFunction · 0.70

Calls 10

acl_vstream_fopenFunction · 0.85
acl_last_serrorFunction · 0.85
acl_vstream_fsizeFunction · 0.85
acl_vstream_closeFunction · 0.85
acl_xml3_allocFunction · 0.85
acl_xml3_updateFunction · 0.85
acl_xml3_is_completeFunction · 0.85
acl_xml3_freeFunction · 0.85
mmap_addrFunction · 0.70
ummap_addrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…