开发者

problem with uploading and downloading xml document from Datastore using google app and python

i am creating one xml document in my google app and storing it as blob while fetching back from datastore how do i convert it to again xml doc

class xmlStore(db.Model):  
 xmlRef=db.BlobProperty()

creating xml doc like this:

d开发者_如何学GoocRef=Document()
fp=docRef.createElement("Client")
fp.setAttribute("ID","21783")
docRef.appendChild(fp)

storing to datastore:

x=xmlStore(xmlRef=str(docRef))  
x.put()

while retriving back:

result = db.GqlQuery("SELECT * FROM xmlStore").fetch(1)

while printing on webpage:

for response in result:
 self.response.out.write(response.xmlRef)

its giving me xml.dom.minidom.Document instance at 0x6a2bddb0b5aef438

how do i get back it in xml..


Have a look at Python's documentation about xml.dom.minidom toxml method.

You say:

its giving me xml.dom.minidom.Document instance at 0x6a2bddb0b5aef438

Call the .toxml() method of that object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜