src/server/webdav/davparser.cpp

changeset 29
e8619defde14
parent 26
37ff8bf54b89
child 30
27c7511c0e34
--- a/src/server/webdav/davparser.cpp	Sun May 06 10:09:27 2012 +0200
+++ b/src/server/webdav/davparser.cpp	Wed May 16 12:47:28 2012 +0200
@@ -90,3 +90,50 @@
 
     return davrq;
 }
+
+ProppatchRequest* dav_parse_proppatch(
+        Session *sn,
+        Request *rq,
+        char *xml,
+        size_t len)
+{
+    if(!xcinit) {
+        /* TODO: create webdav module init function */
+        XMLPlatformUtils::Initialize();
+        xcinit = 1;
+    }
+    ProppatchRequest *davrq = (ProppatchRequest*)pool_malloc(
+            sn->pool,
+            sizeof(PropfindRequest));
+    
+    
+    
+    // create xml parser
+    SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
+    parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
+
+    ProppatchHandler handler(davrq, sn->pool);
+    parser->setContentHandler(&handler);
+    parser->setErrorHandler(&handler);
+
+    MemBufInputSource source((XMLByte*)xml, (XMLSize_t)len, "wsid");
+    try {
+        parser->parse(source);
+    }
+    catch (const XMLException& e) {
+        printf("XMLException\n");
+        
+    }
+    catch (const SAXParseException& e) {
+        printf("SAXParseException\n");
+        
+    }
+    catch (...) {
+        printf("davaparser Exception\n");
+    }
+
+    
+    
+
+    return davrq;
+}

mercurial