| 40 |
40 |
| 41 |
41 |
| 42 |
42 |
| 43 void property_xml2str(DavXmlNode *content, const char *namespace, cxmutstr *out_xmlstr, cxmutstr *out_nsdef) { |
43 void property_xml2str(DavXmlNode *content, const char *namespace, cxmutstr *out_xmlstr, cxmutstr *out_nsdef) { |
| 44 CxBuffer buf; |
44 CxBuffer buf; |
| 45 cxBufferInit(&buf, NULL, 2048, cxDefaultAllocator, CX_BUFFER_AUTO_EXTEND); |
45 cxBufferInit(&buf, cxDefaultAllocator, NULL, 2048, CX_BUFFER_AUTO_EXTEND); |
| 46 |
46 |
| 47 CxMap *nsmap = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 16); |
47 CxMap *nsmap = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 16); |
| 48 cxMapPut(nsmap, namespace, strdup("x0")); |
48 cxMapPut(nsmap, namespace, strdup("x0")); |
| 49 |
49 |
| 50 dav_print_node(&buf, (cx_write_func)cxBufferWrite, nsmap, content); |
50 dav_print_node(&buf, (cx_write_func)cxBufferWrite, nsmap, content); |
| 52 cxmutstr ret = cx_mutstrn(buf.space, buf.size); |
52 cxmutstr ret = cx_mutstrn(buf.space, buf.size); |
| 53 cxBufferPut(&buf, 0); |
53 cxBufferPut(&buf, 0); |
| 54 |
54 |
| 55 |
55 |
| 56 CxBuffer nsbuf; |
56 CxBuffer nsbuf; |
| 57 cxBufferInit(&nsbuf, NULL, 2048, cxDefaultAllocator, CX_BUFFER_AUTO_EXTEND); |
57 cxBufferInit(&nsbuf, cxDefaultAllocator, NULL, 2048, CX_BUFFER_AUTO_EXTEND); |
| 58 CxMapIterator i = cxMapIterator(nsmap); |
58 CxMapIterator i = cxMapIterator(nsmap); |
| 59 int addSpace = 0; |
59 int addSpace = 0; |
| 60 cx_foreach(CxMapEntry *, entry, i) { |
60 cx_foreach(CxMapEntry *, entry, i) { |
| 61 const char *ns = entry->key->data; |
61 const char *ns = entry->key->data; |
| 62 const char *pre = entry->value; |
62 const char *pre = entry->value; |