src/server/webdav/davparser.cpp

changeset 29
e8619defde14
parent 26
37ff8bf54b89
child 30
27c7511c0e34
equal deleted inserted replaced
28:f387669912e8 29:e8619defde14
88 88
89 89
90 90
91 return davrq; 91 return davrq;
92 } 92 }
93
94 ProppatchRequest* dav_parse_proppatch(
95 Session *sn,
96 Request *rq,
97 char *xml,
98 size_t len)
99 {
100 if(!xcinit) {
101 /* TODO: create webdav module init function */
102 XMLPlatformUtils::Initialize();
103 xcinit = 1;
104 }
105 ProppatchRequest *davrq = (ProppatchRequest*)pool_malloc(
106 sn->pool,
107 sizeof(PropfindRequest));
108
109
110
111 // create xml parser
112 SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
113 parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
114
115 ProppatchHandler handler(davrq, sn->pool);
116 parser->setContentHandler(&handler);
117 parser->setErrorHandler(&handler);
118
119 MemBufInputSource source((XMLByte*)xml, (XMLSize_t)len, "wsid");
120 try {
121 parser->parse(source);
122 }
123 catch (const XMLException& e) {
124 printf("XMLException\n");
125
126 }
127 catch (const SAXParseException& e) {
128 printf("SAXParseException\n");
129
130 }
131 catch (...) {
132 printf("davaparser Exception\n");
133 }
134
135
136
137
138 return davrq;
139 }

mercurial