def make_xmlresponse(result):
""" construct a response from a dict of uri:error_code elements """
doc = minidom.getDOMImplementation().createDocument(None, "multistatus", None)
doc.documentElement.setAttribute("xmlns:D","DAV:")
doc.documentElement.tagName = "D:multistatus"
for el,ec in result.items():
re=doc.createElementNS("DAV:","response")
hr=doc.createElementNS("DAV:","href")
st=doc.createElementNS("DAV:","status")
huri=doc.createTextNode(quote_uri(el))
t=doc.createTextNode(gen_estring(ec))
st.appendChild(t)
hr.appendChild(huri)
re.appendChild(hr)
re.appendChild(st)
doc.documentElement.appendChild(re)
return doc.toxml(encoding="utf-8")
# taken from App.Common
评论列表
文章目录